Archived

This topic is now archived and is closed to further replies.

Problem creating Shader from file!

This topic is 5316 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 everyone: I used the method D3DXAssembleShaderFromFile( "VertexShader1", NULL, NULL, 0, &pCode, &pErrorMsgs ); to assemble a shader from a file named "VertexShader1.vsh" which is placed in the same directory as my project. The content of the file surely is correct but somehow the &pCode is assigned 0x000000. Does anyone have any idea how this could turn out wrong? thanks for help in advance

Share this post


Link to post
Share on other sites
Link your project with the debug version of D3DX (d3dx8d.lib, d3dx9d.lib - note the D), also use the debug D3D runtime and set the output level to maximum in the control panel.

Run the code again once you''ve done that and look at the debug output in the output window - D3DX should tell you exactly why the call failed (e.g. unable to load file, bad instructions in the shader file, instructions which aren''t supported, missing declarations etc).

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
1) Did you link with the debug version of D3DX though ?

2) If the function failed, then it should have returned an error HRESULT - what was the return value ?

3) If you''ve linked to the debug version of D3DX and the function returns an error, then it DOES display the reason to the Debug (aka Output - not the Build etc) window. That''s assuming you use MSVC, the build of your program is a debug build and you ran the program via the debugger (i.e. F5)

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites
D3DXAssembleShaderFromFile( "VertexShader1", NULL, NULL, 0, &pCode, &pErrorMsgs );

Finally the error message is "cannot open source file VertexShader1" I am sure the path to the file is right, anyone knows what could have caused this error?

Share this post


Link to post
Share on other sites