views:

394

answers:

3

I'm trying to figure out how to debug pixel and vertex shaders in DirectX, I've tried using Pix for Windows but find it to be quite buggy and effectively non-operational. Is there an alternative that would allow me to debug these shaders inside my own application?

+2  A: 

In short, no.

Yes pix is a bit buggy but has improved MASSIVELY since its first release. Make sure you are running the latest SDK!

Goz
+2  A: 

I don't know of any third party tool for debugging hlsl-shaders, but I had good experiences with debugging it by using some simple techniques.

You could just copy render targets on cpu and store it into a bitmap, print it out to the terminal, or access it in your CPU debugger.

If there is a bug, you should first check whether the buffers you use really have the right values, at the beginning it can happen often that some textures are created with wrong parameters or the data is expected in another order ... in my experience this is a common error-source.

Trantec
+2  A: 

Just output debug information as color. For example you can output 255*(normal+1) as r,g,b, you can output some intermediate shader variable as color, or you can check if it is within the bounds in the shader and output white if it is and black if it's not. That usually help.

mirror2image