I don't know if many of you tried the new excellent feature of Visual Studio 2012 to debug Direct3D based apps.
I successfully capture a frame of my app, then I want to debug the execution of a Vertex Shader:
I click on the green triangle to debug a given vertex, but I got a "No Symbol Found" message which prevent me to debug it.
Someone knows what to do for Visual Studio to find the symbols?
Thanks.
When using SlimDX you can pass ShaderFlags
to the shader compiler. Passing ShaderFlags.Debug
causes debug symbols to be included.
var bytecode = ShaderBytecode.CompileFromFile("shader.fx", "VShader", "vs_4_0", ShaderFlags.Debug, EffectFlags.None)
Hopefully it is something similar in native Direct3D.
You need to compile your shaders with debug information. And in order to reliably debug, you likely will want to disable optimizations as well. Depending on how you compile your shaders, this will be one of two ways:
D3DCompile / D3DCompileFromFile: Pass the D3DCOMPILE_DEBUG
and D3DCOMPILE_SKIP_OPTIMIZATION
flags to D3DCompile. Note that depending on D3D version and whether you are using D3DX, these flags might have different prefixes.
fxc.exe: The compile flags have switch equivalents. For D3DCOMPILE_DEBUG
, pass /Zi
to fxc. For D3DCOMPILE_SKIP_OPTIMIZATION
, pass /Od
.
Visual Studio 2012 is fairly smart about finding the source for your shaders based on the embedded debug information, but should it fail to do this, it will prompt you to point to the appropriate file.
From msdn:
It's not possible to debug an app and its shader code at the same time. However, you can alternate between them
It's possible that you are debugging the application and trying to debug shader at the same time.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With