why pix for windows can get hlsl code form D3DXCompileShaderFromFile?

Started by
5 comments, last by Jason Z 10 years, 8 months ago

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 ~~

Advertisement

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.

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?

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

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, theHunter, theHunter: Primal, Mad Max, Watch Dogs: Legion

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().

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

This topic is closed to new replies.

Advertisement