A program state object can create or reuse a program. More...
Inherits Ref.
Classes | |
class | AutoBindingResolver |
An abstract base class that can be extended to support custom material auto bindings. More... | |
Public Member Functions | |
ProgramState (Program *program) | |
virtual | ~ProgramState () |
destructor | |
ProgramState * | clone () const |
Deep clone ProgramState. | |
backend::Program * | getProgram () const |
Get the program object. | |
void | setUniform (const backend::UniformLocation &uniformLocation, const void *data, std::size_t size) |
Specify the value of a uniform variable for the current program state object. More... | |
backend::UniformLocation | getUniformLocation (const std::string &uniform) const |
Get uniform location in given uniform name. More... | |
backend::UniformLocation | getUniformLocation (backend::Uniform name) const |
Get uniform location in a more efficient way by the given built-in uniform name. More... | |
int | getAttributeLocation (const std::string &name) const |
Get an attribute location by the actual attribute name. More... | |
int | getAttributeLocation (Attribute name) const |
Get an attribute location by the engine built-in attribute name. More... | |
void | setCallbackUniform (const backend::UniformLocation &, const UniformCallback &) |
A callback to update unifrom. More... | |
void | setTexture (const backend::UniformLocation &uniformLocation, uint32_t slot, backend::TextureBackend *texture) |
Set texture. More... | |
void | setTextureArray (const backend::UniformLocation &uniformLocation, const std::vector< uint32_t > &slots, const std::vector< backend::TextureBackend * > textures) |
Set textures in array. More... | |
const std::unordered_map< int, TextureInfo > & | getVertexTextureInfos () const |
Get vertex texture informations. More... | |
const std::unordered_map< int, TextureInfo > & | getFragmentTextureInfos () const |
Get fragment texture informations. More... | |
const std::unordered_map< UniformLocation, UniformCallback, UniformLocation > & | getCallbackUniforms () const |
Get the uniform callback function. More... | |
void | getVertexUniformBuffer (char **buffer, std::size_t &size) const |
Get vertex uniform buffer. More... | |
void | getFragmentUniformBuffer (char **buffer, std::size_t &size) const |
Get fragment uniform buffer. More... | |
void | setParameterAutoBinding (const std::string &uniformName, const std::string &autoBinding) |
Sets a uniform auto-binding. More... | |
A program state object can create or reuse a program.
Each program state object keep its own unifroms and textures data.
ProgramState | ( | Program * | program | ) |
program | Specifies the program. |
void setUniform | ( | const backend::UniformLocation & | uniformLocation, |
const void * | data, | ||
std::size_t | size | ||
) |
Specify the value of a uniform variable for the current program state object.
uniformLocation | Specifies the uniform location. |
data | Specifies the new values to be used for the specified uniform variable. |
size | Specifies the uniform data size. |
backend::UniformLocation getUniformLocation | ( | const std::string & | uniform | ) | const |
Get uniform location in given uniform name.
uniform | Specifies the uniform name. |
backend::UniformLocation getUniformLocation(backend::Uniform name) const
backend::UniformLocation getUniformLocation | ( | backend::Uniform | name | ) | const |
Get uniform location in a more efficient way by the given built-in uniform name.
uniform | Specifies the engin built-in uniform name. |
backend::UniformLocation getUniformLocation(backend::Uniform name) const
|
inline |
Get an attribute location by the actual attribute name.
name | Specifies the attribute name. |
|
inline |
Get an attribute location by the engine built-in attribute name.
name | Specifies the built-in attribute name. |
void setCallbackUniform | ( | const backend::UniformLocation & | , |
const UniformCallback & | |||
) |
A callback to update unifrom.
uniformLocation | Specifies the uniform location. |
unifromCallback | Specifies a callback function to update the uniform. |
void setTexture | ( | const backend::UniformLocation & | uniformLocation, |
uint32_t | slot, | ||
backend::TextureBackend * | texture | ||
) |
Set texture.
uniformLocation | Specifies texture location. |
slot | Specifies texture slot selector. |
texture | Specifies a pointer to backend texture. |
void setTextureArray | ( | const backend::UniformLocation & | uniformLocation, |
const std::vector< uint32_t > & | slots, | ||
const std::vector< backend::TextureBackend * > | textures | ||
) |
Set textures in array.
uniformLocation | Specifies texture location. |
slots | Specifies texture slot selector. |
textures | Specifies a vector of backend texture object. |
|
inline |
Get vertex texture informations.
|
inline |
Get fragment texture informations.
|
inline |
Get the uniform callback function.
void getVertexUniformBuffer | ( | char ** | buffer, |
std::size_t & | size | ||
) | const |
Get vertex uniform buffer.
The buffer store all the vertex uniform's data.
[out] | buffer | Specifies the pointer points to a vertex uniform storage. |
[out] | size | Specifies the size of the buffer in bytes. |
void getFragmentUniformBuffer | ( | char ** | buffer, |
std::size_t & | size | ||
) | const |
Get fragment uniform buffer.
The buffer store all the fragment uniform's data for metal.
[out] | buffer | Specifies the pointer points to a fragment uniform storage. |
[out] | size | Specifies the size of the buffer in bytes. |
void setParameterAutoBinding | ( | const std::string & | uniformName, |
const std::string & | autoBinding | ||
) |
Sets a uniform auto-binding.
This method parses the passed in autoBinding string and attempts to convert it to an enumeration value. If it matches to one of the predefined strings, it will create a callback to get the correct value at runtime.
uniformName | The name of the material parameter to store an auto-binding for. |
autoBinding | A string matching one of the built-in AutoBinding enum constants. |