Sign in to follow this  
diginerd

PIX shader code stepping issue

Recommended Posts

So I'm writing a game in XNA and I'm trying to debug one of my vert shaders using PIX. I take a single frame capture and go into the hlsl code for the verts I'm debugging, but when I try to step through the code, pix keeps jumping to random lines of my shader instead of going through them in execution order. I set directx to debug mode and enabled shader debugging. Does anyone have an idea why this would happen? Diginerd

Share this post


Link to post
Share on other sites
By default the DX shader compiler will heavily optimize your code, and this almost always involves re-arranging the order of instructions. To avoid this you can compiled shaders without optimizations. This makes them run slower, but lets you easily step through them.

If you're using the Content Pipeline to compile your effects, the effect processor will attempt to compile your code without optimizations if you compile your Debug build. However it will re-enable optimizations if disabling them causes your shader to go over the instruction limit (which can happen pretty easily in vs_2_0 or ps_2_0). If you're building Debug and your shaders are still getting optimized, you can try bumping them up to vs_3_0 and ps_3_0 since those have much much higher instruction limits.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this