Precompiling .fx files?

Started by
1 comment, last by MJP 13 years, 9 months ago
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
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.
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.

This topic is closed to new replies.

Advertisement