How to compile an hlsl code with fxc.exe

Started by
3 comments, last by lucky6969b 11 years, 8 months ago
How do I compile a .fx file without the "main" function/procedure?
Thanks
Jack
Advertisement
How do I compile a .fx file without the "main" function/procedure?
Can you explain your problem a bit more? Every shader needs an "entry point" / "main function" (though with the Effects Framework, this is written in your [font=courier new,courier,monospace]technique[/font] block).

Are you compiling your shader for use with the Effects Framework, or as raw pixel/vertex shaders for use with the raw D3D APIs directly?
Also, what version of D3D are you targetting?
Okay, I am using D3D9, when I compile my shader without the main function, like fxc shader.fx, it replies with 'main' entry point not defined or something like that.
The main purpose of this move is to test the validity [spell wrong?], of the shader before applying to the main C++ program.
Thanks
Jack
You always need to specify a target profile with "[font=courier new,courier,monospace]/T[/font]" before your input file. For D3D9 FX files, you'll want "[font=courier new,courier,monospace]/T fx_2_0[/font]"
Okay, it got it going on now

This topic is closed to new replies.

Advertisement