mirror of https://github.com/ZDoom/raze-gles.git
- optimized the wall drawer a bit to avoid repeated calls to the render API's deoth bias function.
The setters in FRenderState should check if the value actually changes and the wall drawer should only call it for non-translucent wall sprites.
This commit is contained in:
parent
4bb57cfab5
commit
264d42179e
|
@ -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:
|
||||
|
|
|
@ -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.
|
||||
|
|
Loading…
Reference in New Issue