From 0087c2bf14a69703f0a4f3344528a2f3dfc452ad Mon Sep 17 00:00:00 2001 From: myT Date: Wed, 25 Sep 2019 05:34:22 +0200 Subject: [PATCH] fixed fog-only shaders being recognized as sky shaders --- changelog.txt | 2 ++ code/renderer/tr_local.h | 1 + code/renderer/tr_shader.cpp | 8 ++++---- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/changelog.txt b/changelog.txt index 6ff26ae..9420b06 100644 --- a/changelog.txt +++ b/changelog.txt @@ -107,6 +107,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: fog-only non-sky shaders were incorrectly handled as sky shaders, which broke fog on many maps + fix: r_monitor on Linux is now 0-based and the value doesn't change incorrectly on its own anymore fix: when a latched cvar's value is set to its default, the cvar is no longer marked as changed diff --git a/code/renderer/tr_local.h b/code/renderer/tr_local.h index 142af98..111087f 100644 --- a/code/renderer/tr_local.h +++ b/code/renderer/tr_local.h @@ -383,6 +383,7 @@ struct shader_t { qbool entityMergable; // multiple refentities can be combined in one batch (smoke, blood) + qbool isSky; skyParms_t sky; fogParms_t fogParms; diff --git a/code/renderer/tr_shader.cpp b/code/renderer/tr_shader.cpp index 02443ea..a8ce11e 100644 --- a/code/renderer/tr_shader.cpp +++ b/code/renderer/tr_shader.cpp @@ -1151,6 +1151,7 @@ static void ParseSkyParms( const char** text ) } shader.sort = SS_ENVIRONMENT; + shader.isSky = qtrue; } @@ -1443,7 +1444,7 @@ static qbool ParseShader( const char** text ) // // ignore shaders that don't have any stages, unless it is a sky or fog // - if ( !s && (shader.sort != SS_ENVIRONMENT) && !(shader.contentFlags & CONTENTS_FOG) ) { + if ( s == 0 && !shader.isSky && !(shader.contentFlags & CONTENTS_FOG ) ) { return qfalse; } @@ -2176,9 +2177,8 @@ static shader_t* FinishShader() } */ - // fogonly shaders don't have any normal passes - // !!! nor does sky, and this is utterly retarded logic in the first place - if ( !stage && (shader.sort == SS_BAD) ) { + // non-sky fog-only shaders don't have any normal passes + if ( !shader.isSky && stage == 0 ) { shader.sort = SS_FOG; }