Skip to content

Shader Compiler

Navigation: SDK

Shader Compiler

Documentation for the FidelityFX Shader Compiler tool.

Functions

IShaderBinary

inline IShaderBinary()

ShadeBinary constructor.

Returns: none

Attributes: inline

Source: sdk/tools/ffx_shader_compiler/src/compiler.h (line 45, column 5)

~IShaderBinary

inline virtual ~IShaderBinary()

ShaderBinary destructor.

Returns: none

Attributes: inline, virtual

Source: sdk/tools/ffx_shader_compiler/src/compiler.h (line 55, column 13)

BufferPointer

pure-virtual uint8_t * BufferPointer()=0

Shader binary buffer accessor. Must be overridden for each language supported (i.e. HLSL, GLSL, etc.)

Returns: Pointer to the internal buffer representation.

Returns: uint8_t *

Attributes: pure-virtual

Source: sdk/tools/ffx_shader_compiler/src/compiler.h (line 66, column 21)

BufferSize

pure-virtual size_t BufferSize()=0

Queries the shader binary size. Must be overridden for each language supported (i.e. HLSL, GLSL, etc.)

Returns: Size of the shader binary

Returns: size_t

Attributes: pure-virtual

Source: sdk/tools/ffx_shader_compiler/src/compiler.h (line 75, column 22)

ICompiler

inline ICompiler(const std::string &shaderPath, const std::string &shaderName, const std::string &shaderFileName, const std::string &outputPath, bool disableLogs, bool debugCompile)

Compiler construction function.

Returns: none

Parameters:

  • shaderPath (const std::string &) – [in] Path to the shader to compile
  • shaderName (const std::string &) – [in] Shader entry point
  • shaderFileName (const std::string &) – [in] Filename of the shader file to compile
  • outputPath (const std::string &) – [in] Output path for shader export
  • disableLogs (bool) – [in] Enables/Disables logging of errors and warnings
  • debugCompile (bool) – [in] Compile shaders in debug and generate pdb information

Attributes: inline

Source: sdk/tools/ffx_shader_compiler/src/compiler.h (line 160, column 5)

~ICompiler

inline virtual ~ICompiler()

Compiler destruction function.

Returns: none

Attributes: inline, virtual

Source: sdk/tools/ffx_shader_compiler/src/compiler.h (line 176, column 13)

Compile

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

Compiles a shader permutation. Must be overridden for each language supported (i.e. HLSL, GLSL, etc.)

Returns: true if successful, false otherwise

Parameters:

  • permutation (Permutation &) – [in] The permutation representation to compile
  • arguments (const std::vector<std::string> &) – [in] List of arguments to pass to the compiler
  • writeMutex (std::mutex &)

Returns: bool

Attributes: pure-virtual

Source: sdk/tools/ffx_shader_compiler/src/compiler.h (line 191, column 18)

ExtractReflectionData

pure-virtual bool ExtractReflectionData(Permutation &permutation)=0

Extracts shader reflection data. Must be overridden for each language supported (i.e. HLSL, GLSL, etc.)

Returns: true if successful, false otherwise

Parameters:

  • permutation (Permutation &) – [in] The permutation representation to extract reflection for

Returns: bool

Attributes: pure-virtual

Source: sdk/tools/ffx_shader_compiler/src/compiler.h (line 204, column 18)

WriteBinaryHeaderReflectionData

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

Writes reflection header data for shader permutations. Must be overridden for each language supported (i.e. HLSL, GLSL, etc.)

Returns: none

Parameters:

  • fp (FILE *) – [in] The file to write header information into
  • permutation (const Permutation &) – [in] The permutation representation to write to head
  • writeMutex (std::mutex &)

Attributes: pure-virtual

Source: sdk/tools/ffx_shader_compiler/src/compiler.h (line 217, column 18)

WritePermutationHeaderReflectionStructMembers

pure-virtual void WritePermutationHeaderReflectionStructMembers(FILE *fp)=0

Writes permutation reflection header data structures for shader permutations. Must be overridden for each language supported (i.e. HLSL, GLSL, etc.)

Returns: none

Parameters:

  • fp (FILE *) – [in] The file to write header data structures into

Attributes: pure-virtual

Source: sdk/tools/ffx_shader_compiler/src/compiler.h (line 228, column 18)

WritePermutationHeaderReflectionData

pure-virtual void WritePermutationHeaderReflectionData(FILE *fp, const Permutation &permutation)=0

Writes permutation reflection header data for shader permutations. Must be overridden for each language supported (i.e. HLSL, GLSL, etc.)

