Sign in to follow this  
mwadelin

HLSL compiler output

Recommended Posts

mwadelin    102
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
Starnick    1892
There is. From the [url="http://msdn.microsoft.com/en-us/library/bb172658%28v=vs.85%29.aspx"]MSDN[/url] 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.

[code]
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());
[/code]

Share this post


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

[code]
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);
}[/code]

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

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this