Question

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?

Was it helpful?

Solution

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.

OTHER TIPS

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!

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.

PIX for Windows comes with the DirectX SDK (from June 2010 I can verify) and will allow you to visually debug what you are setting state wise and allow you to step through your shaders line by line. Its a life saver.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top