|
libdonut 2.3.6
Application framework for cross-platform game development in C++20
|
Compiled and linked GPU shader program. More...
#include <donut/graphics/ShaderProgram.hpp>
Public Types | |
| using | UniformValue = Variant< float, vec2, vec3, vec4, i32, i32vec2, i32vec3, i32vec4, u32, u32vec2, u32vec3, u32vec4, mat2, mat3, mat4 > |
| Value of a uniform shader variable. | |
Public Member Functions | |
| ShaderProgram (const ShaderProgramOptions &options) | |
| Compile and link a shader program. | |
| void | setUniformFloat (const ShaderParameter ¶meter, float value) |
| Enqueue a new value to be set for a uniform shader variable of GLSL type float. | |
| void | setUniformVec2 (const ShaderParameter ¶meter, vec2 value) |
| Enqueue a new value to be set for a uniform shader variable of GLSL type vec2. | |
| void | setUniformVec3 (const ShaderParameter ¶meter, vec3 value) |
| Enqueue a new value to be set for a uniform shader variable of GLSL type vec3. | |
| void | setUniformVec4 (const ShaderParameter ¶meter, vec4 value) |
| Enqueue a new value to be set for a uniform shader variable of GLSL type vec4. | |
| void | setUniformInt (const ShaderParameter ¶meter, i32 value) |
| Enqueue a new value to be set for a uniform shader variable of GLSL type int. | |
| void | setUniformIVec2 (const ShaderParameter ¶meter, i32vec2 value) |
| Enqueue a new value to be set for a uniform shader variable of GLSL type ivec2. | |
| void | setUniformIVec3 (const ShaderParameter ¶meter, i32vec3 value) |
| Enqueue a new value to be set for a uniform shader variable of GLSL type ivec3. | |
| void | setUniformIVec4 (const ShaderParameter ¶meter, i32vec4 value) |
| Enqueue a new value to be set for a uniform shader variable of GLSL type ivec4. | |
| void | setUniformUint (const ShaderParameter ¶meter, u32 value) |
| Enqueue a new value to be set for a uniform shader variable of GLSL type uint. | |
| void | setUniformUVec2 (const ShaderParameter ¶meter, u32vec2 value) |
| Enqueue a new value to be set for a uniform shader variable of GLSL type uvec2. | |
| void | setUniformUVec3 (const ShaderParameter ¶meter, u32vec3 value) |
| Enqueue a new value to be set for a uniform shader variable of GLSL type uvec3. | |
| void | setUniformUVec4 (const ShaderParameter ¶meter, u32vec4 value) |
| Enqueue a new value to be set for a uniform shader variable of GLSL type uvec4. | |
| void | setUniformMat2 (const ShaderParameter ¶meter, const mat2 &value) |
| Enqueue a new value to be set for a uniform shader variable of GLSL type mat2. | |
| void | setUniformMat3 (const ShaderParameter ¶meter, const mat3 &value) |
| Enqueue a new value to be set for a uniform shader variable of GLSL type mat3. | |
| void | setUniformMat4 (const ShaderParameter ¶meter, const mat4 &value) |
| Enqueue a new value to be set for a uniform shader variable of GLSL type mat4. | |
| void | setUniformSampler (const ShaderParameter ¶meter, const Texture *texture) |
| Insert a new texture to be bound for a uniform shader variable of a GLSL sampler type. | |
| void | clearUniformUploadQueue () noexcept |
| Erase all entries from the queue of new uniform shader variable values. | |
| void | clearTextureBindings () noexcept |
| Erase all entries from the list of active texture bindings. | |
| std::span< const std::pair< std::int32_t, UniformValue > > | getUniformUploadQueue () const noexcept |
| Get the list of new uniform shader variable values to be uploaded to the shader. | |
| std::span< const std::pair< std::int32_t, const Texture * > > | getTextureBindings () const noexcept |
| Get the list of active texture bindings to be synchronized with the shader. | |
| Handle | get () const noexcept |
| Get an opaque handle to the GPU representation of the shader program. | |
Compiled and linked GPU shader program.
| using donut::graphics::ShaderProgram::UniformValue = Variant< float, vec2, vec3, vec4, i32, i32vec2, i32vec3, i32vec4, u32, u32vec2, u32vec3, u32vec4, mat2, mat3, mat4> |
Value of a uniform shader variable.
|
explicit |
Compile and link a shader program.
| options | shader program options, see ShaderProgramOptions. |
| graphics::Error | on failure to create a shader object, create the shader program object, compile the shader code or link the shader program. |
| std::bad_alloc | on allocation failure. |
| void donut::graphics::ShaderProgram::setUniformFloat | ( | const ShaderParameter & | parameter, |
| float | value | ||
| ) |
Enqueue a new value to be set for a uniform shader variable of GLSL type float.
| parameter | shader variable to set. |
| value | new value to set the variable to. |
| std::bad_alloc | on allocation failure. |
| void donut::graphics::ShaderProgram::setUniformVec2 | ( | const ShaderParameter & | parameter, |
| vec2 | value | ||
| ) |
Enqueue a new value to be set for a uniform shader variable of GLSL type vec2.
| parameter | shader variable to set. |
| value | new value to set the variable to. |
| std::bad_alloc | on allocation failure. |
| void donut::graphics::ShaderProgram::setUniformVec3 | ( | const ShaderParameter & | parameter, |
| vec3 | value | ||
| ) |
Enqueue a new value to be set for a uniform shader variable of GLSL type vec3.
| parameter | shader variable to set. |
| value | new value to set the variable to. |
| std::bad_alloc | on allocation failure. |
| void donut::graphics::ShaderProgram::setUniformVec4 | ( | const ShaderParameter & | parameter, |
| vec4 | value | ||
| ) |
Enqueue a new value to be set for a uniform shader variable of GLSL type vec4.
| parameter | shader variable to set. |
| value | new value to set the variable to. |
| std::bad_alloc | on allocation failure. |
| void donut::graphics::ShaderProgram::setUniformInt | ( | const ShaderParameter & | parameter, |
| i32 | value | ||
| ) |
Enqueue a new value to be set for a uniform shader variable of GLSL type int.
| parameter | shader variable to set. |
| value | new value to set the variable to. |
| std::bad_alloc | on allocation failure. |
| void donut::graphics::ShaderProgram::setUniformIVec2 | ( | const ShaderParameter & | parameter, |
| i32vec2 | value | ||
| ) |
Enqueue a new value to be set for a uniform shader variable of GLSL type ivec2.
| parameter | shader variable to set. |
| value | new value to set the variable to. |
| std::bad_alloc | on allocation failure. |
| void donut::graphics::ShaderProgram::setUniformIVec3 | ( | const ShaderParameter & | parameter, |
| i32vec3 | value | ||
| ) |
Enqueue a new value to be set for a uniform shader variable of GLSL type ivec3.
| parameter | shader variable to set. |
| value | new value to set the variable to. |
| std::bad_alloc | on allocation failure. |
| void donut::graphics::ShaderProgram::setUniformIVec4 | ( | const ShaderParameter & | parameter, |
| i32vec4 | value | ||
| ) |
Enqueue a new value to be set for a uniform shader variable of GLSL type ivec4.
| parameter | shader variable to set. |
| value | new value to set the variable to. |
| std::bad_alloc | on allocation failure. |
| void donut::graphics::ShaderProgram::setUniformUint | ( | const ShaderParameter & | parameter, |
| u32 | value | ||
| ) |
Enqueue a new value to be set for a uniform shader variable of GLSL type uint.
| parameter | shader variable to set. |
| value | new value to set the variable to. |
| std::bad_alloc | on allocation failure. |
| void donut::graphics::ShaderProgram::setUniformUVec2 | ( | const ShaderParameter & | parameter, |
| u32vec2 | value | ||
| ) |
Enqueue a new value to be set for a uniform shader variable of GLSL type uvec2.
| parameter | shader variable to set. |
| value | new value to set the variable to. |
| std::bad_alloc | on allocation failure. |
| void donut::graphics::ShaderProgram::setUniformUVec3 | ( | const ShaderParameter & | parameter, |
| u32vec3 | value | ||
| ) |
Enqueue a new value to be set for a uniform shader variable of GLSL type uvec3.
| parameter | shader variable to set. |
| value | new value to set the variable to. |
| std::bad_alloc | on allocation failure. |
| void donut::graphics::ShaderProgram::setUniformUVec4 | ( | const ShaderParameter & | parameter, |
| u32vec4 | value | ||
| ) |
Enqueue a new value to be set for a uniform shader variable of GLSL type uvec4.
| parameter | shader variable to set. |
| value | new value to set the variable to. |
| std::bad_alloc | on allocation failure. |
| void donut::graphics::ShaderProgram::setUniformMat2 | ( | const ShaderParameter & | parameter, |
| const mat2 & | value | ||
| ) |
Enqueue a new value to be set for a uniform shader variable of GLSL type mat2.
| parameter | shader variable to set. |
| value | new value to set the variable to. |
| std::bad_alloc | on allocation failure. |
| void donut::graphics::ShaderProgram::setUniformMat3 | ( | const ShaderParameter & | parameter, |
| const mat3 & | value | ||
| ) |
Enqueue a new value to be set for a uniform shader variable of GLSL type mat3.
| parameter | shader variable to set. |
| value | new value to set the variable to. |
| std::bad_alloc | on allocation failure. |
| void donut::graphics::ShaderProgram::setUniformMat4 | ( | const ShaderParameter & | parameter, |
| const mat4 & | value | ||
| ) |
Enqueue a new value to be set for a uniform shader variable of GLSL type mat4.
| parameter | shader variable to set. |
| value | new value to set the variable to. |
| std::bad_alloc | on allocation failure. |
| void donut::graphics::ShaderProgram::setUniformSampler | ( | const ShaderParameter & | parameter, |
| const Texture * | texture | ||
| ) |
Insert a new texture to be bound for a uniform shader variable of a GLSL sampler type.
| parameter | shader variable to set. |
| texture | non-owning read-only pointer to the new texture to bind the variable to, or nullptr to remove the binding for the given variable. |
| std::bad_alloc | on allocation failure. |
|
inlinenoexcept |
Erase all entries from the queue of new uniform shader variable values.
|
inlinenoexcept |
Erase all entries from the list of active texture bindings.
|
inlinenoexcept |
Get the list of new uniform shader variable values to be uploaded to the shader.
|
inlinenoexcept |
Get the list of active texture bindings to be synchronized with the shader.
|
inlinenoexcept |
Get an opaque handle to the GPU representation of the shader program.