Skip to content

Commit f29eb00

Browse files
committed
Fix writing combo semantics when not requested
1 parent a3934d1 commit f29eb00

File tree

1 file changed

+13
-14
lines changed

1 file changed

+13
-14
lines changed

ShaderCompile/shaderparser.cpp

Lines changed: 13 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -327,24 +327,23 @@ void Parser::WriteInclude( const fs::path& fileName, const std::string& name, co
327327

328328
writeVars( "Dynamic"sv, dynamic_c, "IShaderDynamicAPI* pShaderAPI"sv, 1U, true );
329329

330-
file << "\n"sv;
331-
332-
const auto& writeComboArray = [&file, &name]( bool dynamic, const std::vector<Combo>& combos )
330+
if ( writeSCI )
333331
{
334-
file << "static constexpr ShaderComboInformation_t s_"sv << ( dynamic ? "Dynamic"sv : "Static"sv ) << "ComboArray_"sv << name << "[] =\n{\n"sv;
335-
for ( const Combo& c : combos )
336-
file << "\t{ \""sv << c.name << "\", "sv << c.minVal << ", "sv << c.maxVal << " },\n"sv;
337-
file << "};\n"sv;
338-
};
332+
file << "\n"sv;
339333

340-
if ( !dynamic_c.empty() )
341-
writeComboArray( true, dynamic_c );
334+
const auto& writeComboArray = [&file, &name]( bool dynamic, const std::vector<Combo>& combos )
335+
{
336+
file << "static constexpr ShaderComboInformation_t s_"sv << ( dynamic ? "Dynamic"sv : "Static"sv ) << "ComboArray_"sv << name << "[] =\n{\n"sv;
337+
for ( const Combo& c : combos )
338+
file << "\t{ \""sv << c.name << "\", "sv << c.minVal << ", "sv << c.maxVal << " },\n"sv;
339+
file << "};\n"sv;
340+
};
342341

343-
if ( !static_c.empty() )
344-
writeComboArray( false, static_c );
342+
if ( !dynamic_c.empty() )
343+
writeComboArray( true, dynamic_c );
345344

346-
if ( writeSCI )
347-
{
345+
if ( !static_c.empty() )
346+
writeComboArray( false, static_c );
348347

349348
file << "static constexpr ShaderComboSemantics_t "sv << name << "_combos =\n{\n\t\""sv << name << "\", "sv;
350349

0 commit comments

Comments
 (0)