Shader Foundry is a modest tool that manages our shader pipeline.
Its core purpose is to provide a comfortable GUI for Microsoft’s shader compiler (FXC). It should be noted that since our shader pipeline is very simple, only a small subset of the FXC options are supported in the tool settings.
Sauce does not make use of the Effects framework; instead, we use individual shader source files for each of the six supported shader types:
- Compute Shaders
- Domain Shaders
- Geometry Shaders
- Hull Shaders
- Pixel Shaders
- Vertex Shaders
Shader Foundry originally started out as a simple, yet sufficient tool to scan our Art/ directory and compile the shaders. It was later incorporated into a unified tool framework called Pipeline. However, when I began laying the groundwork for Graphics 2.0 in Spring 2016, I decided to reverse course and extract the shader components from the unified framework back out and into their own separate tool, which subsequently became known as Shader Foundry.
Before any work can be accomplished, Shader Foundry requires the root directory to be set. Once the root directory has been set and validated, the tool populates the tree view with the directory structure under the Art/ directory. Then the user can navigate to their directory of source shader files.
Once a directory is selected, the tool tallies the shader source files into the Workspace grid, which displays the shader file name, shader type, and the status of exported asset. The set of toggle buttons along the tool bar above the grid allow the user to filter the grid contents by shader type.
In the background, the tool monitors the shader source files and their included dependencies. If a shader source file or an included dependency file is modified, or a corresponding asset (output) file is removed, the entry is marked as “out of date” with a yellow warning symbol.
The Export button simply invokes fxc.exe on all of the checked entries in the Workspace grid and captures their individual outputs. If compilation fails, the grid entry is instantly flagged with an error symbol; otherwise a green check mark is displayed to indicate success.
At any time, users can select a grid entry and inspect the compilation results (export time, exit code, and output) in the Asset Details panel directly below the grid.
Users have the option to configure the location of the shader compiler: fxc.exe. They can either manually enter or browse for the executable path; otherwise, they can use the default, which searches a predefined set of possible locations, including the DirectX SDK and the Windows Kits/ directory.
Furthermore, there are a few options are provided for each of the shader types, including input and output file extensions, entry point, and defines.
More in-depth information can be found in the following article: Shader Foundry.