1

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 :)

luQ
  • 519
  • 1
  • 10
  • 25
  • Could you not just run it multiple time for each type of shader? – Caesar Apr 25 '14 at 13:50
  • Mhh maybe, i did not thought of that... But the question is how many Times do i have to rerun it ... :/ – luQ Apr 27 '14 at 07:00
  • 1
    I normally like to put each shader in its own file, makes it easier to find when you need to find it. But you only need to run it 3 times for each shader (PS, VS, GS) – Caesar Apr 27 '14 at 07:45
  • Hey thx alot! Just to clarify things up, could pls be so kind and give me the excact parameters/command line u r using? – luQ Apr 27 '14 at 08:38
  • I now use the built in builder for VS2013, but here is an old one I found `"D:\Library\Microsoft DirectX SDK (June 2010)\Utilities\bin\x86\fxc" /Fc /Od /Zi /T fx_5_0 /Fo "%(RelativeDir)\%(Filename).fxo" "%(FullPath)"` – Caesar Apr 27 '14 at 09:10

1 Answers1

1

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"
Gábor
  • 9,466
  • 3
  • 65
  • 79