Shader authoring/Compiling Shaders
To compile .FXC files, list them in a text file (one per line), then run src\materialsystem\stdshaders\buildshaders.bat
on the text file. It will go process your .FXC code and compile all the combinations into your mod's directory. The syntax of the buildshaders.bat
command line is:
buildshaders.bat [text filename] -game [mod directory] -source [source directory]
Example:
buildshaders.bat MyShaders -game "C:\Steam\SteamApps\SourceMods\MyMod" -source "C:\MyMod\Src"

buildshaders.bat
.
Before building your shader DLL, you need to run buildshaders.bat
, so it can generate include files that your shader DLL will need.Refer to stdshaders_dx8.txt
and stdshaders_dx9.txt
as examples of how to set up your shaders text file. All the source code for the shader DLL should be in the same directory as the .FXC, .VSH, and .PSH files. After buildshaders.bat
runs, you can look in the fxctmp9
sub-directory to see the include files generated by the shader compiler.

*_ps20.fxc
for pixel shaders conforming to the 2.0 spec, *_vs11.fxc
for vertex shaders conforming to the 1.1 spec.)
taskkill /IM shadercompile /F
. This will terminate all instances of shadercompile.exe. The next step is deleting the following folder: %localappdata%/temp/shadercompiletemp
. Finally, run the Windows Defragment and Optimize Drives utility and allow it to Defragment the hard drive where your User Directory and Source Code can be found. If you are using a Solid State Drive, use CHKDSK.