From be20b6a83998208da16443eac49fb2c6a09cdb17 Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Tue, 20 Apr 2021 16:58:18 +0200 Subject: [PATCH] - fixed: wall sprites do not need NPOT emulation. --- source/core/rendering/scene/hw_walls.cpp | 23 +++++++++++------------ source/glbackend/glbackend.cpp | 1 + 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/source/core/rendering/scene/hw_walls.cpp b/source/core/rendering/scene/hw_walls.cpp index d45ef6bfc..7dc8ace05 100644 --- a/source/core/rendering/scene/hw_walls.cpp +++ b/source/core/rendering/scene/hw_walls.cpp @@ -156,19 +156,18 @@ void HWWall::RenderMirrorSurface(HWDrawInfo *di, FRenderState &state) void HWWall::RenderTexturedWall(HWDrawInfo *di, FRenderState &state, int rflags) { SetLightAndFog(state, fade, palette, shade, visibility, alpha); - state.SetMaterial(texture, UF_Texture, 0, sprite == nullptr ? (flags & (HWF_CLAMPX | HWF_CLAMPY)) : CLAMP_XY, TRANSLATION(Translation_Remap + curbasepal, palette), -1); + state.SetMaterial(texture, UF_Texture, 0, (flags & (HWF_CLAMPX | HWF_CLAMPY)), TRANSLATION(Translation_Remap + curbasepal, palette), -1); - int h = (int)texture->GetDisplayHeight(); - int h2 = 1 << sizeToBits(h); - if (h2 < h) h2 *= 2; - if (h != h2) + if (sprite == nullptr) { - float xOffset = 1.f / texture->GetDisplayWidth(); - state.SetNpotEmulation(float(h2) / h, xOffset); - } - else - { - state.SetNpotEmulation(0.f, 0.f); + int h = (int)texture->GetDisplayHeight(); + int h2 = 1 << sizeToBits(h); + if (h2 < h) h2 *= 2; + if (h != h2) + { + float xOffset = 1.f / texture->GetDisplayWidth(); + state.SetNpotEmulation(float(h2) / h, xOffset); + } } RenderWall(di, state, rflags); @@ -1047,7 +1046,7 @@ void HWWall::ProcessWallSprite(HWDrawInfo* di, spritetype* spr, sectortype* sect backsector = sector; texture = tex; - flags = 0; + flags = HWF_CLAMPX|HWF_CLAMPY; dynlightindex = -1; shade = clamp(spr->shade, 0, numshades - 1); palette = spr->pal; diff --git a/source/glbackend/glbackend.cpp b/source/glbackend/glbackend.cpp index 0778bb605..62f9980d7 100644 --- a/source/glbackend/glbackend.cpp +++ b/source/glbackend/glbackend.cpp @@ -126,6 +126,7 @@ void GLInstance::DoDraw() } } } + state.SetNpotEmulation(0, 0); // make sure we do not leave this in an undefined state. renderState.Apply(*screen->RenderState(), lastState); // apply any pending change before returning. rendercommands.Clear(); hw_int_useindexedcolortextures = false;