From aa3850946c9c3155fb7cabeeea3bcf99fbfd02d0 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Fri, 23 Jan 2026 19:20:10 +0000 Subject: Include GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS in networkCurve output calc --- gfx/gl/shader.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'gfx/gl/shader.cpp') diff --git a/gfx/gl/shader.cpp b/gfx/gl/shader.cpp index 9a4c270..21edadb 100644 --- a/gfx/gl/shader.cpp +++ b/gfx/gl/shader.cpp @@ -16,8 +16,9 @@ namespace { } using LookUpFunction = std::string (*)(GLenum); - constexpr std::array, 1> LOOKUPS {{ + constexpr std::array, 2> LOOKUPS {{ {"GL_MAX_GEOMETRY_OUTPUT_VERTICES", GL_MAX_GEOMETRY_OUTPUT_VERTICES, getInt}, + {"GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS", GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS, getInt}, }}; struct ShaderCompileError : public MsgException { -- cgit v1.2.3 From 60aa83c683b71badfe4c76c1c18dec1b90c39965 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Mon, 26 Jan 2026 20:20:58 +0000 Subject: Fix warnings and minor tidy for GL lookups --- gfx/gl/shader.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'gfx/gl/shader.cpp') diff --git a/gfx/gl/shader.cpp b/gfx/gl/shader.cpp index 21edadb..cc6473e 100644 --- a/gfx/gl/shader.cpp +++ b/gfx/gl/shader.cpp @@ -8,18 +8,18 @@ namespace { auto - getInt(GLenum e) + getInt(GLenum pname) { - GLint i {}; - glGetIntegerv(e, &i); - return std::to_string(i); + GLint data {}; + glGetIntegerv(pname, &data); + return std::to_string(data); } using LookUpFunction = std::string (*)(GLenum); - constexpr std::array, 2> LOOKUPS {{ + constexpr auto LOOKUPS = std::to_array>({ {"GL_MAX_GEOMETRY_OUTPUT_VERTICES", GL_MAX_GEOMETRY_OUTPUT_VERTICES, getInt}, {"GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS", GL_MAX_GEOMETRY_TOTAL_OUTPUT_COMPONENTS, getInt}, - }}; + }); struct ShaderCompileError : public MsgException { explicit ShaderCompileError(GLuint shader, Shader::Source src) : -- cgit v1.2.3 From b225af0ef95b886abf20a4c450b5a0b3ba351730 Mon Sep 17 00:00:00 2001 From: Dan Goodliffe Date: Thu, 29 Jan 2026 18:04:34 +0000 Subject: Fix search/replace of GL_* macros in glsl --- gfx/gl/shader.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) (limited to 'gfx/gl/shader.cpp') diff --git a/gfx/gl/shader.cpp b/gfx/gl/shader.cpp index cc6473e..319726f 100644 --- a/gfx/gl/shader.cpp +++ b/gfx/gl/shader.cpp @@ -64,7 +64,7 @@ Shader::compile() const }; if (lookups) { std::basic_string textMod {text}; - for (const auto & match : ctre::search_all(textMod)) { + while (const auto match = ctre::search(textMod)) { if (const auto * const lookup = std::find_if(LOOKUPS.begin(), LOOKUPS.end(), [&match](const auto & lookup) { return std::get(lookup) == match; @@ -73,6 +73,9 @@ Shader::compile() const const auto & [name, pname, getFunction] = *lookup; textMod.replace(match.begin(), match.end(), getFunction(pname)); } + else { + throw std::domain_error(std::format("Unknown shader constant: {}", match.view())); + } } source(textMod.c_str(), static_cast(textMod.length())); } -- cgit v1.2.3