HLSL Command-Line Compiler
Microsoft DirectX 9.0 SDK Update (October 2004)

HLSL Command-Line Compiler


High-level shader language (HLSL) shaders can be compiled from the command line using the following executable:

(SDK root)\Utilities\fxc.exe

Syntax

The usage is:

fxc options filename

Where:

Remarks

Using the HLSLwithoutEffects Sample, here's an example of compiling the HLSL shader in the file HLSLwithoutEffects.vsh for a vs_2_0 target profile:

// For a release build
fxc /T vs_2_0 /Fo HLSLwithoutEffects.fxo HLSLwithoutEffects.vsh

// For a debug build
fxc /Od /Zi /T vs_2_0 /Fo HLSLwithoutEffects.fxo HLSLwithoutEffects.vsh

The debug options include additional options to disable compiler optimizations and enable debug information like line numbers, symbols, and so on. The binary representation of the shader is written to a file called HLSLwithoutEffects.fxo which is an arbitrary abbreviation for the fxc output file.

The command line compiler can also be used to compile a shader within an effect. This can be seen in the CompiledEffect Sample.



© 2004 Microsoft Corporation. All rights reserved.
Feedback? Please provide us with your comments on this topic.
For more help, visit the DirectX Developer Center.