[ D3D10 ]I have compiled a shader using fxc.exe . How do I load it?

Started by
2 comments, last by smasherprog 13 years, 3 months ago
I have compiled a shader( fxc.exe /T fx_4_0 ), and it have compiled sucsessfully. Now to load it, should I still use D3DX10CreateEffectFromFile? If yes, then what do I send instead of "fx_4_0"? Or I should load it the same way?
Advertisement
I never used the D3D10 version of effects so I'm not entirely sure, but I don't think you want to use the D3DX functions if you're already pre-compiled your effect. I *think* that instead you want to open the filed containing the compiled output using a standard file I/O API, read in all of the data, and then pass it to D3D10CreateEffectFromMemory. Someone can correct me if I'm wrong.
I'm pretty sure that's correct since the MSDN documentation says D3D10CreateEffectFromMemory takes a pointer to a compiled byte code.

I use this a lot actually regardless if I'm dealing with pre-compiled byte code or compiling the effect from an fx file. When I load a new effect I cache the byte code, and whenever I load the same fx file (or clone it), I use the cached byte code with D3D10CreateEffectFromMemory to create a new instance, rather than reading from the same file again. Something extra worth considering I guess.
You load it exactly the same way you do a non compiled effect.

I use D3DX10CreateEffectFromFile To load my precompiled effects, its much simpler than opening the file, loading it to memory, then creating the shader from that.
Wisdom is knowing when to shut up, so try it.
--Game Development http://nolimitsdesigns.com: Reliable UDP library, Threading library, Math Library, UI Library. Take a look, its all free.

This topic is closed to new replies.

Advertisement