Skip to main content
GameDev.net gamedev.net
🔒 Locked

Problem creating Shader from file!

Started by 00702000744 May 26, 2003 at 11:38 PM 5 replies 550+ views
Original Post
00702000744
00702000744
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
xyzzy00
xyzzy00
Try passing in "VertexShader1.vsh" in as the file name, instead of just "VertexShader1".

xyzzy
00702000744
00702000744
so bad it remained unworking
S1CA
S1CA
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
00702000744
00702000744
I did maximize the debug output, but no information is provided by DX.
S1CA
S1CA
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
00702000744
00702000744
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?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.