Skip to content

Commit

Permalink
tr_shader: colormap stage with 2D image bit is generic2D
Browse files Browse the repository at this point in the history
We can skip the render-time test for them.

Also make a variable local to the block using it.
  • Loading branch information
illwieckz committed Jun 24, 2024
1 parent 7b4e20f commit 53442d7
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
1 change: 1 addition & 0 deletions src/engine/renderer/tr_local.h
Original file line number Diff line number Diff line change
Expand Up @@ -3455,6 +3455,7 @@ inline bool checkGLErrors()
void Render_NONE( shaderStage_t *pStage );
void Render_NOP( shaderStage_t *pStage );
void Render_generic( shaderStage_t *pStage );
void Render_generic2D( shaderStage_t *pStage );
void Render_generic3D( shaderStage_t *pStage );
void Render_lightMapping( shaderStage_t *pStage );
void Render_reflection_CB( shaderStage_t *pStage );
Expand Down
2 changes: 1 addition & 1 deletion src/engine/renderer/tr_shade.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ void Render_NOP( shaderStage_t * )
{
}

static void Render_generic2D( shaderStage_t *pStage )
void Render_generic2D( shaderStage_t *pStage )
{
GLimp_LogComment( "--- Render_generic2D ---\n" );

Expand Down
9 changes: 6 additions & 3 deletions src/engine/renderer/tr_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5382,12 +5382,15 @@ static void SetStagesRenderers()

stageRendererOptions_t stageRendererOptions = { &Render_NONE, false, false };

bool opaqueOrLess = shader.sort <= Util::ordinal(shaderSort_t::SS_OPAQUE);

switch ( stage->type )
{
case stageType_t::ST_COLORMAP:
stageRendererOptions = { &Render_generic, opaqueOrLess, false };
{
bool opaqueOrLess = shader.sort <= Util::ordinal(shaderSort_t::SS_OPAQUE);
bool is2D = stage->bundle[ TB_COLORMAP ].image[ 0 ]->bits & RSF_2D;
stageRenderer_t genericRenderer = is2D ? Render_generic2D : Render_generic;
stageRendererOptions = { genericRenderer, opaqueOrLess, false };
}
break;
case stageType_t::ST_STYLELIGHTMAP:
case stageType_t::ST_STYLECOLORMAP:
Expand Down

0 comments on commit 53442d7

Please sign in to comment.