CeresEngine 0.2.0
A game development framework
Loading...
Searching...
No Matches
CeresEngine::ShaderBinary Class Referencefinal

A ShaderBinary is an object responsible for wrapping the binary representation of a shader (i.e. More...

#include <CeresEngine/Material/ShaderSource.hpp>

Public Types

using BinaryBuffer = Vector< char >
 A binary buffer type.
 

Public Member Functions

 ShaderBinary () noexcept
 Creates a empty shader binary.
 
 ShaderBinary (ShaderType shaderType, BinaryBuffer binary) noexcept
 Creates a new shader binary from its binary representation.
 
 ShaderBinary (ShaderType shaderType, const unsigned char *binary, size_t length)
 Creates a new shader binary from its binary representation.
 
 ShaderBinary (const ShaderBinary &other)
 Creates a new shader binary by copying the contents of another.
 
ShaderBinaryoperator= (const ShaderBinary &other)
 Assigns the contents from another shader binary object.
 
 ShaderBinary (ShaderBinary &&other) noexcept
 Creates a new shader binary by moving the contents of another.
 
ShaderBinaryoperator= (ShaderBinary &&other) noexcept
 Assigns the contents from another shader binary object.
 
bool isValid () const noexcept
 
 operator bool () const noexcept
 

Static Public Member Functions

template<typename Processor >
static constexpr void reflect (Processor &&RTTI)
 Executes the given processor for every field of the struct.
 

Public Attributes

ShaderType type = ShaderType::Undefined
 The shader stage type.
 
BinaryBuffer data
 The shader binary code.
 

Detailed Description

A ShaderBinary is an object responsible for wrapping the binary representation of a shader (i.e.

its compiled code).

This shader binary object can be copied, moved and passed by reference to a shader implementation. The shader implementations will use the contents of this object to load the binary representation of the shader into the GPU.

Please note that many implementations are not cross platform and binary compiled shaders can only be loaded on the same computer with the same GPU.

Member Typedef Documentation

◆ BinaryBuffer

Constructor & Destructor Documentation

◆ ShaderBinary() [1/5]

CeresEngine::ShaderBinary::ShaderBinary ( )
noexcept

Creates a empty shader binary.

◆ ShaderBinary() [2/5]

CeresEngine::ShaderBinary::ShaderBinary ( ShaderType  shaderType,
BinaryBuffer  binary 
)
explicitnoexcept

Creates a new shader binary from its binary representation.

Parameters
shaderTypeThe shader stage type
binaryThe shader binary code

◆ ShaderBinary() [3/5]

CeresEngine::ShaderBinary::ShaderBinary ( ShaderType  shaderType,
const unsigned char binary,
size_t  length 
)

Creates a new shader binary from its binary representation.

Parameters
shaderTypeThe shader stage type
binaryThe shader binary code
lengthThe shader binary code length

◆ ShaderBinary() [4/5]

CeresEngine::ShaderBinary::ShaderBinary ( const ShaderBinary other)

Creates a new shader binary by copying the contents of another.

Parameters
otherThe shader binary to copy the contents from

◆ ShaderBinary() [5/5]

CeresEngine::ShaderBinary::ShaderBinary ( ShaderBinary &&  other)
noexcept

Creates a new shader binary by moving the contents of another.

Parameters
otherThe shader binary to copy the contents from

Member Function Documentation

◆ isValid()

bool CeresEngine::ShaderBinary::isValid ( ) const
noexcept
Returns
True if binary representation is valid

◆ operator bool()

CeresEngine::ShaderBinary::operator bool ( ) const
explicitnoexcept
Returns
True if binary representation is valid

◆ operator=() [1/2]

ShaderBinary & CeresEngine::ShaderBinary::operator= ( const ShaderBinary other)

Assigns the contents from another shader binary object.

Parameters
otherThe shader binary to copy the contents from
Returns
This

◆ operator=() [2/2]

ShaderBinary & CeresEngine::ShaderBinary::operator= ( ShaderBinary &&  other)
noexcept

Assigns the contents from another shader binary object.

Parameters
otherThe shader binary to move the contents from
Returns
This

◆ reflect()

template<typename Processor >
static constexpr void CeresEngine::ShaderBinary::reflect ( Processor &&  RTTI)
inlinestaticconstexpr

Executes the given processor for every field of the struct.

Parameters
RTTIThe processor to be ran for every field.

Member Data Documentation

◆ data

BinaryBuffer CeresEngine::ShaderBinary::data

The shader binary code.

◆ type

ShaderType CeresEngine::ShaderBinary::type = ShaderType::Undefined

The shader stage type.


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