![]() |
Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
|
A compiled vertex+fragment shader program. More...
#include <ShaderProgram.h>


Classes | |
| struct | BindingSlot |
| struct | ShaderStage |
| struct | TextureUnit |
Public Types | |
| typedef CStrIntern | attrib_id_t |
Public Member Functions | |
| ~CShaderProgram () override | |
| void | Bind (CShaderProgram *previousShaderProgram) |
| Binds the shader into the GL context. More... | |
| void | Unbind () |
| Unbinds the shader from the GL context. More... | |
| int32_t | GetBindingSlot (const CStrIntern name) const override |
| TextureUnit | GetTextureUnit (const int32_t bindingSlot) |
| GLuint | GetStorageBuffer (const int32_t bindingSlot) |
| void | SetUniform (const int32_t bindingSlot, const float value) |
| void | SetUniform (const int32_t bindingSlot, const float valueX, const float valueY) |
| void | SetUniform (const int32_t bindingSlot, const float valueX, const float valueY, const float valueZ) |
| void | SetUniform (const int32_t bindingSlot, const float valueX, const float valueY, const float valueZ, const float valueW) |
| void | SetUniform (const int32_t bindingSlot, std::span< const float > values) |
| void | VertexAttribPointer (const VertexAttributeStream stream, const Format format, const uint32_t offset, const uint32_t stride, const VertexAttributeRate rate, const void *data) |
| bool | IsStreamActive (const VertexAttributeStream stream) const |
| bool | HasImageUniforms () const |
| IDevice * | GetDevice () override |
| std::vector< VfsPath > | GetFileDependencies () const override |
| void | AssertPointersBound () |
| Checks that all the required vertex attributes have been set. More... | |
| virtual int32_t | GetBindingSlot (const CStrIntern name) const =0 |
| virtual std::vector< VfsPath > | GetFileDependencies () const =0 |
Public Member Functions inherited from Renderer::Backend::IDeviceObject< IShaderProgram > | |
| virtual | ~IDeviceObject () |
| virtual IDevice * | GetDevice ()=0 |
| T * | As () |
Static Public Member Functions | |
| static std::unique_ptr< CShaderProgram > | Create (CDevice *device, const CStr &name, const CShaderDefines &baseDefines) |
Private Member Functions | |
| NONCOPYABLE (CShaderProgram) | |
| CShaderProgram (CDevice *device, const CStr &name, const VfsPath &programPath, std::span< const std::tuple< VfsPath, GLenum > > shaderStages, const CShaderDefines &defines, const std::map< CStrIntern, int > &vertexAttribs, int streamflags) | |
| bool | Link (const VfsPath &path) |
Private Attributes | |
| int | m_StreamFlags |
| int | m_ValidStreams |
| bool | m_HasImageUniforms {false} |
| CDevice * | m_Device {nullptr} |
| CStr | m_Name |
| std::vector< VfsPath > | m_FileDependencies |
| std::map< CStrIntern, int > | m_VertexAttribs |
| std::vector< int > | m_ActiveVertexAttributes |
| GLuint | m_Program |
| PS::StaticVector< ShaderStage, 5 > | m_ShaderStages |
| std::vector< BindingSlot > | m_BindingSlots |
| std::unordered_map< CStrIntern, int32_t > | m_BindingSlotsMapping |
| GLint | m_UniformBufferLocation {-1} |
| uint32_t | m_UniformBufferSize {0} |
| std::unique_ptr< IBuffer > | m_UniformBuffer |
A compiled vertex+fragment shader program.
Setting uniforms that the shader doesn't support is harmless.
|
override |
|
private |
| void CShaderProgram::AssertPointersBound | ( | ) |
Checks that all the required vertex attributes have been set.
Call this before calling Draw/DrawIndexed etc to avoid potential crashes.
| void CShaderProgram::Bind | ( | CShaderProgram * | previousShaderProgram | ) |
Binds the shader into the GL context.
Call this before calling Uniform() or trying to render with it.
|
static |
|
overridevirtual |
Implements Renderer::Backend::IShaderProgram.
|
inlineoverridevirtual |
|
overridevirtual |
Implements Renderer::Backend::IShaderProgram.
| GLuint CShaderProgram::GetStorageBuffer | ( | const int32_t | bindingSlot | ) |
| CShaderProgram::TextureUnit CShaderProgram::GetTextureUnit | ( | const int32_t | bindingSlot | ) |
|
inline |
| bool CShaderProgram::IsStreamActive | ( | const VertexAttributeStream | stream | ) | const |
|
private |
|
private |
| void CShaderProgram::SetUniform | ( | const int32_t | bindingSlot, |
| const float | value | ||
| ) |
| void CShaderProgram::SetUniform | ( | const int32_t | bindingSlot, |
| const float | valueX, | ||
| const float | valueY | ||
| ) |
| void CShaderProgram::SetUniform | ( | const int32_t | bindingSlot, |
| const float | valueX, | ||
| const float | valueY, | ||
| const float | valueZ | ||
| ) |
| void CShaderProgram::SetUniform | ( | const int32_t | bindingSlot, |
| const float | valueX, | ||
| const float | valueY, | ||
| const float | valueZ, | ||
| const float | valueW | ||
| ) |
| void CShaderProgram::SetUniform | ( | const int32_t | bindingSlot, |
| std::span< const float > | values | ||
| ) |
| void CShaderProgram::Unbind | ( | ) |
Unbinds the shader from the GL context.
Call this after rendering with it.
| void CShaderProgram::VertexAttribPointer | ( | const VertexAttributeStream | stream, |
| const Format | format, | ||
| const uint32_t | offset, | ||
| const uint32_t | stride, | ||
| const VertexAttributeRate | rate, | ||
| const void * | data | ||
| ) |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |
|
private |