A program state object can create or reuse a program.
More...
#include <ProgramState.h>
Inherits Object.
|
| | ProgramState (Program *program) |
|
virtual | ~ProgramState () |
| | destructor
|
| ProgramState * | clone () const |
| | Creates a deep copy of the current ProgramState.
|
|
rhi::Program * | getProgram () const |
| | Get the program object.
|
| void | setUniform (const rhi::UniformLocation &uniformLocation, const void *data, std::size_t size) |
| | Specify the value of a uniform variable for the current program state object.
|
| rhi::UniformLocation | getUniformLocation (std::string_view uniform) const |
| | Get uniform location in given uniform name.
|
| rhi::UniformLocation | getUniformLocation (rhi::Uniform name) const |
| | Get uniform location in a more efficient way by the given built-in uniform name.
|
| const VertexInputDesc * | getVertexInputDesc (std::string_view name) const |
| | Get an attribute location by the actual attribute name.
|
| const VertexInputDesc * | getVertexInputDesc (VertexInputKind name) const |
| | Get an attribute location by the engine built-in attribute name.
|
| void | setCallbackUniform (const rhi::UniformLocation &, const UniformCallback &) |
| | A callback to update unifrom.
|
| const std::unordered_map< UniformLocation, UniformCallback, UniformLocation > & | getCallbackUniforms () const |
| | Get the uniform callback function.
|
| void | setTexture (rhi::Texture *texture) |
| | Set texture.
|
|
void | setTextureArray (const rhi::UniformLocation &uniformLocation, std::span< TextureBinding > units) |
| | Set texture array in shader 'uniform sampler2D xxx[4];' unlikely sampoler2DArray, the array will use multi texture units.
|
| const std::unordered_map< int, TextureBindingSet > & | getTextureBindingSets () const |
| | Get vertex texture informations.
|
| void | setParameterAutoBinding (std::string_view uniformName, std::string_view autoBinding) |
| | Sets a uniform auto-binding.
|
| void | retain () |
| | Retains the ownership.
|
| void | release () |
| | Releases the ownership immediately.
|
| Object * | autorelease () |
| | Releases the ownership sometime soon automatically.
|
| unsigned int | getReferenceCount () const |
| | Returns the Object's current reference count.
|
| virtual | ~Object () |
| | Destructor.
|
|
|
unsigned int | _ID |
| | object id, ScriptSupport need public _ID
|
|
int | _luaID |
| | Lua reference id.
|
A program state object can create or reuse a program.
Each program state object keep its own unifroms and textures data.
◆ ProgramState()
- Parameters
-
| program | Specifies the program. |
◆ clone()
Creates a deep copy of the current ProgramState.
Unlike other clone methods, this function does not use autorelease. The returned object is allocated on the heap, and the caller is responsible for managing its lifetime and explicitly releasing it when no longer needed.
◆ setUniform()
| void setUniform |
( |
const rhi::UniformLocation & | uniformLocation, |
|
|
const void * | data, |
|
|
std::size_t | size ) |
Specify the value of a uniform variable for the current program state object.
- Parameters
-
| uniformLocation | Specifies the uniform location. |
| data | Specifies the new values to be used for the specified uniform variable. |
| size | Specifies the uniform data size. |
◆ getUniformLocation() [1/2]
| rhi::UniformLocation getUniformLocation |
( |
std::string_view | uniform | ) |
const |
◆ getUniformLocation() [2/2]
| rhi::UniformLocation getUniformLocation |
( |
rhi::Uniform | name | ) |
const |
Get uniform location in a more efficient way by the given built-in uniform name.
- Parameters
-
| uniform | Specifies the engin built-in uniform name. |
- Returns
- Uniform location.
- See also
- rhi::UniformLocation getUniformLocation(rhi::Uniform name) const
◆ getVertexInputDesc() [1/2]
| const VertexInputDesc * getVertexInputDesc |
( |
std::string_view | name | ) |
const |
|
inline |
Get an attribute location by the actual attribute name.
- Parameters
-
| name | Specifies the attribute name. |
- Returns
- Attribute location.
- See also
- int getAttributeLocation(std::string_view name) const
◆ getVertexInputDesc() [2/2]
| const VertexInputDesc * getVertexInputDesc |
( |
VertexInputKind | name | ) |
const |
|
inline |
Get an attribute location by the engine built-in attribute name.
- Parameters
-
| name | Specifies the built-in attribute name. |
- Returns
- Attribute location.
- See also
- int getAttributeLocation(std::string_view name) const
◆ setCallbackUniform()
| void setCallbackUniform |
( |
const rhi::UniformLocation & | , |
|
|
const UniformCallback & | ) |
A callback to update unifrom.
- Parameters
-
| uniformLocation | Specifies the uniform location. |
| unifromCallback | Specifies a callback function to update the uniform. |
◆ getCallbackUniforms()
| const std::unordered_map< UniformLocation, UniformCallback, UniformLocation > & getCallbackUniforms |
( |
| ) |
const |
|
inline |
Get the uniform callback function.
- Returns
- Uniform callback funciton.
◆ setTexture()
Set texture.
- Parameters
-
| uniformLocation | Specifies texture location. |
| texture | Specifies a pointer to backend texture. |
◆ getTextureBindingSets()
Get vertex texture informations.
- Returns
- Vertex texture informations. Key is the texture location, Value store the texture informations
◆ setParameterAutoBinding()
| void setParameterAutoBinding |
( |
std::string_view | uniformName, |
|
|
std::string_view | 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.
- Parameters
-
| 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. |
The documentation for this class was generated from the following file: