class GLSLCompiler

The GLSLCompiler specialization of ICompiler interface. Handles everything necessary to compile and extract shader reflection data for GSLS and then exports the binary and reflection data for consumption by GLSL-specific backends.

File location: sdk/tools/ffx_shader_compiler/src/glsl_compiler.h

Construction

Return type

Description

GLSLCompiler ( const std::string& glslangExe, const std::string& shaderPath, const std::string& shaderName, const std::string& shaderFileName, const std::string& outputPath, bool disableLogs, bool debugCompile )
GLSL Compiler construction function.

Methods

Return type

Description

bool

Compile ( Permutation & permutation, const std::vector<std::string>& arguments, std::mutex& writeMutex )
Compiles a GLSL shader permutation.

bool

Extracts GLSL shader reflection data.

void

WriteBinaryHeaderReflectionData ( FILE* fp, const Permutation & permutation, std::mutex& writeMutex )
Writes GLSL reflection header data for shader permutations.

void

Writes GLSL permutation reflection header data structures for shader permutations.

void

WritePermutationHeaderReflectionData (FILE* fp, const Permutation & permutation)
Writes GLSL permutation reflection header data for shader permutations.

Detailed description

The GLSLCompiler specialization of ICompiler interface. Handles everything necessary to compile and extract shader reflection data for GSLS and then exports the binary and reflection data for consumption by GLSL-specific backends.

Construction

GLSLCompiler

Copied!

GLSLCompiler (
    const std::string& glslangExe,
    const std::string& shaderPath,
    const std::string& shaderName,
    const std::string& shaderFileName,
    const std::string& outputPath,
    bool disableLogs,
    bool debugCompile
)

GLSL Compiler construction function.

Parameters:

glslangExe

Path to the glslang exe to use to compile

shaderPath

Path to the shader to compile

shaderName

Shader entry point

shaderFileName

Filename of the shader file to compile

outputPath

Output path for shader export

disableLogs

Enables/Disables logging of errors and warnings

debugCompile

Compile shaders in debug and generate pdb information

Returns:

none


Methods

Compile

Copied!

virtual bool Compile (
    Permutation & permutation,
    const std::vector<std::string>& arguments,
    std::mutex& writeMutex
)

Compiles a GLSL shader permutation.

Parameters:

permutation

The permutation representation to compile

arguments

List of arguments to pass to the compiler

wrietMutex

Mutex to use for thread safety of compile process

Returns:

true if successful, false otherwise


ExtractReflectionData

Copied!

virtual bool ExtractReflectionData (Permutation & permutation)

Extracts GLSL shader reflection data.

Parameters:

permutation

The permutation representation to extract reflection for

Returns:

true if successful, false otherwise


WriteBinaryHeaderReflectionData

Copied!

virtual void WriteBinaryHeaderReflectionData (
    FILE* fp,
    const Permutation & permutation,
    std::mutex& writeMutex
)

Writes GLSL reflection header data for shader permutations.

Parameters:

fp

The file to write header information into

permutation

The permutation representation to write to head

wrietMutex

Mutex to use for thread safety of reflection data export

Returns:

none


WritePermutationHeaderReflectionStructMembers

Copied!

virtual void WritePermutationHeaderReflectionStructMembers (FILE* fp)

Writes GLSL permutation reflection header data structures for shader permutations.

Parameters:

fp

The file to write header data structures into

Returns:

none


WritePermutationHeaderReflectionData

Copied!

virtual void WritePermutationHeaderReflectionData (
    FILE* fp,
    const Permutation & permutation
)

Writes GLSL permutation reflection header data for shader permutations.

Parameters:

fp

The file to write header information into

permutation

The permutation representation to write to head

Returns:

none