Skip to content

Commit

Permalink
Fix writing combo semantics when not requested
Browse files Browse the repository at this point in the history
  • Loading branch information
SCell555 committed Oct 28, 2022
1 parent a3934d1 commit f29eb00
Showing 1 changed file with 13 additions and 14 deletions.
27 changes: 13 additions & 14 deletions ShaderCompile/shaderparser.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<Combo>& 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<Combo>& 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;

Expand Down

0 comments on commit f29eb00

Please sign in to comment.