Returns: none

Parameters:

  • fp (FILE *) – [in] The file to write header information into
  • permutation (const Permutation &) – [in] The permutation representation to write to head

Attributes: pure-virtual

Source: sdk/tools/ffx_shader_compiler/src/compiler.h (line 240, column 18)

BufferPointer

virtual uint8_t * BufferPointer() override

GLSL Shader binary buffer accessor.

Returns: Pointer to the internal GLSL buffer representation.

Returns: uint8_t *

Attributes: virtual

Source: sdk/tools/ffx_shader_compiler/src/glsl_compiler.h (line 42, column 13)

BufferSize

virtual size_t BufferSize() override

Queries the GLSL shader binary size.

Returns: Size of the GLSL shader binary

Returns: size_t

Attributes: virtual

Source: sdk/tools/ffx_shader_compiler/src/glsl_compiler.h (line 50, column 14)

GLSLCompiler

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.

Returns: none

Parameters:

  • glslangExe (const std::string &) – [in] Path to the glslang exe to use to compile
  • shaderPath (const std::string &) – [in] Path to the shader to compile
  • shaderName (const std::string &) – [in] Shader entry point
  • shaderFileName (const std::string &) – [in] Filename of the shader file to compile
  • outputPath (const std::string &) – [in] Output path for shader export
  • disableLogs (bool) – [in] Enables/Disables logging of errors and warnings
  • debugCompile (bool) – [in] Compile shaders in debug and generate pdb information

Source: sdk/tools/ffx_shader_compiler/src/glsl_compiler.h (line 78, column 5)

~GLSLCompiler

~GLSLCompiler()

GLSL Compiler destruction function.

Returns: none

Source: sdk/tools/ffx_shader_compiler/src/glsl_compiler.h (line 92, column 5)

Compile

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

Compiles a GLSL shader permutation.

Returns: true if successful, false otherwise

Parameters:

  • permutation (Permutation &) – [in] The permutation representation to compile
  • arguments (const std::vector<std::string> &) – [in] List of arguments to pass to the compiler
  • writeMutex (std::mutex &)

Returns: bool

Attributes: virtual

Source: sdk/tools/ffx_shader_compiler/src/glsl_compiler.h (line 104, column 10)

ExtractReflectionData

virtual bool ExtractReflectionData(Permutation &permutation) override

Extracts GLSL shader reflection data.

Returns: true if successful, false otherwise

Parameters:

  • permutation (Permutation &) – [in] The permutation representation to extract reflection for

Returns: bool

Attributes: virtual

Source: sdk/tools/ffx_shader_compiler/src/glsl_compiler.h (line 114, column 10)

WriteBinaryHeaderReflectionData

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

Writes GLSL reflection header data for shader permutations.

Returns: none

Parameters:

  • fp (FILE *) – [in] The file to write header information into
  • permutation (const Permutation &) – [in] The permutation representation to write to head
  • writeMutex (std::mutex &)

Attributes: virtual

Source: sdk/tools/ffx_shader_compiler/src/glsl_compiler.h (line 126, column 10)

WritePermutationHeaderReflectionStructMembers

virtual void WritePermutationHeaderReflectionStructMembers(FILE *fp) override

Writes GLSL permutation reflection header data structures for shader permutations.

Returns: none

Parameters:

  • fp (FILE *) – [in] The file to write header data structures into

Attributes: virtual

Source: sdk/tools/ffx_shader_compiler/src/glsl_compiler.h (line 136, column 10)

WritePermutationHeaderReflectionData

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

Writes GLSL permutation reflection header data for shader permutations.

Returns: none

Parameters:

  • fp (FILE *) – [in] The file to write header information into
  • permutation (const Permutation &) – [in] The permutation representation to write to head

Attributes: virtual

Source: sdk/tools/ffx_shader_compiler/src/glsl_compiler.h (line 147, column 10)

BufferPointer

virtual uint8_t * BufferPointer() override

HLSL (DXC) Shader binary buffer accessor.

Returns: Pointer to the internal HLSL (DXC) buffer representation.

Returns: uint8_t *

Attributes: virtual

Source: sdk/tools/ffx_shader_compiler/src/hlsl_compiler.h (line 56, column 13)

BufferSize

virtual size_t BufferSize() override

Queries the HLSL (DXC) shader binary size.

Returns: Size of the HLSL (DXC) shader binary

Returns: size_t

Attributes: virtual

Source: sdk/tools/ffx_shader_compiler/src/hlsl_compiler.h (line 64, column 14)

BufferPointer

virtual uint8_t * BufferPointer() override

HLSL (FXC) Shader binary buffer accessor.

Returns: Pointer to the internal HLSL (FXC) buffer representation.

Returns: uint8_t *

Attributes: virtual

Source: sdk/tools/ffx_shader_compiler/src/hlsl_compiler.h (line 81, column 13)

BufferSize

virtual size_t BufferSize() override

Queries the HLSL (FXC) shader binary size.

Returns: Size of the HLSL (FXC) shader binary

Returns: size_t

Attributes: virtual

Source: sdk/tools/ffx_shader_compiler/src/hlsl_compiler.h (line 89, column 14)

HLSLCompiler

HLSLCompiler(Backend backend, const std::string &dll, const std::string &shaderPath, const std::string &shaderName, const std::string &shaderFileName, const std::string &outputPath, bool disableLogs, bool debugCompile)

HLSL Compiler construction function.

Returns: none

Parameters:

  • backend (Backend) – [in] The backend HLSL compile process to use
  • dll (const std::string &) – [in] DXC/FXC DLL override to use when compiling
  • shaderPath (const std::string &) – [in] Path to the shader to compile
  • shaderName (const std::string &) – [in] Shader entry point
  • shaderFileName (const std::string &) – [in] Filename of the shader file to compile
  • outputPath (const std::string &) – [in] Output path for shader export
  • disableLogs (bool) – [in] Enables/Disables logging of errors and warnings
  • debugCompile (bool) – [in] Compile shaders in debug and generate pdb information

Source: sdk/tools/ffx_shader_compiler/src/hlsl_compiler.h (line 129, column 5)

~HLSLCompiler

~HLSLCompiler()

HLSL Compiler destruction function.

Returns: none

Source: sdk/tools/ffx_shader_compiler/src/hlsl_compiler.h (line 144, column 5)

Compile

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

Compiles a HLSL shader permutation.

Returns: true if successful, false otherwise

Parameters:

  • permutation (Permutation &) – [in] The permutation representation to compile
  • arguments (const std::vector<std::string> &) – [in] List of arguments to pass to the compiler
  • writeMutex (std::mutex &)

Returns: bool

Attributes: virtual

Source: sdk/tools/ffx_shader_compiler/src/hlsl_compiler.h (line 156, column 10)

ExtractReflectionData

virtual bool ExtractReflectionData(Permutation &permutation) override

Extracts HLSL shader reflection data.

Returns: true if successful, false otherwise

Parameters:

  • permutation (Permutation &) – [in] The permutation representation to extract reflection for

Returns: bool

Attributes: virtual

Source: sdk/tools/ffx_shader_compiler/src/hlsl_compiler.h (line 168, column 10)

WriteBinaryHeaderReflectionData

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

Writes HLSL reflection header data for shader permutations.

Returns: none

Parameters:

  • fp (FILE *) – [in] The file to write header information into
  • permutation (const Permutation &) – [in] The permutation representation to write to head
  • writeMutex (std::mutex &)

Attributes: virtual

Source: sdk/tools/ffx_shader_compiler/src/hlsl_compiler.h (line 180, column 10)

WritePermutationHeaderReflectionStructMembers

virtual void WritePermutationHeaderReflectionStructMembers(FILE *fp) override

Writes HLSL permutation reflection header data structures for shader permutations.

Returns: none

Parameters:

  • fp (FILE *) – [in] The file to write header data structures into

Attributes: virtual

Source: sdk/tools/ffx_shader_compiler/src/hlsl_compiler.h (line 190, column 10)

WritePermutationHeaderReflectionData

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

Writes HLSL permutation reflection header data for shader permutations.

Returns: none

Parameters:

  • fp (FILE *) – [in] The file to write header information into
  • permutation (const Permutation &) – [in] The permutation representation to write to head

Attributes: virtual

Source: sdk/tools/ffx_shader_compiler/src/hlsl_compiler.h (line 201, column 10)

Enumerations

Backend

enum Backend

Enumeration of possible HLSL backends to compile with.

Values:

DXC

Use included DXC compiler processes.

GDK_SCARLETT_X64

Use GDK-provided shader compiler dll (requires the GDK be installed)

GDK_XBOXONE_X64

Use GDK-provided shader compiler dll (requires the GDK be installed)

FXC

Use included FXC compiler processes.

Source: sdk/tools/ffx_shader_compiler/src/hlsl_compiler.h (line 105, column 5)

Dependencies: Permutation