Navigation
API > API/Developer > API/Developer/ShaderCompilerCommon
Wrapper class to handle interface between UE and ShaderConductor. Use to compile HLSL shaders to SPIR-V or high-level languages such as Metal.
| Name | FShaderConductorContext |
| Type | class |
| Header File | /Engine/Source/Developer/ShaderCompilerCommon/Public/ShaderConductorContext.h |
| Include Path | #include "ShaderConductorContext.h" |
Syntax
class FShaderConductorContext
Constructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FShaderConductorContext
(
const FShaderConductorContext& |
ShaderConductorContext.h | ||
| Move constructor to take ownership of internal buffers from 'Rhs'. | ShaderConductorContext.h | ||
| Initializes the context with internal buffers used for the conversion of input and option descriptors between UE and ShaderConductor. | ShaderConductorContext.h |
Destructors
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
~FShaderConductorContext() |
Release the internal buffers. | ShaderConductorContext.h |
Variables
Protected
| Name | Type | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|---|
| Errors | TArray< FShaderCompilerError > | ShaderConductorContext.h | ||
| Intermediates | FShaderConductorIntermediates * | ShaderConductorContext.h |
Functions
Public
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
bool CompileHlslToDxil
(
const FShaderConductorOptions& Options, |
Compiles the specified HLSL shader source code to DXIL. | ShaderConductorContext.h | |
bool CompileHlslToSpirv
(
const FShaderConductorOptions& Options, |
Compiles the specified HLSL shader source code to SPIR-V. | ShaderConductorContext.h | |
bool CompileSpirvToSource
(
const FShaderConductorOptions& Options, |
Compiles the specified SPIR-V shader binary code to high level source code (Metal or GLSL). | ShaderConductorContext.h | |
bool CompileSpirvToSourceAnsi
(
const FShaderConductorOptions& Options, |
Compiles the specified SPIR-V shader binary code to high level source code (Metal or GLSL) stored as null terminated ANSI string. | ShaderConductorContext.h | |
bool CompileSpirvToSourceBuffer
(
const FShaderConductorOptions& Options, |
Compiles the specified SPIR-V shader binary code to high level source code (Metal or GLSL) stored as byte buffer (without null terminator as it comes from ShaderConductor). | ShaderConductorContext.h | |
void FlushErrors
(
TArray< FShaderCompilerError >& OutErrors |
Flushes the list of current compile errors and moves the ownership to the caller. | ShaderConductorContext.h | |
FString GenerateDxcArguments
(
const FShaderConductorOptions& Options |
Returns the DXC command line arguments for the specified options. | ShaderConductorContext.h | |
const TArray< FShaderCompilerError > & GetErrors() |
Returns the list of current compile errors. | ShaderConductorContext.h | |
int32 GetSourceLength () |
Returns a length of the internal loaded sources (excluding the null terminator). | ShaderConductorContext.h | |
const ANSICHAR * GetSourceString () |
Returns a pointer to a null terminated ANSI string of the internal loaded sources, or null if no source has been loaded yet. | ShaderConductorContext.h | |
PRAGMA_DISABLE_DEPRECATION_WARNINGS bool LoadSource
(
const FString& ShaderSource, |
Loads the shader source and converts the input descriptor to a format suitable for ShaderConductor. | ShaderConductorContext.h | |
bool LoadSource
(
FStringView ShaderSource, |
ShaderConductorContext.h | ||
bool LoadSource
(
FAnsiStringView ShaderSource, |
ShaderConductorContext.h | ||
bool LoadSource
(
const ANSICHAR* ShaderSource, |
ShaderConductorContext.h | ||
bool OptimizeSpirv
(
TArray< uint32 >& Spirv, |
Performs the specified optimization passes (e.g. "-O" or "--strip-reflect") on the SPIR-V module. | ShaderConductorContext.h | |
void RemoveLineDirectives () |
Replaces #line 123 directives with //ine 123. | ShaderConductorContext.h | |
PRAGMA_ENABLE_DEPRECATION_WARNINGS bool RewriteHlsl
(
const FShaderConductorOptions& Options, |
Rewrites the specified HLSL shader source code. | ShaderConductorContext.h |
Static
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
static void ConvertCompileErrors
(
TArray< FString >&& ErrorStringLines, |
Convert array of error string lines into array of |
ShaderConductorContext.h | |
static bool Disassemble
(
EShaderConductorIR Language, |
Helper function to disassemble the specified SPIR-V or DXIL module and add it to the output code reflection array. | ShaderConductorContext.h | |
static bool Disassemble
(
EShaderConductorIR Language, |
Disassembles the specified SPIR-V or DXIL module and returns its assembly as text representation. | ShaderConductorContext.h | |
static const FShaderConductorIdentifierTable & GetIdentifierTable() |
Returns the table of special identifiers generated by ShaderConductor. | ShaderConductorContext.h | |
static const TCHAR * GetShaderFileExt
(
EShaderConductorLanguage Language, |
Returns a filename extension for the specified shading language and shader stage, e.g. "frag" for a GLSL pixel shader. | ShaderConductorContext.h | |
static bool IsIntermediateSpirvOutputVariable
(
const ANSICHAR* SpirvVariableName |
Returns whether the specified variable name denotes an intermediate output variable. | ShaderConductorContext.h | |
static void Shutdown () |
Explicitly shut down ShaderConductor and DXC shared libraries. | ShaderConductorContext.h |
Operators
| Name | Remarks | Include Path | Unreal Specifiers |
|---|---|---|---|
FShaderConductorContext & operator=
(
FShaderConductorContext&& Rhs |
Move operator to take ownership of internal buffers from 'Rhs'. | ShaderConductorContext.h | |
FShaderConductorContext & operator=
(
const FShaderConductorContext& |
ShaderConductorContext.h |