Jump to content

  • Log In with Google      Sign In   
  • Create Account


why pix for windows can get hlsl code form D3DXCompileShaderFromFile?


Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.

  • You cannot reply to this topic
6 replies to this topic

#1 db123   Members   -  Reputation: 206

Like
0Likes
Like

Posted 11 August 2013 - 04:58 AM

when i load hlsl shader file to memory, and then create shader by 

D3DXCompileShader

pix only display asm code at its debugger.

 

if i use 

D3DXCompileShaderFromFile

,it display hlsl.

so i want to know how does it do this or how to make it display hlsl code when i use D3DXCompileShader?

thank you ~~



Sponsor:

#2 Hodgman   Moderators   -  Reputation: 28496

Like
3Likes
Like

Posted 11 August 2013 - 06:47 AM

When you use the D3DXSHADER_DEBUG flag, the compiled shader will contain line numbers and file names that the debugger can use to display the corresponding source code for each asm instruction.

e.g. the debugger knows that when it's executing asm instruction #47, it should display line #3 from c:\projects\shader.hlsl.

 

If you're compiling the code from memory, there's no meaningful filenames that can be embedded into the shader code.



#3 db123   Members   -  Reputation: 206

Like
0Likes
Like

Posted 11 August 2013 - 06:53 AM

When you use the D3DXSHADER_DEBUG flag, the compiled shader will contain line numbers and file names that the debugger can use to display the corresponding source code for each asm instruction.

e.g. the debugger knows that when it's executing asm instruction #47, it should display line #3 from c:\projects\shader.hlsl.

 

If you're compiling the code from memory, there's no meaningful filenames that can be embedded into the shader code.

 

can i call some interface to tell him where is the source code or the content of that file?



#4 Hodgman   Moderators   -  Reputation: 28496

Like
0Likes
Like

Posted 11 August 2013 - 07:20 AM

I'm not sure about that in D3DX. Look into FXC.exe and D3DCompile.



#5 NightCreature83   Crossbones+   -  Reputation: 2689

Like
0Likes
Like

Posted 11 August 2013 - 08:54 AM

I'm not sure about that in D3DX. Look into FXC.exe and D3DCompile.

You can atleast with FXC i believe it is the /Zi flag

 


Worked on titles: CMR:DiRT2, DiRT 3, DiRT: Showdown, GRID 2, Mad Max

#6 Adam_42   Crossbones+   -  Reputation: 2419

Like
0Likes
Like

Posted 11 August 2013 - 04:16 PM

You could always add some debug code that saves the buffer out to a file (named based on say a hash of the source code), and compiles it from there using D3DXCompileShaderFromFile().



#7 Jason Z   Crossbones+   -  Reputation: 4846

Like
0Likes
Like

Posted 12 August 2013 - 04:53 AM

If you are trying to implement some debugging routines, I'm sure the tracing API will be interesting for you.






Old topic!
Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.



PARTNERS