Debugging Direct3D and DirectPythonΒΆ

The most important thing required to build solid Direct3D applications is making sure that you are using the API correctly. Because Direct3D is a quite low-level API very little error checking is done by default. Invalid data can be easily passed to Direct3D and depending what kind of data it is you might never notice anything. Then when you try you application on another computer with different specs your screen is suddenly full of garbage, all the textures blink like in a disco and the geometry looks like it is from a Salvador Dali’s painting. What happened?

Maybe you passed some invalid data to Direc3D or DirectPython has a bug. Maybe it’s a driver bug. Maybe the hardware is dying. While the first two are more likely, the other two are not unheard of. To discover what is going on you should check you application using a debug version of Direct3D and maybe use a software rasterizer.

To do this you should:

  • Download a Direct3D SDK. See the Links-section in the main page for DirectX developer centre. It’s a big download, but all you have to do is install it.
  • Download DebugView and launch it.
  • Enable Direct3D debugging. Call d3d11.enableDebugging() as the first thing in your application.
  • Use a software rasterizer. Pass DRIVER_TYPE_REFERENCE or DRIVER_TYPE_WARP to the Device constructor. You can use DRIVER_TYPE_WARP without an SDK.
  • Launch your application and see if you can notice anything interesting in DebugView. Look especially for Direct3D warnings and errors.

Another useful tool for monitoring your application is PIX. If you have installed the SDK you can read it’s documentation.

Get DirectPython 11 at Fast, secure and Free Open Source software downloads