Plasma Engine  2.0
Loading...
Searching...
No Matches
plShaderProgramCompiler Class Referenceabstract

Shader compiler interface. Custom shader compiles need to derive from this class and implement the pure virtual interface functions. Instances are created via reflection so each implementation must be properly reflected. More...

#include <ShaderCompiler.h>

Inheritance diagram for plShaderProgramCompiler:

Public Member Functions

virtual void GetSupportedPlatforms (plHybridArray< plString, 4 > &out_platforms)=0
 Returns the platforms that this shader compiler supports.
 
virtual plResult ModifyShaderSource (plShaderProgramData &inout_data, plLogInterface *pLog)=0
 
virtual plResult Compile (plShaderProgramData &inout_data, plLogInterface *pLog)=0
 
- Public Member Functions inherited from plReflectedClass
virtual const plRTTIGetDynamicRTTI () const
 
bool IsInstanceOf (const plRTTI *pType) const
 Returns whether the type of this instance is of the given type or derived from it.
 
template<typename T >
PL_ALWAYS_INLINE bool IsInstanceOf () const
 Returns whether the type of this instance is of the given type or derived from it.
 

Additional Inherited Members

- Static Public Member Functions inherited from plNoBase
static const plRTTIGetStaticRTTI ()
 

Detailed Description

Shader compiler interface. Custom shader compiles need to derive from this class and implement the pure virtual interface functions. Instances are created via reflection so each implementation must be properly reflected.

Member Function Documentation

◆ Compile()

virtual plResult plShaderProgramCompiler::Compile ( plShaderProgramData & inout_data,
plLogInterface * pLog )
pure virtual

Compiles the shader comprised of multiple stages defined in inout_data.

Parameters
inout_dataThe state of the shader compiler. m_Resources and m_ByteCode should be written to on successful return code.
pLogLogging interface to be used when outputting any errors.
Returns
Returns whether the shader was compiled successfully. On failure, errors should be written to pLog.

Implemented in plShaderCompilerDXC, and plShaderCompilerHLSL.

◆ GetSupportedPlatforms()

virtual void plShaderProgramCompiler::GetSupportedPlatforms ( plHybridArray< plString, 4 > & out_platforms)
pure virtual

Returns the platforms that this shader compiler supports.

Parameters
out_platformsFilled with the platforms this compiler supports.

Implemented in plShaderCompilerDXC, and plShaderCompilerHLSL.

◆ ModifyShaderSource()

virtual plResult plShaderProgramCompiler::ModifyShaderSource ( plShaderProgramData & inout_data,
plLogInterface * pLog )
pure virtual

Allows the shader compiler to modify the shader source before hashing and compiling. This allows it to implement custom features by injecting code before the compile process. Mostly used to define resource bindings that do not cause conflicts across shader stages.

Parameters
inout_dataThe state of the shader compiler. Only m_sShaderSource should be modified by the implementation.
pLogLogging interface to be used when outputting any errors.
Returns
Returns whether the shader could be modified. On failure, the shader won't be compiled.

Implemented in plShaderCompilerDXC, and plShaderCompilerHLSL.


The documentation for this class was generated from the following file: