Pyrogenesis  trunk
Classes | Public Member Functions | Private Attributes | List of all members
Renderer::Backend::GL::CShaderProgramGLSL Class Referencefinal
Inheritance diagram for Renderer::Backend::GL::CShaderProgramGLSL:
Inheritance graph
[legend]
Collaboration diagram for Renderer::Backend::GL::CShaderProgramGLSL:
Collaboration graph
[legend]

Classes

struct  BindingSlot
 

Public Member Functions

 CShaderProgramGLSL (CDevice *device, const CStr &name, const VfsPath &path, const VfsPath &vertexFilePath, const VfsPath &fragmentFilePath, const CShaderDefines &defines, const std::map< CStrIntern, int > &vertexAttribs, int streamflags)
 
 ~CShaderProgramGLSL () override
 
bool Compile (GLuint shader, const VfsPath &file, const CStr &code)
 
bool Link (const VfsPath &vertexFilePath, const VfsPath &fragmentFilePath)
 
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
 
bool IsStreamActive (const VertexAttributeStream stream) const
 
void AssertPointersBound ()
 Checks that all the required vertex attributes have been set. More...
 
- Public Member Functions inherited from Renderer::Backend::IDeviceObject< IShaderProgram >
virtual ~IDeviceObject ()
 
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
 
GLuint m_VertexShader
 
GLuint m_FragmentShader
 
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 path,
const VfsPath vertexFilePath,
const VfsPath fragmentFilePath,
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.

◆ Compile()

bool Renderer::Backend::GL::CShaderProgramGLSL::Compile ( GLuint  shader,
const VfsPath file,
const CStr &  code 
)
inline

◆ 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 vertexFilePath,
const VfsPath fragmentFilePath 
)
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_FragmentShader

GLuint Renderer::Backend::GL::CShaderProgramGLSL::m_FragmentShader
private

◆ m_Name

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

◆ m_Program

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

◆ m_VertexAttribs

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

◆ m_VertexShader

GLuint Renderer::Backend::GL::CShaderProgramGLSL::m_VertexShader
private

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