views:

10

answers:

0

I'm currently writing a tool for pre-compiling our D3D9 shader code (will be using the ID3DXEffect in-game). I'm doing this through the ID3DXEffectCompiler interface and calling CompileEffect and I can do all of this without creating a IDirect3DDevice9 object (or even linking against d3d9.lib).

The only problem is that I would like to analyse the shader byte code through the various D3DXGetShaderXXX functions (specifically, I want to retrieve the input semantics for the vertex shaders). The only way I've found to directly access the byte code is by creating a device, though this seems like overkill just to access the data (especially seeing how it forces me to link against another library).

How can I get at the compiled shader code WITHOUT an IDirect3DDevice9 instance, or alternatively, how can I get the vertex shader input semantics for each pass from the ID3DXEffectCompiler class?

Thanks

P.S. I know that the shader byte code is there in the compiled effect and that nothing really magical is done by the device. I've confirmed this by creating a dummy implementation of the IDirect3DDevice9 class and passing that to the D3DXCreateEffect function. During the creation of the Effect instance, it only calls the Add/ReleaseRef and CreateVertex/PixelShader functions to which it passes the latter the byte code I want (and if I return a dummy IDirect3DVertex/PixelShader class, it only calls the GetFunction function and is happy if I just give it what it handed me in the CreateVertex/PixelShader function).