To compile the. FX file in d3d, you can directly use fxc.exe in d3d tools, or call the FX compiler to compile the file after loading the. FX file. However, this is inconvenient. Inspired by the Cuda file compilation settings, you can also set up custom buildfor. FX and directly call fxc.exe for compilation.
First, right-click the. FX file and choose Properties to set the properties. select Custom Build tool as the tool.
Then custom build step-> General-> command line, enter the following statement (copy directly ):
"$ (Dxsdk_dir) Utilities \ bin \ x86 \ fxc.exe"/GEC/T fx_2_0/Fc $ (inputdir) \ formats (inputname.txt/fo $ (inputdir) \ $ (inputname ). fxo % (filename ). FX $ (inputpath)
Enter the following in outputs (otherwise, the compile menu cannot be activated ):
$ (Inputname). fxo
The first half specifies the position of the fxc.exe compiler in d3d sdk. the parameters in the middle are related to fxc. You can change the parameters as needed, the following figure shows the corresponding output and the method for searching the source file. The path method can refer to the relevant description of msdn: http://msdn.microsoft.com/en-us/library/c02as0cs (V = vs.80). aspx
In this way, you can directly compile. FX and check for errors. You can double-click the output window to locate the corresponding error line:
You can also add other things you want in custom build, such as counting the number of various ASM commands for Shader performance analysis:
Note:The vs project above is the sample in the d3d SDK: irradiancevolume_2005