From 4422c2d6d3fb5d8cdc778a3f1e25b2d4991555e2 Mon Sep 17 00:00:00 2001 From: SirLynix Date: Sun, 28 Jul 2024 21:11:21 +0200 Subject: [PATCH] Tests: Fix GLSL shaders not being executed for whatever reason --- tests/src/Tests/ShaderUtils.cpp | 34 +++++++++++++++------------------ 1 file changed, 15 insertions(+), 19 deletions(-) diff --git a/tests/src/Tests/ShaderUtils.cpp b/tests/src/Tests/ShaderUtils.cpp index c746123..207b6a7 100644 --- a/tests/src/Tests/ShaderUtils.cpp +++ b/tests/src/Tests/ShaderUtils.cpp @@ -294,32 +294,28 @@ void ExpectGLSL(nzsl::ShaderStageType stageType, const nzsl::Ast::Module& shader void ExpectGLSL(const nzsl::Ast::Module& shaderModule, std::string_view expectedOutput, const nzsl::ShaderWriter::States& options, const nzsl::GlslWriter::Environment& env, bool testShaderCompilation) { + + // Retrieve entry-point to get shader type std::optional entryShaderStage; - - SECTION("Detecting GLSL entry point") - { - // Retrieve entry-point to get shader type - nzsl::Ast::ReflectVisitor::Callbacks callbacks; - callbacks.onEntryPointDeclaration = [&](nzsl::ShaderStageType stageType, const std::string& functionName) - { - INFO("multiple entry points found! (" << functionName << ")"); - REQUIRE((!entryShaderStage.has_value() || stageType == entryShaderStage)); + nzsl::Ast::ReflectVisitor::Callbacks callbacks; + callbacks.onEntryPointDeclaration = [&](nzsl::ShaderStageType stageType, const std::string& functionName) + { + INFO("multiple entry points found! (" << functionName << ")"); + REQUIRE((!entryShaderStage.has_value() || stageType == entryShaderStage)); - entryShaderStage = stageType; - }; + entryShaderStage = stageType; + }; - nzsl::Ast::ReflectVisitor reflectVisitor; - reflectVisitor.Reflect(*shaderModule.rootNode, callbacks); + nzsl::Ast::ReflectVisitor reflectVisitor; + reflectVisitor.Reflect(*shaderModule.rootNode, callbacks); - { - INFO("no entry point found"); - REQUIRE(entryShaderStage.has_value()); - } + { + INFO("no entry point found"); + REQUIRE(entryShaderStage.has_value()); } - if (entryShaderStage) - ExpectGLSL(entryShaderStage.value(), shaderModule, expectedOutput, options, env, testShaderCompilation); + ExpectGLSL(entryShaderStage.value(), shaderModule, expectedOutput, options, env, testShaderCompilation); } void ExpectNZSL(const nzsl::Ast::Module& shaderModule, std::string_view expectedOutput, const nzsl::ShaderWriter::States& options)