Class Shader::Compiler
Defined in File shader-compiler.h
Nested Relationships
This class is a nested type of Class Shader.
Class Documentation
-
class Compiler
Provides an API agnostic interface for Shader compilation.
Public Functions
-
Compiler() = default
Creates an instance of Shader::Compiler.
-
virtual ~Compiler() = 0
Destroys this Shader::Compiler.
-
void GetMessages(size_t *pMessageCount, char const **pMessages) const
Gets messages from the most recent Shader
compilation.
NOTE : The messages returned from this method are invalidated whenever any method besides
GetMessages() is called.- Parameters
pMessageCount -- [out] The number of messages generated during the most recent Shader compilation
pMessages -- [out] A pointer to a preallocated array of char const pointers to populate with messages NOTE : Call this method with nullptr for pMessageCount to populate only the pSizeBytes argument NOTE : Messages will be provided as null terminated C strings NOTE : Providing an array that isn't large enough results in undefined behavior
-
virtual bool Compile(Shader::CompileInfo &compileInfo, Shader *pShader) const = 0
Compiles a Shader from a given Shader::CompileInfo.
- Parameters
compileInfo -- The Shader::CompileInfo to use for copmilation
pShader -- A pointer to an empty Shader object to store compilation results
- Returns
Whether or not compilation was successful
Protected Functions
-
void CreateShader(Shader::Stage stage, const api_types::ShaderSource &source, const std::vector<uint8_t> &byteCode, Shader *pShader) const
Creates a Shader
.
NOTE : Any necessary validation should be performed by API specific compiler objects before calling this method.
- Parameters
stage -- The Shader::Stage of the Shader to create
language -- The Shader::Language of the Shader to create
entryPoint -- The entry point of the Shader to create
byteCodeSize -- The size in bytes of the byte code of the Shader to create
pByteCode -- A pointer to the byte code of the Shader to create
pShader -- A pointer to an empty Shader object to store creation results
Protected Attributes
-
mutable std::vector<std::string> mMessages
-
Compiler() = default