Jump to content
  • Advertisement
Sign in to follow this  
iYossi

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

This topic is 2808 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

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?

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
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.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!