Fix depth test staying active when it shouldn't

This commit is contained in:
Magnus Norddahl 2019-12-08 00:41:02 +01:00
parent 310ef73aa8
commit f365f6f433
3 changed files with 5 additions and 28 deletions

View File

@ -204,13 +204,12 @@ void PolyRenderState::Apply()
mDrawCommands->SetViewport(mViewport.x, mViewport.y, mViewport.width, mViewport.height, mRenderTarget.Canvas, mRenderTarget.DepthStencil);
mDrawCommands->SetScissor(mScissor.x, mScissor.y, mScissor.width, mScissor.height);
mDrawCommands->SetViewpointUniforms(mViewpointUniforms);
mDrawCommands->EnableDepthTest(mDepthTest);
mDrawCommands->SetDepthClamp(mDepthClamp);
mDrawCommands->SetDepthMask(mDepthMask);
mDrawCommands->SetDepthFunc(mDepthFunc);
mDrawCommands->SetDepthMask(mDepthTest && mDepthMask);
mDrawCommands->SetDepthFunc(mDepthTest ? mDepthFunc : DF_Always);
mDrawCommands->SetDepthRange(mDepthRangeMin, mDepthRangeMax);
mDrawCommands->EnableStencil(mStencilEnabled);
mDrawCommands->SetStencil(mStencilValue, mStencilOp);
mDrawCommands->EnableStencil(mStencilEnabled);
mDrawCommands->SetCulling(mCulling);
mDrawCommands->SetColorMask(mColorMask[0], mColorMask[1], mColorMask[2], mColorMask[3]);
mNeedApply = false;

View File

@ -125,11 +125,6 @@ void PolyCommandBuffer::SetScissor(int x, int y, int w, int h)
mQueue->Push<PolySetScissorCommand>(x, y, w, h);
}
void PolyCommandBuffer::EnableDepthTest(bool on)
{
mQueue->Push<PolyEnableDepthTestCommand>(on);
}
void PolyCommandBuffer::SetRenderStyle(FRenderStyle style)
{
mQueue->Push<PolySetRenderStyleCommand>(style);
@ -324,7 +319,7 @@ void PolyTriangleThreadData::SetDepthFunc(int func)
{
DepthTest = true;
}
else if (func == DF_Always)
else // if (func == DF_Always)
{
DepthTest = false;
}
@ -380,12 +375,7 @@ void PolyTriangleThreadData::SetCulling(int mode)
void PolyTriangleThreadData::EnableStencil(bool on)
{
StencilTest = on;
WriteStencil = on && StencilTestValue != StencilWriteValue;
}
void PolyTriangleThreadData::EnableDepthTest(bool on)
{
DepthTest = on;
WriteStencil = on && (StencilTestValue != StencilWriteValue);
}
void PolyTriangleThreadData::SetRenderStyle(FRenderStyle style)

View File

@ -65,7 +65,6 @@ public:
void SetCulling(int mode);
void EnableStencil(bool on);
void SetScissor(int x, int y, int w, int h);
void EnableDepthTest(bool on);
void SetRenderStyle(FRenderStyle style);
void SetTexture(int unit, void *pixels, int width, int height, bool bgra);
void SetShader(int specialEffect, int effectState, bool alphaTest);
@ -158,7 +157,6 @@ public:
void SetCulling(int mode);
void EnableStencil(bool on);
void SetScissor(int x, int y, int w, int h);
void EnableDepthTest(bool on);
void SetRenderStyle(FRenderStyle style);
void SetTexture(int unit, const void *pixels, int width, int height, bool bgra);
void SetShader(int specialEffect, int effectState, bool alphaTest);
@ -407,16 +405,6 @@ private:
int h;
};
class PolyEnableDepthTestCommand : public PolyDrawerCommand
{
public:
PolyEnableDepthTestCommand(bool on) : on(on) { }
void Execute(DrawerThread *thread) override { PolyTriangleThreadData::Get(thread)->EnableDepthTest(on); }
private:
bool on;
};
class PolySetRenderStyleCommand : public PolyDrawerCommand
{
public: