[SlimDX] blend state

Started by
12 comments, last by ucfchuck 15 years, 6 months ago
im on vs2008 full edition. there is no unmanaged debugging option in the tools->options->debugging. i found it in properties->debug where it has a thing for enabling unmanaged code debugging. but it doesnt give me anymore information.
just
An unhandled exception of type 'SlimDX.Direct3D10.Direct3D10Exception' occurred in SlimDX.dll

Additional information: E_INVALIDARG: An invalid parameter was passed to the returning function (-2147024809)
Advertisement
Make sure you're passing the Debug flag at device creation and look in the Output window in VS (View -> Output).
Sirob Yes.» - status: Work-O-Rama.
usercontrol.g_pd3dDevice = new D3D10.Device(D3D10.DeviceCreationFlags.Debug);

and in the output window, "Show output from : Debug" and there are a ton of loaded dlls and everything up until :

...
'WindowsFormsApplication3.exe': Loaded 'G:\Windows\System32\d3dx10_38.dll'
'WindowsFormsApplication3.exe': Loaded 'G:\Windows\System32\D3DCompiler_38.dll'
'WindowsFormsApplication3.exe': Loaded 'G:\Windows\System32\d3d10_1.dll'
'WindowsFormsApplication3.exe': Loaded 'G:\Windows\System32\d3d10_1core.dll'
'WindowsFormsApplication3.exe': Loaded 'G:\Windows\System32\D3DX9_38.dll'
An unhandled exception of type 'SlimDX.Direct3D10.Direct3D10Exception' occurred in SlimDX.dll

Additional information: E_INVALIDARG: An invalid parameter was passed to the returning function (-2147024809)

The thread 'Win32 Thread' (0x11bc) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0xf6c) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x12fc) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x1604) has exited with code 0 (0x0).
The thread 'Win32 Thread' (0x121c) has exited with code 0 (0x0).
The program '[5164] WindowsFormsApplication3.exe: Managed' has exited with code 0 (0x0).
The program '[5164] WindowsFormsApplication3.exe: Native' has exited with code 0 (0x0).



from this code, where it crashes at the BlendState.FromDescription():

D3D10.BlendStateDescription statedescr = new D3D10.BlendStateDescription();

statedescr.BlendOperation = D3D10.BlendOperation.Maximum;
statedescr.SetBlendEnable(0, true);
statedescr.SetBlendEnable(1, true);
statedescr.SetWriteMask(0, SlimDX.Direct3D10.ColorWriteMaskFlags.All);
statedescr.SetWriteMask(1, SlimDX.Direct3D10.ColorWriteMaskFlags.All);
statedescr.DestinationBlend = SlimDX.Direct3D10.BlendOption.DestinationColor;
statedescr.SourceBlend = SlimDX.Direct3D10.BlendOption.SourceColor;
D3D10.BlendState newstate = D3D10.BlendState.FromDescription(g_pd3dDevice, statedescr);
g_pd3dDevice.OutputMerger.BlendState = newstate;



?????

You create a blend state object by creating a blend state description and filling it out.

D3D10.BlendStateDescription statedescr = new D3D10.BlendStateDescription();

statedescr.BlendOperation = D3D10.BlendOperation.Maximum;
statedescr.SetBlendEnable(0, true);
statedescr.SetBlendEnable(1, true);
statedescr.SetWriteMask(0, SlimDX.Direct3D10.ColorWriteMaskFlags.All);
statedescr.SetWriteMask(1, SlimDX.Direct3D10.ColorWriteMaskFlags.All);
statedescr.DestinationBlend = SlimDX.Direct3D10.BlendOption.DestinationColor;
statedescr.SourceBlend = SlimDX.Direct3D10.BlendOption.SourceColor;

Then you provide that description object to D3D10 and ask it for a blend state object that matches that description. In SlimDX, this is done by calling the BlendState constructor.

D3D10.BlendState newstate = D3D10.BlendState.FromDescription(g_pd3dDevice, statedescr);


Then you set that blend state object on the pipeline as previously mentioned.

g_pd3dDevice.OutputMerger.BlendState = newstate;


[Edited by - ucfchuck on September 22, 2008 4:54:48 PM]
nevermind, im just using hlsl stuff for it now. basically straight out of tutorial 14 from the sdk
BlendState SrcColorBlendingAdd
{
BlendEnable[0] = TRUE;
BlendEnable[1] = TRUE;
SrcBlend = SRC_COLOR;
DestBlend = ONE;//DEST_COLOR;
BlendOp = ADD;
SrcBlendAlpha = ZERO;
DestBlendAlpha = ZERO;
BlendOpAlpha = ADD;
RenderTargetWriteMask[0] = 0x0F;
};

This topic is closed to new replies.

Advertisement