Problem creating Shader from file!

Started by
5 comments, last by 00702000744 20 years, 10 months ago
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
Advertisement
Try passing in "VertexShader1.vsh" in as the file name, instead of just "VertexShader1".

xyzzy
so bad it remained unworking
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

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

I did maximize the debug output, but no information is provided by DX.
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

Simon O'Connor | Technical Director (Newcastle) Lockwood Publishing | LinkedIn | Personal site

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?

This topic is closed to new replies.

Advertisement