A
AbdEllah Gogop
Guest
i have successfully translated the DirectX 10 sample (named Tutorial01 in the SDK) from native C++ to the vb.NET;
the problem becomes with the sample N°2 (Tutorial02) , in this line:
MsgBox(D3DX10CreateEffectFromFileW("C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Samples\C++\Direct3D10\Tutorials\Tutorial02 - Copie\Tutorial02.fx",
Nothing,
Nothing,
"fx_4_0",
D3D10_SHADER_ENABLE_STRICTNESS Or D3D10_SHADER_DEBUG,
0,
device,
Nothing,
Nothing,
eff,
err,
Nothing))
the return value is -2005530516, which means D3DERR_INVALIDCALL (DxErr look up);
the err is a valid pointer (intptr), converted to an interface of type ID3D10Blob correctly using the function Marshal.GetTypedObjectForIUnknown();
this interface contains exactly 02 members (the function GetBufferSize() and the function GetBufferPointer()), these functions returns accessviolationexception;
so this is my code :
<DllImport("C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Redist\d3dx10_43.dll",
EntryPoint:="D3DX10CreateEffectFromFileW",
CallingConvention:=CallingConvention.StdCall)>
Public Shared Function D3DX10CreateEffectFromFileW(
<MarshalAs(UnmanagedType.LPWStr)> ByVal pFileName As String,
ByVal pDefines As IntPtr,
ByVal pInclude As IntPtr,
<MarshalAs(UnmanagedType.LPWStr)> ByVal pProfile As String,
ByVal HLSLFlags As Integer,
ByVal FXFlags As Integer,
ByVal pDevice As ID3D10Device,
ByVal pEffectPool As IntPtr,
ByVal pPump As IntPtr,
ByRef ppEffect As IntPtr,
ByRef ppErrors As IntPtr,
ByVal pHResult As IntPtr) As Integer
End Function
the converted id3d10blob interface
<ComImport()>
<Guid("8BA5FB08-5195-40e2-AC58-0D989C3A0102")>
<InterfaceType(ComInterfaceType.InterfaceIsDual)>
Interface ID3D10Blob
Inherits IUnknown
<PreserveSig()>
Function GetBufferPointer() As IntPtr
<PreserveSig()>
Function GetBufferSize() As UInt32
End Interface
remark: i have built a native C++ DLL that acts as a bridge between the vb.NET and the directx sample (Tutorial02)
, it gives me correct answers with the D3DX10CreateEffectFromFileW and the GetBufferPointer()/GetBufferSize() functions=
the return value from D3DX10CreateEffectFromFileW = 0 and err = nullptr.
Continue reading...
the problem becomes with the sample N°2 (Tutorial02) , in this line:
MsgBox(D3DX10CreateEffectFromFileW("C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Samples\C++\Direct3D10\Tutorials\Tutorial02 - Copie\Tutorial02.fx",
Nothing,
Nothing,
"fx_4_0",
D3D10_SHADER_ENABLE_STRICTNESS Or D3D10_SHADER_DEBUG,
0,
device,
Nothing,
Nothing,
eff,
err,
Nothing))
the return value is -2005530516, which means D3DERR_INVALIDCALL (DxErr look up);
the err is a valid pointer (intptr), converted to an interface of type ID3D10Blob correctly using the function Marshal.GetTypedObjectForIUnknown();
this interface contains exactly 02 members (the function GetBufferSize() and the function GetBufferPointer()), these functions returns accessviolationexception;
so this is my code :
<DllImport("C:\Program Files (x86)\Microsoft DirectX SDK (June 2010)\Redist\d3dx10_43.dll",
EntryPoint:="D3DX10CreateEffectFromFileW",
CallingConvention:=CallingConvention.StdCall)>
Public Shared Function D3DX10CreateEffectFromFileW(
<MarshalAs(UnmanagedType.LPWStr)> ByVal pFileName As String,
ByVal pDefines As IntPtr,
ByVal pInclude As IntPtr,
<MarshalAs(UnmanagedType.LPWStr)> ByVal pProfile As String,
ByVal HLSLFlags As Integer,
ByVal FXFlags As Integer,
ByVal pDevice As ID3D10Device,
ByVal pEffectPool As IntPtr,
ByVal pPump As IntPtr,
ByRef ppEffect As IntPtr,
ByRef ppErrors As IntPtr,
ByVal pHResult As IntPtr) As Integer
End Function
the converted id3d10blob interface
<ComImport()>
<Guid("8BA5FB08-5195-40e2-AC58-0D989C3A0102")>
<InterfaceType(ComInterfaceType.InterfaceIsDual)>
Interface ID3D10Blob
Inherits IUnknown
<PreserveSig()>
Function GetBufferPointer() As IntPtr
<PreserveSig()>
Function GetBufferSize() As UInt32
End Interface
remark: i have built a native C++ DLL that acts as a bridge between the vb.NET and the directx sample (Tutorial02)
, it gives me correct answers with the D3DX10CreateEffectFromFileW and the GetBufferPointer()/GetBufferSize() functions=
the return value from D3DX10CreateEffectFromFileW = 0 and err = nullptr.
Continue reading...