Pyrogenesis HEAD
Pyrogenesis, a RTS Engine
Renderer::Backend::GL::CShaderProgramGLSL Class Referencefinal
Inheritance diagram for Renderer::Backend::GL::CShaderProgramGLSL:
Collaboration diagram for Renderer::Backend::GL::CShaderProgramGLSL:

Classes

struct  BindingSlot
 
struct  ShaderStage
 

Public Member Functions

 CShaderProgramGLSL (CDevice *device, const CStr &name, const VfsPath &programPath, PS::span< const std::tuple< VfsPath, GLenum > > shaderStages, const CShaderDefines &defines, const std::map< CStrIntern, int > &vertexAttribs, int streamflags)
 
 ~CShaderProgramGLSL () override
 
bool Link (const VfsPath &path)
 
void Bind (CShaderProgram *previousShaderProgram) override
 Binds the shader into the GL context. More...
 
void Unbind () override
 Unbinds the shader from the GL context. More...
 
IDeviceGetDevice () override
 
int32_t GetBindingSlot (const CStrIntern name) const override
 
TextureUnit GetTextureUnit (const int32_t bindingSlot) override
 
void SetUniform (const int32_t bindingSlot, const float value) override
 
void SetUniform (const int32_t bindingSlot, const float valueX, const float valueY) override
 
void SetUniform (const int32_t bindingSlot, const float valueX, const float valueY, const float valueZ) override
 
void SetUniform (const int32_t bindingSlot, const float valueX, const float valueY, const float valueZ, const float valueW) override
 
void SetUniform (const int32_t bindingSlot, PS::span< const float > values) override
 
void VertexAttribPointer (const VertexAttributeStream stream, const Format format, const uint32_t offset, const uint32_t stride, const VertexAttributeRate rate, const void *data) override
 
std::vector< VfsPathGetFileDependencies () const override
 
- Public Member Functions inherited from Renderer::Backend::GL::CShaderProgram
 ~CShaderProgram () override
 
virtual void Bind (CShaderProgram *previousShaderProgram)=0
 Binds the shader into the GL context. More...
 
virtual void Unbind ()=0
 Unbinds the shader from the GL context. More...
 
virtual TextureUnit GetTextureUnit (const int32_t bindingSlot)=0
 
virtual void SetUniform (const int32_t bindingSlot, const float value)=0
 
virtual void SetUniform (const int32_t bindingSlot, const float valueX, const float valueY)=0
 
virtual void SetUniform (const int32_t bindingSlot, const float valueX, const float valueY, const float valueZ)=0
 
virtual void SetUniform (const int32_t bindingSlot, const float valueX, const float valueY, const float valueZ, const float valueW)=0
 
virtual void SetUniform (const int32_t bindingSlot, PS::span< const float > values)=0
 
virtual 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
 
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< VfsPathGetFileDependencies () const =0
 
- Public Member Functions inherited from Renderer::Backend::IDeviceObject< IShaderProgram >
virtual ~IDeviceObject ()
 
virtual IDeviceGetDevice ()=0
 
TAs ()
 

Private Attributes

CDevicem_Device = nullptr
 
CStr m_Name
 
std::vector< VfsPathm_FileDependencies
 
std::map< CStrIntern, int > m_VertexAttribs
 
std::vector< int > m_ActiveVertexAttributes
 
GLuint m_Program
 
PS::StaticVector< ShaderStage, 5 > m_ShaderStages
 
std::vector< BindingSlotm_BindingSlots
 
std::unordered_map< CStrIntern, int32_t > m_BindingSlotsMapping
 

Additional Inherited Members

- Public Types inherited from Renderer::Backend::GL::CShaderProgram
typedef CStrIntern attrib_id_t
 
- Static Public Member Functions inherited from Renderer::Backend::GL::CShaderProgram
static std::unique_ptr< CShaderProgramCreate (CDevice *device, const CStr &name, const CShaderDefines &baseDefines)
 
- Protected Member Functions inherited from Renderer::Backend::GL::CShaderProgram
 CShaderProgram (int streamflags)
 
void VertexPointer (const Renderer::Backend::Format format, GLsizei stride, const void *pointer)
 
void NormalPointer (const Renderer::Backend::Format format, GLsizei stride, const void *pointer)
 
void ColorPointer (const Renderer::Backend::Format format, GLsizei stride, const void *pointer)
 
void TexCoordPointer (GLenum texture, const Renderer::Backend::Format format, GLsizei stride, const void *pointer)
 
void BindClientStates ()
 
void UnbindClientStates ()
 
- Protected Attributes inherited from Renderer::Backend::GL::CShaderProgram
int m_StreamFlags
 
int m_ValidStreams
 

Constructor & Destructor Documentation

◆ CShaderProgramGLSL()

Renderer::Backend::GL::CShaderProgramGLSL::CShaderProgramGLSL ( CDevice device,
const CStr &  name,
const VfsPath programPath,
PS::span< const std::tuple< VfsPath, GLenum > >  shaderStages,
const CShaderDefines defines,
const std::map< CStrIntern, int > &  vertexAttribs,
int  streamflags 
)
inline

◆ ~CShaderProgramGLSL()

Renderer::Backend::GL::CShaderProgramGLSL::~CShaderProgramGLSL ( )
inlineoverride

Member Function Documentation

◆ Bind()

void Renderer::Backend::GL::CShaderProgramGLSL::Bind ( CShaderProgram previousShaderProgram)
inlineoverridevirtual

Binds the shader into the GL context.

Call this before calling Uniform() or trying to render with it.

Implements Renderer::Backend::GL::CShaderProgram.

◆ GetBindingSlot()

int32_t Renderer::Backend::GL::CShaderProgramGLSL::GetBindingSlot ( const CStrIntern  name) const
inlineoverridevirtual

◆ GetDevice()

IDevice * Renderer::Backend::GL::CShaderProgramGLSL::GetDevice ( )
inlineoverridevirtual

◆ GetFileDependencies()

std::vector< VfsPath > Renderer::Backend::GL::CShaderProgramGLSL::GetFileDependencies ( ) const
inlineoverridevirtual

◆ GetTextureUnit()

TextureUnit Renderer::Backend::GL::CShaderProgramGLSL::GetTextureUnit ( const int32_t  bindingSlot)
inlineoverridevirtual

◆ Link()

bool Renderer::Backend::GL::CShaderProgramGLSL::Link ( const VfsPath path)
inline

◆ SetUniform() [1/5]

void Renderer::Backend::GL::CShaderProgramGLSL::SetUniform ( const int32_t  bindingSlot,
const float  value 
)
inlineoverridevirtual

◆ SetUniform() [2/5]

void Renderer::Backend::GL::CShaderProgramGLSL::SetUniform ( const int32_t  bindingSlot,
const float  valueX,
const float  valueY 
)
inlineoverridevirtual

◆ SetUniform() [3/5]

void Renderer::Backend::GL::CShaderProgramGLSL::SetUniform ( const int32_t  bindingSlot,
const float  valueX,
const float  valueY,
const float  valueZ 
)
inlineoverridevirtual

◆ SetUniform() [4/5]

void Renderer::Backend::GL::CShaderProgramGLSL::SetUniform ( const int32_t  bindingSlot,
const float  valueX,
const float  valueY,
const float  valueZ,
const float  valueW 
)
inlineoverridevirtual

◆ SetUniform() [5/5]

void Renderer::Backend::GL::CShaderProgramGLSL::SetUniform ( const int32_t  bindingSlot,
PS::span< const float >  values 
)
inlineoverridevirtual

◆ Unbind()

void Renderer::Backend::GL::CShaderProgramGLSL::Unbind ( )
inlineoverridevirtual

Unbinds the shader from the GL context.

Call this after rendering with it.

Implements Renderer::Backend::GL::CShaderProgram.

◆ VertexAttribPointer()

void Renderer::Backend::GL::CShaderProgramGLSL::VertexAttribPointer ( const VertexAttributeStream  stream,
const Format  format,
const uint32_t  offset,
const uint32_t  stride,
const VertexAttributeRate  rate,
const void *  data 
)
inlineoverridevirtual

Member Data Documentation

◆ m_ActiveVertexAttributes

std::vector<int> Renderer::Backend::GL::CShaderProgramGLSL::m_ActiveVertexAttributes
private

◆ m_BindingSlots

std::vector<BindingSlot> Renderer::Backend::GL::CShaderProgramGLSL::m_BindingSlots
private

◆ m_BindingSlotsMapping

std::unordered_map<CStrIntern, int32_t> Renderer::Backend::GL::CShaderProgramGLSL::m_BindingSlotsMapping
private

◆ m_Device

CDevice* Renderer::Backend::GL::CShaderProgramGLSL::m_Device = nullptr
private

◆ m_FileDependencies

std::vector<VfsPath> Renderer::Backend::GL::CShaderProgramGLSL::m_FileDependencies
private

◆ m_Name

CStr Renderer::Backend::GL::CShaderProgramGLSL::m_Name
private

◆ m_Program

GLuint Renderer::Backend::GL::CShaderProgramGLSL::m_Program
private

◆ m_ShaderStages

PS::StaticVector<ShaderStage, 5> Renderer::Backend::GL::CShaderProgramGLSL::m_ShaderStages
private

◆ m_VertexAttribs

std::map<CStrIntern, int> Renderer::Backend::GL::CShaderProgramGLSL::m_VertexAttribs
private

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