Jump to content
  • Advertisement
Sign in to follow this  
Dunge

HLSL debugging?

This topic is 3623 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

Hello! I'm currently trying to learn shaders and read whatever I can find about them. I ended up on "Direct3D 10 Shader Model 4.0 Workshop" in the DirectX SDK's Sample Browser. First lesson is supposed to help us understand the debugging aspect, having a bad case letter for a variable (who wasn't really bad at first?!, but I changed it to provoke the error anyway). It is told that I should see a debugging message output who would explain the error. I added the executable file in DirectX Control Panel DX10 debug programs and set it to force on. Upon running the application I get some First-chance exceptions and then
exercise00.cpp(262): D3DX10CreateEffectFromFile( str, NULL, NULL, "fx_4_0", dwShaderFlags, 0, pd3dDevice, NULL, NULL, &g_pEffect10, NULL, NULL ) hr=E_FAIL (0x80004005)
with a messagebox popup saying the same message. As I understand, this is the line creating the effect, but it tells me nothing about the actual error in the effect file (the bad case). DirectX Error Lookup tool for this hr code simply gives "An undetermined error occurred". I then searched this forum and saw a topic about VS2005 who can't debug HLSL. Maybe it's the same thing about VS2008 (which I have) so I went on and tried PIX as suggested. The output log was exactly the same, but I could see a list of all DX calls since the start of the application. Nothing about the actual error though. Any ideas??

Share this post


Link to post
Share on other sites
Advertisement
An errors from the shader compiler will be put into the ID3D10Blob pointed to by the ppErrors parameter. You'll have to provide one, then pull the error out and look at it.

If you don't want to do that, you an just compile the .fx file using fxc on the command line and it will give you the errors.

Share this post


Link to post
Share on other sites
Quote:
Original post by Dunge
I added the executable file in DirectX Control Panel DX10 debug programs and set it to force on. Upon running the application I get some First-chance exceptions and then
exercise00.cpp(262): D3DX10CreateEffectFromFile( str, NULL, NULL, "fx_4_0", dwShaderFlags, 0, pd3dDevice, NULL, NULL, &g_pEffect10, NULL, NULL ) hr=E_FAIL (0x80004005)

with a messagebox popup saying the same message.


What you call the "debug" message are the error and warning messages from the compiler. It has nothing to do with the ability of VS2005 to debug shaders.

You can, for example, get them from within your code thanks to the ppErrorMsgs argument to the D3DX compile function.
ID3D10Blob *pErrorMsg = NULL;

hr = D3DX10CompileFromFile( str, NULL, NULL, "myshader", "vs_4_0",
dwShaderFlags, NULL, NULL, &pVSBuf, &pErrorMsg, NULL );

// you can also display a popup here if you prefer
if (pErrorMsg)
{
_RPT1(_CRT_WARN, "compilation error : %s\n", (char*) pErrorMsg->GetBufferPointer());
SAFE_RELEASE(pErrorMsg);
}



That would display something like that to the debug output:

compilation error : myexample.vsh(56,5): error X3004: undeclared identifier 'Output'


LeGreg

Share this post


Link to post
Share on other sites
Thanks for the help.
I actually meant the compilation and execution messages rather than actual debugging, sorry if I used the wrong term.

[Edited by - Dunge on July 24, 2008 2:35:54 AM]

Share this post


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

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!