NDEVR
API Documentation
ShaderTools

Utility class for compiling GLSL shader source files into SPIR-V binaries using the Vulkan SDK glslangValidator tool. More...

Collaboration diagram for ShaderTools:
[legend]

Public Member Functions

 ShaderTools ()
 Constructs ShaderTools and expands environment variables in the executable path.
void compileDefault ()
 Compiles all default shaders from the VulkanInterface resources directory.
void compileIndividualShader (File compile_file, File output_location)
 Compiles a single shader file to SPIR-V.
void compileShader (File reference)
 Compiles a single shader file to SPIR-V with the same base name.
void compileShader (File reference, const StringView &out_name, const StringView &value, bool is_simple)
 Compiles a shader variant by enabling a preprocessor define and writing a temporary file.
void compileShaders (File reference)
 Compiles all standard shader variants (points, linework, solid, etc.) from a reference file.

Public Attributes

File exe_location = File("$(VULKAN_DIR)/Bin/glslangValidator.exe")
 Path to the glslangValidator executable.
LogPtr log = nullptr
 Log for compilation status messages.

Detailed Description

Utility class for compiling GLSL shader source files into SPIR-V binaries using the Vulkan SDK glslangValidator tool.

Definition at line 14 of file ShaderTools.h.

Member Function Documentation

◆ compileIndividualShader()

void ShaderTools::compileIndividualShader ( File compile_file,
File output_location )
inline

Compiles a single shader file to SPIR-V.

Parameters
[in]compile_fileThe shader source file to compile.
[in]output_locationThe destination for the compiled SPIR-V binary.

Definition at line 27 of file ShaderTools.h.

References LocalApplicationLauncher::CallApplication(), exe_location, and log.

Referenced by compileShader(), and compileShader().

◆ compileShader() [1/2]

void ShaderTools::compileShader ( File reference)
inline

Compiles a single shader file to SPIR-V with the same base name.

Parameters
[in]referenceThe shader source file to compile.

Definition at line 70 of file ShaderTools.h.

References compileIndividualShader(), File::e_file_extension, and File::setPath().

◆ compileShader() [2/2]

void ShaderTools::compileShader ( File reference,
const StringView & out_name,
const StringView & value,
bool is_simple )
inline

Compiles a shader variant by enabling a preprocessor define and writing a temporary file.

Parameters
[in]referenceThe reference shader source file.
[in]out_nameThe output file name (without extension).
[in]valueThe preprocessor define to enable.
[in]is_simpleWhether this is a simple shader variant.

Definition at line 38 of file ShaderTools.h.

References File::appendPath(), String::beginsWith(), File::close(), compileIndividualShader(), Scanner::currentLine(), File::e_ascii_write, File::e_file_extension, File::expandEnvironmentalVars(), File::getParentDirectory(), File::getPath(), BufferedScanner::nextLine(), and File::open().

Referenced by compileDefault(), and compileShaders().

◆ compileShaders()

void ShaderTools::compileShaders ( File reference)
inline

Compiles all standard shader variants (points, linework, solid, etc.) from a reference file.

Parameters
[in]referenceThe reference shader source file.

Definition at line 78 of file ShaderTools.h.

References compileShader().

Referenced by compileDefault().


The documentation for this class was generated from the following file: