|
*** Important function for advanced users.
If you try to develop your own shaders you will probably need to debug them.
3DSTATE Shader engine supports debugging assembly level and high-level language vertex and pixel shaders.
3DSTATE supports is integrated into Microsoft® Visual Studio® .NET
Developing your own Shaders requiers a lot of knowledge in 3D and math.
For most users the best policy would be to use one of the available free shaders / effect files.
found on the Internet.Even if you understand nothing of the Shader script, you can still try and modify some of the code, who knows
many of the best inventions were discovered accedently ( Serendipity ).
How to debug your shaders from inside Microsoft Visual Studio .NET environment.
-------------------------------------------------------------------------------
1) You need to have the full DirectX SDK 9.0. Note that installing just the C\C++ subset
will not install the DirectX Extensions for Visual Studio .NET
When asked chose installing Debug Version of Direct3D
2) Go to the Control Panel and select DirectX. Clcik on the D3D tab and enable all
the debugging oprions you see there. Note that if you want to debug a Pixel Shader
then check Enumerate Reference Rasterizer (and uncheck the other two rasterizers)
3) Make sure you have the call STATE_effect_set_debug_mode()
note that this function must be called before the first call to STATE_engine_render()
4) To start your program go to the Debug menu->Direct3D->Start D3D
If you dont have the Direct3D entery in you debug menu it means
that DirectX Extensions for Visual Studio .NET is not installed
To install it reinstall DirectX SDK 9.0 (the full version)
5) You can put breakpoints in your shader code the same way you put in
your C++ code. The easiest way is to press F2 at the code line where you want to insert
a breakpoint. Note that if you put a breakpoint inside a Pixel Shader
you must use the Reference Rasterizer (see item "2" above)
When running in debug mode, your program will be much slower. To get is back to full speed
do the following:
1) In the DirectX control panel, unselect all the debug options.
Make sure you enumarate the HAL rasterizer.
2) Cancel the call to STATE_effect_set_debug_mode()
|