Shader authoring/Compile Pipeline
The pipeline to actually go from .cpp and .fxc files to a working and compiling shader is quite complex and has a history of causing problems. This document will aim to describe all of the steps of the Valve shader compiling pipeline to assist user understanding, aid trouble shooting efforts, and serve as a quick reference guide.
The stages of the pipeline are listed in order, and each entry will describe the command line format and the purpose of the script. Command line arguments place [] around paths/user variable inputs and the placeholder names will include any file type extensions if they should be included.
buildsdkshaders.bat
Command Line
buildsdkshaders.bat [shaderproj] -game [moddir] -source [srcdir]
shaderproj : The name of a text file (with no extension) containing the names of the shader files to be compiled, one per line.
moddir : The mod directory located in <steamdir>/steamapps/sourcemods/
srcdir : The directory containing the source, Ex: C:\MyMod\src
Functions
1. Checks for and creates the folders shaders\fxc, shaders\vsh, and shaders\psh.
2. Deletes the old filelist.txt and filestocopy.txt files.
3. Calls devtools/bin/updateshaders.pl to generate a makefile titled makefile.shaderproj
where shaderproj is the same as the command line argument.
4. Runs the makefile with nmake.exe.
5.1 Removes duplicates and alphabetizes entries in filestocopy.txt through some neat command piping and uniq.pl. The sorted/unique version is stored in uniquefilestocopy.txt.
5.2 Repeats the above with filelist.txt, storing the result in uniquefilelist.txt.
5.3 Moves uniquefilelist.txt to filelist.txt.
6. Calls runvmpi.pl with the arguments -nompi -game [moddir]
.
7. Copies the files generated by runvmpi.pl from stdshaders/shaders to moddir/shaders.
updateshaders.pl
Command Line
updateshaders.pl [shaderproj]
shaderproj : Same as above.