diff --git a/source/common/rendering/hwrenderer/data/hw_renderstate.h b/source/common/rendering/hwrenderer/data/hw_renderstate.h index 54aab25f8..4751cba0b 100644 --- a/source/common/rendering/hwrenderer/data/hw_renderstate.h +++ b/source/common/rendering/hwrenderer/data/hw_renderstate.h @@ -555,18 +555,28 @@ public: mRenderStyle = rs; } + auto GetDepthBias() + { + return mBias; + } + void SetDepthBias(float a, float b) { + mBias.mChanged = mBias.mFactor != a || mBias.mUnits != b; mBias.mFactor = a; mBias.mUnits = b; - mBias.mChanged = true; + } + + void SetDepthBias(FDepthBiasState& bias) + { + SetDepthBias(bias.mFactor, bias.mUnits); } void ClearDepthBias() { + mBias.mChanged = mBias.mFactor != 0 || mBias.mUnits != 0; mBias.mFactor = 0; mBias.mUnits = 0; - mBias.mChanged = true; } private: diff --git a/source/core/rendering/scene/hw_walls.cpp b/source/core/rendering/scene/hw_walls.cpp index 33bb3c09e..4aacb3df7 100644 --- a/source/core/rendering/scene/hw_walls.cpp +++ b/source/core/rendering/scene/hw_walls.cpp @@ -260,16 +260,20 @@ void HWWall::RenderTexturedWall(HWDrawInfo *di, FRenderState &state, int rflags) float xOffset = 1.f / texture->GetDisplayWidth(); state.SetNpotEmulation(float(h2) / h, xOffset); } + RenderWall(di, state, rflags); } else if (!(rflags & RWF_TRANS)) { + auto oldbias = state.GetDepthBias(); if (walldist >= 0) state.SetDepthBias(-1, glseg.x1 == glseg.x2 || glseg.y1 == glseg.y2? -128 : -192); else state.ClearDepthBias(); + RenderWall(di, state, rflags); + state.SetDepthBias(oldbias); + } + else + RenderWall(di, state, rflags); - RenderWall(di, state, rflags); - - if (!(rflags && RWF_TRANS)) state.ClearDepthBias(); state.SetNpotEmulation(0.f, 0.f); state.SetObjectColor(0xffffffff); /* none of these functions is in use.