Skip to content

Commit

Permalink
Fix stages
Browse files Browse the repository at this point in the history
  • Loading branch information
VReaperV committed Jul 16, 2024
1 parent 46a56ed commit bfc9bff
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 1 deletion.
2 changes: 2 additions & 0 deletions src/engine/renderer/Material.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -884,6 +884,7 @@ void MaterialSystem::GenerateWorldMaterialsBuffer() {
uint stage = 0;
for ( shaderStage_t* pStage = drawSurf->shader->stages; pStage < drawSurf->shader->lastStage; pStage++ ) {
if ( drawSurf->materialIDs[stage] != material.id || drawSurf->materialPackIDs[stage] != materialPackID ) {
stage++;
continue;
}

Expand Down Expand Up @@ -1367,6 +1368,7 @@ static void ProcessMaterialHeatHaze( Material* material, shaderStage_t* pStage,

material->program = gl_heatHazeShaderMaterial->GetProgram( pStage->deformIndex );
}

static void ProcessMaterialLiquid( Material* material, shaderStage_t* pStage ) {
material->shader = gl_liquidShaderMaterial;

Expand Down
6 changes: 5 additions & 1 deletion src/engine/renderer/tr_shader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5904,7 +5904,11 @@ static shader_t *FinishShader()
shader_t *ret = MakeShaderPermanent();

if ( glConfig2.materialSystemAvailable && !tr.worldLoaded ) {
uint8_t maxStages = ret->numStages;
uint8_t maxStages = 0;
for ( shaderStage_t* pStage = ret->stages; pStage < ret->lastStage; pStage++ ) {
maxStages++;
}

if ( maxStages % 4 != 0 ) { // Aligned to 4 components
maxStages = ( maxStages / 4 + 1 ) * 4;
}
Expand Down

0 comments on commit bfc9bff

Please sign in to comment.