Hymn to Beauty
C++ 3D Engine
OpenGLShaderProgram.hpp
Go to the documentation of this file.
1#pragma once
2
3#include "../Interface/ShaderProgram.hpp"
4
5#include <glad/glad.h>
6#include <initializer_list>
7#include <vector>
8
9namespace Video {
10
11class Shader;
12
15 public:
17 struct PushConstant {
20
22 ShaderSource::ReflectionInfo::PushConstant::Type type;
23
25 uint32_t offset;
26 };
27
29
32 explicit OpenGLShaderProgram(std::initializer_list<const Shader*> shaders);
33
36
38
41 unsigned int GetID() const;
42
44
48 const std::vector<PushConstant>& GetPushConstants() const;
49
51
54 bool WritesToStorageBuffer() const;
55
56 private:
57 OpenGLShaderProgram(const OpenGLShaderProgram& other) = delete;
58
59 void AddPushConstants(const ShaderSource::ReflectionInfo& reflectionInfo);
60
61 GLuint shaderProgram;
62 std::vector<PushConstant> pushConstants;
63
64 bool writesToStorageBuffer = false;
65};
66
67}
OpenGL implementation of ShaderProgram.
Definition: OpenGLShaderProgram.hpp:14
OpenGLShaderProgram(std::initializer_list< const Shader * > shaders)
Create new OpenGL shader program.
Definition: OpenGLShaderProgram.cpp:9
unsigned int GetID() const
Get shader program ID.
Definition: OpenGLShaderProgram.cpp:51
const std::vector< PushConstant > & GetPushConstants() const
Get information about the push constants in this shader program.
Definition: OpenGLShaderProgram.cpp:55
~OpenGLShaderProgram() final
Destructor.
Definition: OpenGLShaderProgram.cpp:47
bool WritesToStorageBuffer() const
Get whether the shader program writes to a storage buffer.
Definition: OpenGLShaderProgram.cpp:59
A shader program.
Definition: ShaderProgram.hpp:11
Definition: Editor.hpp:18
Information about a push constant.
Definition: OpenGLShaderProgram.hpp:17
GLint uniformLocation
The uniform location to set.
Definition: OpenGLShaderProgram.hpp:19
ShaderSource::ReflectionInfo::PushConstant::Type type
The data type of the push constant.
Definition: OpenGLShaderProgram.hpp:22
uint32_t offset
The offset into the push constant structure.
Definition: OpenGLShaderProgram.hpp:25