diff options
Diffstat (limited to 'lib')
-rw-r--r-- | lib/embed-glsl.cpp.m4 | 9 | ||||
-rw-r--r-- | lib/gl_traits.h | 9 | ||||
-rw-r--r-- | lib/strlen.h | 14 |
3 files changed, 12 insertions, 20 deletions
diff --git a/lib/embed-glsl.cpp.m4 b/lib/embed-glsl.cpp.m4 index 60fb56b..9fe0b41 100644 --- a/lib/embed-glsl.cpp.m4 +++ b/lib/embed-glsl.cpp.m4 @@ -1,12 +1,9 @@ changecom() dnl // NAME #include "gfx/gl/shader.h" -#include "lib/strlen.h" #include "substr(TYPE,1)-NAME.h" #include <glad/gl.h> - constexpr const GLchar * src {R"GLSL-EMBED(dnl -include(SOURCE))GLSL-EMBED"}; -constexpr auto len {constexpr_strlen(src)}; - -const Shader NAME`_'substr(TYPE,1) { src, len, GLTYPE }; +constexpr Shader NAME`_'substr(TYPE,1) { + R"GLSL-EMBED(dnl + include(SOURCE))GLSL-EMBED", GLTYPE }; diff --git a/lib/gl_traits.h b/lib/gl_traits.h index 2d3d85d..dcbe04e 100644 --- a/lib/gl_traits.h +++ b/lib/gl_traits.h @@ -125,6 +125,15 @@ glUniform(GLint location, std::span<const glm::vec<L, T, Q>> v) (*gl_traits<T>::glUniformvFunc[L - 1])(location, static_cast<GLsizei>(v.size()), glm::value_ptr(v.front())); } +template<typename T> +void +glUniform(GLint location, std::span<const T> v) +{ + static_assert( + requires { gl_traits<T>::glUniformvFunc; }, "Has glUnformNTv"); + (*gl_traits<T>::glUniformvFunc.front())(location, static_cast<GLsizei>(v.size()), v.data()); +} + template<glm::length_t L, typename T, glm::qualifier Q> void glUniform(GLint location, const glm::mat<L, L, T, Q> & v) diff --git a/lib/strlen.h b/lib/strlen.h deleted file mode 100644 index 2090d25..0000000 --- a/lib/strlen.h +++ /dev/null @@ -1,14 +0,0 @@ -#pragma once - -#include <cstddef> -#include <glad/gl.h> - -constexpr auto -constexpr_strlen(const GLchar * const s) -{ - std::size_t ch {}; - while (s[ch]) { - ch++; - } - return ch; -} |