From c3eea71370eb94cff1fd96185458643fab6eb2c5 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 3 Nov 2022 19:47:46 +0000 Subject: Restructure how shaders are worked with Needs a tidy-up --- gfx/gl/shader.h | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 gfx/gl/shader.h (limited to 'gfx/gl/shader.h') diff --git a/gfx/gl/shader.h b/gfx/gl/shader.h new file mode 100644 index 0000000..1a8ddef --- /dev/null +++ b/gfx/gl/shader.h @@ -0,0 +1,21 @@ +#pragma once + +#include +#include +#include +#include + +class Shader { +public: + constexpr Shader(const GLchar * text, GLint len, GLuint type) : text {text}, len {len}, type {type} { } + + operator GLuint() const; + static void CheckShaderError(GLuint shader, GLuint flag, bool isProgram, std::string_view errorMessage); + +private: + using ShaderRef = glRef; + const GLchar * text; + GLint len; + GLuint type; + mutable std::optional shader {}; +}; -- cgit v1.2.3