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
HLSL compiler output
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.
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());
most of the same as above,easily way i use is following.
i believe there is more sophisticated way like you said output window or something.
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.
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement