From 9d2e9b43ee2eeb772ee65c0c9a8d72018ad62887 Mon Sep 17 00:00:00 2001 From: Alexis Maiquez Date: Mon, 29 Nov 2021 13:36:15 +0100 Subject: [PATCH] ~ Fixed an infinite loop in the shader compiler + Added more valid variable types to the shader compiler so compilation doesn't fail Signed-off-by: Alexis Maiquez --- main.cpp | 2 +- src/WallpaperEngine/Render/Shaders/Compiler.cpp | 12 +++++++++++- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/main.cpp b/main.cpp index ff6042b..d26ffe9 100644 --- a/main.cpp +++ b/main.cpp @@ -97,7 +97,7 @@ int main (int argc, char* argv[]) case 'p': case 'd': - std::cout << "--dir/--pkg is deprecated and not used anymore" << std::endl; + std::cerr << "--dir/--pkg is deprecated and not used anymore" << std::endl; path = stringPathFixes (optarg); break; diff --git a/src/WallpaperEngine/Render/Shaders/Compiler.cpp b/src/WallpaperEngine/Render/Shaders/Compiler.cpp index 6269092..be8b5d6 100644 --- a/src/WallpaperEngine/Render/Shaders/Compiler.cpp +++ b/src/WallpaperEngine/Render/Shaders/Compiler.cpp @@ -302,6 +302,13 @@ namespace WallpaperEngine::Render::Shaders this->m_compiledContent += "uniform " + type + " " + name + array + ";"; } } + else + { + // continue reading the original shader as this most likely is a variable name or something + // that is not really interesting for the compiler + this->m_compiledContent += *it; + it ++; + } } /*else if (*it == 'a') { @@ -661,6 +668,9 @@ namespace WallpaperEngine::Render::Shaders std::vector Compiler::sTypes = { - "vec4", "vec3", "vec2", "float", "sampler2D", "mat4x3", "mat4", "uint4" + "vec4", "uvec4", "ivec4", "dvec4", "bvec4", + "vec3", "uvec3", "ivec3", "dvec3", "bvec3", + "vec2", "uvec2", "ivec2", "dvec2", "bvec2", + "float", "sampler2D", "mat4x3", "mat4", "mat3", "uint4" }; }