• Advertisement
Sign in to follow this  

HLSL compiler output

This topic is 2447 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 Guys,

I'm using C++ and visual studio 2008 with directx10 to create a 3d app. However the royal pain in the arse is when the D3DX10CreateEffectFromFile doesn't compile a shader because of a syntax error. Is there anyway to get the errors that happen when trying to compile an .fx file to come up in the output window of the IDE?

See I'm used to using XNA where my shader errors would appear in the Error/output window at compile time. Is this something that is only available in managed languages then?

Thanks
Mike

Share this post


Link to post
Share on other sites
Advertisement
There is. From the MSDN docs, the second to last parameter would be a ID3D10Blob that contains any compile errors. Then you could use that as output to your console or window or wherever else.

E.g.


ID3D10Blob* pErrors = 0;
D3DX10CreateEffectFromFile("myShader.fx", NULL, NULL, "fx_4_0", shaderFlags, 0, pDevice, NULL, NULL, &pEffect, &pErrors, NULL);
char* pCompileErrors = static_cast<char*>(pErrors->GetBufferPointer());

Share this post


Link to post
Share on other sites
most of the same as above,easily way i use is following.


if(FAILED(D3DX11CompileFromFile( L"ComputeRay.hlsl", 0, 0, "CS","cs_5_0",0, 0, 0, &pBlob, &pErrors, 0 )))
{
char* ms=(char*)pErrors->GetBufferPointer();
MessageBoxA(0,ms,NULL,MB_OK);
}


i believe there is more sophisticated way like you said output window or something.

Share this post


Link to post
Share on other sites
Thanks guys, yeah I'll prob have a look into linking it into the output window later but a popup will do for now :D

Share this post


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

  • Advertisement