From f29eb00201224a30e7b90ec17a990bf07a8dab71 Mon Sep 17 00:00:00 2001 From: SCell555 Date: Fri, 28 Oct 2022 16:05:06 +0200 Subject: [PATCH] Fix writing combo semantics when not requested --- ShaderCompile/shaderparser.cpp | 27 +++++++++++++-------------- 1 file changed, 13 insertions(+), 14 deletions(-) diff --git a/ShaderCompile/shaderparser.cpp b/ShaderCompile/shaderparser.cpp index 4ee7780..77bd957 100644 --- a/ShaderCompile/shaderparser.cpp +++ b/ShaderCompile/shaderparser.cpp @@ -327,24 +327,23 @@ void Parser::WriteInclude( const fs::path& fileName, const std::string& name, co writeVars( "Dynamic"sv, dynamic_c, "IShaderDynamicAPI* pShaderAPI"sv, 1U, true ); - file << "\n"sv; - - const auto& writeComboArray = [&file, &name]( bool dynamic, const std::vector& combos ) + if ( writeSCI ) { - file << "static constexpr ShaderComboInformation_t s_"sv << ( dynamic ? "Dynamic"sv : "Static"sv ) << "ComboArray_"sv << name << "[] =\n{\n"sv; - for ( const Combo& c : combos ) - file << "\t{ \""sv << c.name << "\", "sv << c.minVal << ", "sv << c.maxVal << " },\n"sv; - file << "};\n"sv; - }; + file << "\n"sv; - if ( !dynamic_c.empty() ) - writeComboArray( true, dynamic_c ); + const auto& writeComboArray = [&file, &name]( bool dynamic, const std::vector& combos ) + { + file << "static constexpr ShaderComboInformation_t s_"sv << ( dynamic ? "Dynamic"sv : "Static"sv ) << "ComboArray_"sv << name << "[] =\n{\n"sv; + for ( const Combo& c : combos ) + file << "\t{ \""sv << c.name << "\", "sv << c.minVal << ", "sv << c.maxVal << " },\n"sv; + file << "};\n"sv; + }; - if ( !static_c.empty() ) - writeComboArray( false, static_c ); + if ( !dynamic_c.empty() ) + writeComboArray( true, dynamic_c ); - if ( writeSCI ) - { + if ( !static_c.empty() ) + writeComboArray( false, static_c ); file << "static constexpr ShaderComboSemantics_t "sv << name << "_combos =\n{\n\t\""sv << name << "\", "sv;