summaryrefslogtreecommitdiffstats
path: root/src/Gal.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/Gal.hpp')
-rw-r--r--src/Gal.hpp40
1 files changed, 14 insertions, 26 deletions
diff --git a/src/Gal.hpp b/src/Gal.hpp
index 4757e37..234e49a 100644
--- a/src/Gal.hpp
+++ b/src/Gal.hpp
@@ -20,7 +20,7 @@ namespace Gal {
struct PipelineInstance;
struct FramebufferConfig;
struct Framebuffer;
- struct ShaderParameters;
+ struct ShaderParametersBuffer;
struct Shader;
@@ -131,7 +131,7 @@ namespace Gal {
virtual std::shared_ptr<Framebuffer> GetDefaultFramebuffer() = 0;
- virtual std::shared_ptr<ShaderParameters> GetGlobalShaderParameters() = 0;
+ virtual std::shared_ptr<ShaderParametersBuffer> GetGlobalShaderParameters() = 0;
virtual std::shared_ptr<Shader> LoadVertexShader(std::string_view code) = 0;
@@ -250,34 +250,22 @@ namespace Gal {
virtual void SetTexture(size_t location, std::shared_ptr<Texture> texture) = 0;
};
- struct ShaderParameters {
- virtual ~ShaderParameters() = default;
+ struct ShaderParametersBuffer {
+ virtual ~ShaderParametersBuffer() = default;
- virtual void AddGlobalShaderParameter(std::string_view name, Type type) = 0;
+ template<typename T>
+ T* Get() {
+ return reinterpret_cast<T*>(GetDataPtr());
+ }
- virtual void SetGlobalShaderParameter(std::string_view name, float value) = 0;
+ template<typename T>
+ void Resize() {
+ Resize(sizeof(T));
+ }
- virtual void SetGlobalShaderParameter(std::string_view name, double value) = 0;
+ virtual std::byte* GetDataPtr() = 0;
- virtual void SetGlobalShaderParameter(std::string_view name, int8_t value) = 0;
-
- virtual void SetGlobalShaderParameter(std::string_view name, int16_t value) = 0;
-
- virtual void SetGlobalShaderParameter(std::string_view name, int32_t value) = 0;
-
- virtual void SetGlobalShaderParameter(std::string_view name, uint8_t value) = 0;
-
- virtual void SetGlobalShaderParameter(std::string_view name, uint16_t value) = 0;
-
- virtual void SetGlobalShaderParameter(std::string_view name, uint32_t value) = 0;
-
- virtual void SetGlobalShaderParameter(std::string_view name, glm::vec2 value) = 0;
-
- virtual void SetGlobalShaderParameter(std::string_view name, glm::vec3 value) = 0;
-
- virtual void SetGlobalShaderParameter(std::string_view name, glm::vec4 value) = 0;
-
- virtual void SetGlobalShaderParameter(std::string_view name, glm::mat4 value) = 0;
+ virtual void Resize(size_t newSize) = 0;
};
struct Shader {