Search code examples
c++shaderdirectx-11precompiling

Creating .fxo shader file using fxc.exe


Does anybody know how to compile a single file containing various shaders (PixelShader, VertexShader, GeometryShader) using the fxc.exe tool provided by the DirectX 11 SDK?

The shader is used to create a tesselation-effect in a C++ programmed Enviroment:

The result should be a .fxo shader File.

Thx in advance :)


Solution

  • You run the compiler separately for each effect source file (one source file per effect, including the various shaders and helper routines). There will be a separate shader object file for each effect, similarly. The command line depends on what you actually want to compile but something like this:

    fxc.exe /T ps_2_0 /nologo /E main /Fo"Effect.fxo" "Effect.fx"
    

    or

    fxc.exe /T fx_4_0 /nologo /Fo"Effect.fxo" "Effect.fx"