• Advertisement
Sign in to follow this  

PIX hlsl source debug,cannot F12.

This topic is 2200 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hi,all.smile.png
I have a problem when I use pix to debug shader.
First,as the dx9 sample default use D3DXSHADER_DEBUG,it can show source code when pix debug,but when step it it's just like have been optimized.And the asm is too sad to read.
Then,I open
#ifdef DEBUG_VS
dwShaderFlags |= D3DXSHADER_FORCE_VS_SOFTWARE_NOOPT;
#endif
#ifdef DEBUG_PS
dwShaderFlags |= D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT;
#endif

And now it can step hlsl source code "rightly",that's what I need.(Edit:This can only work in PIXGameDebugging sample.Other samples can't,as follows.)
But the question is:Its fps is so slow just be 0.2 or 0.3,it can't even capture the event what I press F12.And even worse,after many many F12,it may get it,but pix always crash.I use pix x64 on windows7 x64.And my card is GTX460.
Then I tried to use dwShaderFlags |= D3DXSHADER_SKIPOPTIMIZATION to disable the optimization.But it still cannot do what I want.
So I want to ask how you guys debug shader as can step it in hlsl source code?Is something I did wrong?
Maybe I can reconstruct a project in FXComposer to debug,but now I don't have the time.
Thanks!
Harry

If you don't know clearly about my expression,please tell me,I'll improve it.So sorry for my bad english.
I think maybe it's easy for you skilled in dx. Edited by Harry Lee

Share this post


Link to post
Share on other sites
Advertisement
Hidden
If you don't know clearly about my expression,please tell me,I'll improve it.So sorry for my bad english.sad.png
I think maybe it's easy for you skilled in dx.

Share this post


Link to post
Anyone can tell me something?
I'm very urgent to know the way to solve this problem.And I searched many topics but don't get the key.Is something I ignore?Or it's just "like this"?
Thanks very much!biggrin.png

Share this post


Link to post
Share on other sites
In my experience, you can't step through your HLSL code "rightly" with DX9. It's just like that sad.png
Instead you've got to use other ways of debugging your shaders, like returning temporary values as the final output colour.

D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT is slow because it runs your shader on the CPU instead of the GPU.

Share this post


Link to post
Share on other sites
In my experience, you can't step through your HLSL code "rightly" with DX9. It's just like that sad.png Instead you've got to use other ways of debugging your shaders, like returning temporary values as the final output colour. D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT is slow because it runs your shader on the CPU instead of the GPU.

HI,Hodgman.Thanks very much!
So if I want to know clearly about how an algorithm works,I can only view the registers' values with some hlsl source,and try to guess it by myself?
Or can you give me some experienced methods to understand an algorithm clearly better?
Of course,look deep into the algorithm paper is a good way.wink.png
Thanks!
Harry

Share this post


Link to post
Share on other sites

In my experience, you can't step through your HLSL code "rightly" with DX9. It's just like that sad.png
Instead you've got to use other ways of debugging your shaders, like returning temporary values as the final output colour.

D3DXSHADER_FORCE_PS_SOFTWARE_NOOPT is slow because it runs your shader on the CPU instead of the GPU.

You need to both turn generate debug symbols and no optimisations on whilst compiling the shader or effect file for PIX to see HLSL.

From the PIX help topics:

Differences between Direct3D 9 and Direct3D 10:
Source debugging is implemented differently in Direct3D 9 and in Direct3D 10, and this can cause different behaviors under the two versions.
For Direct3D 10, PIX embeds shader HLSL source code directly into the PIXRun file produced by running an experiment.
Under Direct3D 9, the PIXRun file does not contain the HLSL source. Instead, it has links to HLSL source code used in building the target program. If that source code has moved, from its original location, PIX will prompt for its current location. If the source is not on the development system, only assembly debugging will be supported.
[/quote]

Also you need to try and fix all the warnings and errors the debug runtime gives you as these warnings and errors can make pix not be able to debug your application.

I found for XNA 4 applications you also have to tick "Disable D3DX Analysis" in the target program tab.

Share this post


Link to post
Share on other sites
Thanks,NightCreature83.
Now I can step it "rightly" order with the usage D3DXSHADER_DEBUG | D3DXSHADER_SKIPOPTIMIZATION | D3DXSHADER_NO_PRESHADER.But the "for" statement still at a wrong order.
And

Instead you've got to use other ways of debugging your shaders, like returning temporary values as the final output colour.

Yep,Hodgman,thanks very much!That's what I want to get.smile.png Sorry for the latency I don't see these edit words.

Edit:When using D3DXSHADER_DEBUG | D3DXSHADER_SKIPOPTIMIZATION | D3DXSHADER_NO_PRESHADER,you may compile it failed.This situation you may try to compile it with fxc.exe,and if it failed as error info "error X5608: Compiled shader code uses too many arithmetic instruction slots (89). Max. allowed by the target (ps_2_0) is 64.".You then can try compile it with higher SM model.I want to hint it because it may occur when using debug flags(/Od /Zi),but not when using release flags. Edited by Harry Lee

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement