diff options
author | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-24 00:46:57 +0000 |
---|---|---|
committer | Dan Goodliffe <dan@randomdan.homeip.net> | 2024-01-24 00:46:57 +0000 |
commit | 17aa6053e641d006649f94bb60a834ce945f351e (patch) | |
tree | b76f6fc642b749ee69d4be4b2e3f60e80c0ed7bc /gfx/gl/shader.h | |
parent | Add traits wrapper for setting uniforms (diff) | |
parent | Fix network population of position in gBuffer (diff) | |
download | ilt-17aa6053e641d006649f94bb60a834ce945f351e.tar.bz2 ilt-17aa6053e641d006649f94bb60a834ce945f351e.tar.xz ilt-17aa6053e641d006649f94bb60a834ce945f351e.zip |
Merge remote-tracking branch 'origin/instanced-networks'
Diffstat (limited to 'gfx/gl/shader.h')
-rw-r--r-- | gfx/gl/shader.h | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/gfx/gl/shader.h b/gfx/gl/shader.h index cff2281..c6b45af 100644 --- a/gfx/gl/shader.h +++ b/gfx/gl/shader.h @@ -2,20 +2,23 @@ #include <glRef.h> #include <glad/gl.h> -#include <optional> #include <string_view> +#include <thirdparty/ctre/include/ctre.hpp> class Shader { public: using ShaderRef = glRef<GLuint, &glCreateShader, &glDeleteShader>; - constexpr Shader(const GLchar * text, GLint len, GLuint type) : text {text}, len {len}, type {type} { } + constexpr Shader(const GLchar * text, GLuint type) : + text {text}, type {type}, lookups {ctre::search<R"(\bGL_[A-Z_]+\b)">(this->text)} + { + } [[nodiscard]] ShaderRef compile() const; static void CheckShaderError(GLuint shader, GLuint flag, bool isProgram, std::string_view errorMessage); private: - const GLchar * text; - GLint len; + const std::basic_string_view<GLchar> text; GLuint type; + bool lookups; }; |