fixed r_detailTextures 0 messing up shaders

This commit is contained in:
myT 2020-02-27 05:22:06 +01:00
parent f773d2a783
commit 69d6cdf42b
2 changed files with 6 additions and 4 deletions

View file

@ -137,6 +137,8 @@ chg: r_fullbright is now latched again
chg: negative r_swapInterval values will request adaptive V-Sync when using an OpenGL back-end
fix: r_detailTextures 0 would mess up shaders where "detail" was used in a stage that isn't the last one
fix: dynamic lights could incorrectly stop applying to moving entities (e.g. cpm25 elevator)
fix: crash due to lack of memory for the sound system

View file

@ -2027,10 +2027,10 @@ static shader_t* FinishShader()
// ditch this stage if it's detail and detail textures are disabled
//
if ( pStage->isDetail && !r_detailTextures->integer ) {
if ( stage < ( MAX_SHADER_STAGES - 1 ) ) {
memmove( pStage, pStage + 1, sizeof( *pStage ) * ( MAX_SHADER_STAGES - stage - 1 ) );
Com_Memset( pStage + 1, 0, sizeof( *pStage ) );
}
const int toMove = MAX_SHADER_STAGES - stage - 1;
memmove( pStage, pStage + 1, sizeof( *pStage ) * toMove );
Com_Memset( &stages[MAX_SHADER_STAGES - 1], 0, sizeof( *pStage ) );
stage--;
continue;
}