Game Development Community

TGEA crashs on new DXSDK, a way to avoid

by Heron Huang · in Torque Game Engine Advanced · 02/14/2007 (7:00 pm) · 14 replies

I compiled TGEA rc1 based on Feb 07 DXSDK,some errors occur for shader's loading fail.(error X1507: failed to open source file: '../shdrConsts.h' GFXD3DShader::initVertShader - unable to compile shader!). I read the documents with the DXSDK,and found that I should replace the shader compile flage from D3DXSHADER_DEBUG to D3DXSHADER_USE_LEGACY_D3DX9_31_DLL for the internal shader compiler changed since Dec2006 version.
I wish this should be helpful if you wanna get the TGEA works on newest DXSDK.

#1
02/14/2007 (7:24 pm)
You're getting this error when you run the engine, right?

shdrConsts.h resides in the example/shaders directory and is referenced by various shaders in that directory.

Looks like one of your shader files is expecting shdrConsts.h to be somewhere it's not.
#2
02/14/2007 (7:27 pm)
Yeah,,it is. It seems the new shader compiler will fail when compile a shader with include files,but the older one can.
#3
02/14/2007 (7:37 pm)
Feb 2007/Dec 2006 DX SDKs are not supported by the engine at this point. The shaders need revising to be either 1.1 ASM or remove 1.1 support, or just not support any future DirectX versions... and the Include path issue is part of what may or may not be a bug, as reported on some MS forums
#4
02/14/2007 (7:44 pm)
Actually, the D3DXSHADER_USE_LEGACY_D3DX9_31_DLL flage forces the new DX to use the old shader compiler, it can use 1.1asm and 1.x targets as well.
Try it, it works on my PC.
#5
02/14/2007 (9:37 pm)
October SDK is recommended.

See this thread for more details - www.garagegames.com/mg/forums/result.thread.php?qt=55815
#6
02/15/2007 (11:47 am)
Hmm, gotta test that someday. If true, maybe we can use that flag only when compiling 1.1 and 1.4 shaders, and use the new optimization flags for the others.
#7
02/15/2007 (3:23 pm)
I'm wondering if the February SDK fixed the #include bug, and then the only problem to fix is the compile flags. Does TGEA work for you with just changing the compile flag Heron?
#8
02/15/2007 (5:51 pm)
Brain, The new Feb SDK did not fix the FX including problem, the flag just forces the DX to change the new internal shader compiler to the old one.There are about two places (you can search D3DXSHADER_DEBUG )in TGEA should be changed.It really works for me,try it.
#9
02/15/2007 (5:55 pm)
Using the flag, you're not gaining any benefit from using the new SDK and will eventually be something that is removed, so relying on it is sort-of meh
#10
02/15/2007 (6:00 pm)
Em,you are right,Jeremiah. It's the temporary solution.The final solution should be GG guys' porting the GFX to DX10 or at least newest DX9 version. :O)
#11
02/16/2007 (11:57 am)
That isn't the final solution because we would still want to use shader 1.x. The compiler flag requires you to ship additional DLLs in your redist, and, in my opinion, that completely negates the purpose of a standardized DirectX version, as well as COM.
#12
02/16/2007 (12:34 pm)
Yeah, it's really frustrating that MS did this. DX9 has been out for quite a while, and the shader compiler was/is pretty refined at this point. The now "legacy" compiler should be fine for just about everybody making a product targeting SM 1.x-3.x. In fact, many devs are saying the new compiler compiles less optimal code for SM 2.0 than the legacy one. Newer is not always better folks.

As developers, it should be safe to use the legacy flag for everything DX9 - I doubt MS will be bringing much more great stuff to the DX9 SDK at this point. We're still looking for a solution; we'll probably just use the legacy flag and look into how to best include the proper .dlls. The include problem is a bug on the MS side, and is annoying that it wasn't fixed in the Feb SDK. There is a workaround, but we might wait till March to see if they fixed it there.

We've got to support DX10 now, which is a much larger change than from DX8-DX9, so be patient.
#13
02/16/2007 (12:47 pm)
From what I've read, that DX10 change will be a big one. Not to mention all the people howling that TGEA doesn't support OpenGL yet...
#14
03/04/2007 (7:57 am)
I've managed to compile TGEA with DirectX February edition 2007 and VS.NET 2005 running on the XP. The issue that I've seen is that the shaders don't work properly, the shadows don't work, and the lighting on the terrain doesn't work (turns out black).

Anyway, just for people who are newer and want to make it run with the February 2007 SDK, here is how to fix the problem as Heron Huang mentioned briefly above:
1) Open the following gfxD3DShader.cpp
2) Find the D3DXCompileShaderFromFile function and change the flag to D3DXSHADER_USE_LEGACY_D3DX9_31_DLL (there should be two of them)
3) Make the solution