FShaderConductorContext

Wrapper class to handle interface between UE and ShaderConductor.

Windows
MacOS
Linux

References

Module

ShaderCompilerCommon

Header

/Engine/Source/Developer/ShaderCompilerCommon/Public/ShaderCompilerCommon.h

Include

#include "ShaderCompilerCommon.h"

Syntax

class FShaderConductorContext

Remarks

Wrapper class to handle interface between UE and ShaderConductor. Use to compile HLSL shaders to SPIR-V or high-level languages such as Metal.

Constructors

Name Description

Public function

FShaderConductorContext()

Initializes the context with internal buffers used for the conversion of input and option descriptors between UE and ShaderConductor.

Public function

FShaderConductorContext

(
    FShaderConductorContext&& Rhs
)

Move constructor to take ownership of internal buffers from 'Rhs'.

Public function

FShaderConductorContext

(
    const FShaderConductorContext&
)

Destructors

Name Description

Public function

~FShaderConductorContext()

Release the internal buffers.

Functions

Name Description

Public function

bool

 

CompileHlslToSpirv

(
    const FShaderConductorOptions& Opt...,
    TArray< uint32 >& OutSpirv
)

Compiles the specified HLSL shader source code to SPIR-V.

Public function

bool

 

CompileSpirvToSource

(
    const FShaderConductorOptions& Opt...,
    const FShaderConductorTarget& Targ...,
    const void* InSpirv,
    uint32 InSpirvByteSize,
    FString& OutSource
)

Compiles the specified SPIR-V shader binary code to high level source code (Metal or GLSL).

Public function

bool

 

CompileSpirvToSourceAnsi

(
    const FShaderConductorOptions& Opt...,
    const FShaderConductorTarget& Targ...,
    const void* InSpirv,
    uint32 InSpirvByteSize,
    TArray< ANSICHAR >& OutSource
)

Compiles the specified SPIR-V shader binary code to high level source code (Metal or GLSL) stored as null terminated ANSI string.

Public function

bool

 

CompileSpirvToSourceBuffer

(
    const FShaderConductorOptions& Opt...,
    const FShaderConductorTarget& Targ...,
    const void* InSpirv,
    uint32 InSpirvByteSize,
    const TFunction< void&#...
)

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).

Public function Static

void

 

ConvertCompileErrors

(
    TArray< FString >&& ErrorStringLin...,
    TArray< FShaderCompilerError >& Ou...
)

Convert array of error string lines into array of .

Public function

void

 

FlushErrors

(
    TArray< FShaderCompilerError >& Ou...
)

Flushes the list of current compile errors and moves the ownership to the caller.

Public function Const

const TArray...

 

GetErrors()

Returns the list of current compile errors.

Public function Const

int32

 

GetSourceLength()

Returns a length of the internal loaded sources (excluding the null terminator).

Public function Const

const ANSICH...

 

GetSourceString()

Returns a pointer to a null terminated ANSI string of the internal loaded sources, or null if no source has been loaded yet.

Public function Static

bool

 

IsIntermediateSpirvOutputVariable

(
    const ANSICHAR* SpirvVariableN...
)

Returns whether the specified variable name denotes an intermediate output variable.

Public function

bool

 

LoadSource

(
    const FString& ShaderSource,
    const FString& Filename,
    const FString& EntryPoint,
    EHlslShaderFrequency ShaderStage,
    const FShaderCompilerDefinitions&#...
)

Loads the shader source and converts the input descriptor to a format suitable for ShaderConductor.

Public function

bool

 

LoadSource

(
    const ANSICHAR* ShaderSource,
    const ANSICHAR* Filename,
    const ANSICHAR* EntryPoint,
    EHlslShaderFrequency ShaderStage,
    const FShaderCompilerDefinitions&#...
)

Loads the shader source and converts the input descriptor to a format suitable for ShaderConductor.

Public function

bool

 

RewriteHlsl

(
    const FShaderConductorOptions& Opt...,
    FString* OutSource
)

Rewrites the specified HLSL shader source code.

Operators

Name Description

Public function

FShaderCondu...

 

operator=

(
    FShaderConductorContext&& Rhs
)

Move operator to take ownership of internal buffers from 'Rhs'.

Public function

FShaderCondu...

 

operator=

(
    const FShaderConductorContext&
)

Help shape the future of Unreal Engine documentation! Tell us how we're doing so we can serve you better.
Take our survey
Dismiss