Jump to content
  • Advertisement
Sign in to follow this  
LTKeene

Precompiling .fx files?

This topic is 2892 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

Hello,

I'm experimenting with DirectX9 and for the moment I'm loading my pixel shader programs at runtime by doing the following:

Effect effect1 = Effect.FromFile(device, path + "MyEffectFile.fx", null, ShaderFlags.None, null, out errors);

It's my understanding that the shader is compiled at runtime. Is there a way to precompile the shader file and "lump it in" with the rest of the executable so that the shader text file itself doesn't have to be distributed?

-L

Share this post


Link to post
Share on other sites
Advertisement
You can use the function D3DCompile or the FXC tool to precompile FX Files.

The target profile for DX9 effects is fx_2_0.

The compiled effect could be created with D3DXCreateEffect.

Share this post


Link to post
Share on other sites
Quote:
Original post by Demirug
The compiled effect could be created with D3DXCreateEffect.


If you use fxc to compile to a binary output file, you can use D3DXCreateEffectFromFile to load it. It will automatically distinguish between a compiled binary and an uncompiled ASCII file.

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!