From 60d7f4f7c21649bee21651c27dde4831dd4979eb Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Sun, 7 Jun 2020 09:30:55 +0200 Subject: [PATCH] - got rid of the RF_NPOTEmulation flag. This can easily be controlled with the 2 main variables alone. --- source/build/src/polymost.cpp | 8 ++++---- source/glbackend/glbackend.h | 11 +++-------- source/glbackend/pm_renderstate.h | 1 - wadsrc/static/engine/shaders/glsl/polymost.fp | 3 +-- 4 files changed, 8 insertions(+), 15 deletions(-) diff --git a/source/build/src/polymost.cpp b/source/build/src/polymost.cpp index 90a1a5c3f..d55a79875 100644 --- a/source/build/src/polymost.cpp +++ b/source/build/src/polymost.cpp @@ -424,16 +424,16 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 int32_t size2; for (size2 = 1; size2 < size; size2 += size2) {} if (size == size2) - GLInterface.SetNpotEmulation(false, 1.f, 0.f); + GLInterface.SetNpotEmulation(0.f, 0.f); else { float xOffset = 1.f / tilesize.x; - GLInterface.SetNpotEmulation(true, (1.f*size2) / size, xOffset); + GLInterface.SetNpotEmulation((1.f*size2) / size, xOffset); } } else { - GLInterface.SetNpotEmulation(false, 1.f, 0.f); + GLInterface.SetNpotEmulation(0.f, 0.f); } vec2_t tsiz2 = tsiz; @@ -491,7 +491,7 @@ static void polymost_drawpoly(vec2f_t const * const dpxy, int32_t const n, int32 GLInterface.SetTinting(-1, 0xffffff, 0xffffff); GLInterface.UseDetailMapping(false); GLInterface.UseGlowMapping(false); - GLInterface.SetNpotEmulation(false, 1.f, 0.f); + GLInterface.SetNpotEmulation(0.f, 0.f); if (skyzbufferhack && skyzbufferhack_pass == 0) { diff --git a/source/glbackend/glbackend.h b/source/glbackend/glbackend.h index daec0748b..74ed2e05f 100644 --- a/source/glbackend/glbackend.h +++ b/source/glbackend/glbackend.h @@ -407,15 +407,10 @@ public: else renderState.Flags &= ~RF_Brightmapping; } - void SetNpotEmulation(bool yes, float factor, float xOffset) + void SetNpotEmulation(float factor, float xOffset) { - if (yes) - { - renderState.Flags |= RF_NPOTEmulation; - renderState.NPOTEmulationFactor = factor; - renderState.NPOTEmulationXOffset = xOffset; - } - else renderState.Flags &= ~RF_NPOTEmulation; + renderState.NPOTEmulationFactor = factor; + renderState.NPOTEmulationXOffset = xOffset; } void SetShadeInterpolate(int32_t yes) diff --git a/source/glbackend/pm_renderstate.h b/source/glbackend/pm_renderstate.h index 84b828869..dd2bf543f 100644 --- a/source/glbackend/pm_renderstate.h +++ b/source/glbackend/pm_renderstate.h @@ -21,7 +21,6 @@ enum PRSFlags RF_DetailMapping = 4, RF_GlowMapping = 8, RF_Brightmapping = 16, - RF_NPOTEmulation = 32, RF_ShadeInterpolate = 64, RF_FogDisabled = 128, RF_MapFog = 256, // RRRA E2L1. diff --git a/wadsrc/static/engine/shaders/glsl/polymost.fp b/wadsrc/static/engine/shaders/glsl/polymost.fp index b6471b67c..c7c8e4583 100644 --- a/wadsrc/static/engine/shaders/glsl/polymost.fp +++ b/wadsrc/static/engine/shaders/glsl/polymost.fp @@ -3,7 +3,6 @@ const int RF_UsePalette = 2; const int RF_DetailMapping = 4; const int RF_GlowMapping = 8; const int RF_Brightmapping = 16; -const int RF_NPOTEmulation = 32; const int RF_ShadeInterpolate = 64; @@ -163,7 +162,7 @@ void main() vec2 newCoord; // Coordinate adjustment for NPOT textures (something must have gone very wrong to make this necessary...) - if ((u_flags & RF_NPOTEmulation) != 0) + if (u_npotEmulationFactor != 0.0) { float period = floor(coordY / u_npotEmulationFactor); coordX += u_npotEmulationXOffset * floor(mod(coordY, u_npotEmulationFactor));