Skip to content

Commit d12157d

Browse files
committed
Fix /listshaders alignment for 0-stage shaders
b9570ae missed adding the register flags for the 0 stages case. Also don't print a random string in case a stage or sort type lacks a name.
1 parent 8637375 commit d12157d

File tree

1 file changed

+20
-21
lines changed

1 file changed

+20
-21
lines changed

src/engine/renderer/tr_shader.cpp

Lines changed: 20 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -6411,6 +6411,21 @@ class ListShadersCmd : public Cmd::StaticCmd
64116411
continue;
64126412
}
64136413

6414+
auto PrintStage = [&]( const std::string & stageNum )
6415+
{
6416+
lineStream.clear();
6417+
lineStream.str("");
6418+
6419+
lineStream << std::left;
6420+
lineStream << std::setw(numLen) << i << separator;
6421+
lineStream << std::setw(regFlagsLen) << regFlags << separator;
6422+
lineStream << std::setw(shaderSortLen) << shaderSort << separator;
6423+
lineStream << std::setw(stageTypeLen) << stageType << separator;
6424+
lineStream << stageNum << ":" << shaderName;
6425+
6426+
Print( lineStream.str() );
6427+
};
6428+
64146429
regFlags = {
64156430
shader->registerFlags & RSF_2D ? '2' : '_',
64166431
shader->registerFlags & RSF_NOMIP ? 'N' : '_',
@@ -6421,6 +6436,7 @@ class ListShadersCmd : public Cmd::StaticCmd
64216436

64226437
if ( !shaderSortName.count( (shaderSort_t) shader->sort ) )
64236438
{
6439+
shaderSort.clear();
64246440
Log::Debug( "Undocumented shader sort %f for shader %s",
64256441
shader->sort, shader->name );
64266442
}
@@ -6434,16 +6450,8 @@ class ListShadersCmd : public Cmd::StaticCmd
64346450

64356451
if ( shader->stages == shader->lastStage )
64366452
{
6437-
lineStream.clear();
6438-
lineStream.str("");
6439-
6440-
lineStream << std::left;
6441-
lineStream << std::setw(numLen) << i << separator;
6442-
lineStream << std::setw(shaderSortLen) << shaderSort << separator;
6443-
lineStream << std::setw(stageTypeLen) << stageType << separator;
6444-
lineStream << "-:" << shaderName;
6445-
6446-
Print( lineStream.str() );
6453+
stageType = "n/a";
6454+
PrintStage( "-" );
64476455
continue;
64486456
}
64496457

@@ -6457,6 +6465,7 @@ class ListShadersCmd : public Cmd::StaticCmd
64576465

64586466
if ( !stageTypeName.count( stage->type ) )
64596467
{
6468+
stageType.clear();
64606469
Log::Debug( "Undocumented stage type %i for shader stage %s:%d",
64616470
Util::ordinal( stage->type ), shader->name, j );
64626471
}
@@ -6465,17 +6474,7 @@ class ListShadersCmd : public Cmd::StaticCmd
64656474
stageType = stageTypeName.at( stage->type );
64666475
}
64676476

6468-
lineStream.clear();
6469-
lineStream.str("");
6470-
6471-
lineStream << std::left;
6472-
lineStream << std::setw(numLen) << i << separator;
6473-
lineStream << std::setw(regFlagsLen) << regFlags << separator;
6474-
lineStream << std::setw(shaderSortLen) << shaderSort << separator;
6475-
lineStream << std::setw(stageTypeLen) << stageType << separator;
6476-
lineStream << j << ":" << shaderName;
6477-
6478-
Print( lineStream.str() );
6477+
PrintStage( std::to_string( j ) );
64796478
}
64806479
}
64816480

0 commit comments

Comments
 (0)