mirror of https://github.com/PCSX2/pcsx2.git
GS: Make ClearDepth() take a value
This commit is contained in:
parent
a480c972f7
commit
f6bcfc3abd
|
@ -323,7 +323,7 @@ GSTexture* GSDevice::FetchSurface(GSTexture::Type type, int width, int height, i
|
|||
case GSTexture::Type::DepthStencil:
|
||||
{
|
||||
if (clear)
|
||||
ClearDepth(t);
|
||||
ClearDepth(t, 0.0f);
|
||||
else
|
||||
InvalidateRenderTarget(t);
|
||||
}
|
||||
|
|
|
@ -880,7 +880,7 @@ public:
|
|||
virtual void ClearRenderTarget(GSTexture* t, const GSVector4& c) = 0;
|
||||
virtual void ClearRenderTarget(GSTexture* t, u32 c) = 0;
|
||||
virtual void InvalidateRenderTarget(GSTexture* t) = 0;
|
||||
virtual void ClearDepth(GSTexture* t) = 0;
|
||||
virtual void ClearDepth(GSTexture* t, float d) = 0;
|
||||
|
||||
virtual void PushDebugGroup(const char* fmt, ...) = 0;
|
||||
virtual void PopDebugGroup() = 0;
|
||||
|
|
|
@ -1081,9 +1081,9 @@ void GSDevice11::InvalidateRenderTarget(GSTexture* t)
|
|||
m_ctx->DiscardView(static_cast<ID3D11RenderTargetView*>(*static_cast<GSTexture11*>(t)));
|
||||
}
|
||||
|
||||
void GSDevice11::ClearDepth(GSTexture* t)
|
||||
void GSDevice11::ClearDepth(GSTexture* t, float d)
|
||||
{
|
||||
m_ctx->ClearDepthStencilView(*(GSTexture11*)t, D3D11_CLEAR_DEPTH, 0.0f, 0);
|
||||
m_ctx->ClearDepthStencilView(*(GSTexture11*)t, D3D11_CLEAR_DEPTH, d, 0);
|
||||
}
|
||||
|
||||
void GSDevice11::ClearStencil(GSTexture* t, u8 c)
|
||||
|
|
|
@ -312,7 +312,7 @@ public:
|
|||
void ClearRenderTarget(GSTexture* t, const GSVector4& c) override;
|
||||
void ClearRenderTarget(GSTexture* t, u32 c) override;
|
||||
void InvalidateRenderTarget(GSTexture* t) override;
|
||||
void ClearDepth(GSTexture* t) override;
|
||||
void ClearDepth(GSTexture* t, float v) override;
|
||||
void ClearStencil(GSTexture* t, u8 c);
|
||||
|
||||
void PushDebugGroup(const char* fmt, ...) override;
|
||||
|
|
|
@ -666,7 +666,7 @@ void GSDevice12::InvalidateRenderTarget(GSTexture* t)
|
|||
t->SetState(GSTexture::State::Invalidated);
|
||||
}
|
||||
|
||||
void GSDevice12::ClearDepth(GSTexture* t)
|
||||
void GSDevice12::ClearDepth(GSTexture* t, float d)
|
||||
{
|
||||
if (!t)
|
||||
return;
|
||||
|
@ -674,7 +674,7 @@ void GSDevice12::ClearDepth(GSTexture* t)
|
|||
if (m_current_depth_target == t)
|
||||
EndRenderPass();
|
||||
|
||||
static_cast<GSTexture12*>(t)->SetClearDepth(0.0f);
|
||||
static_cast<GSTexture12*>(t)->SetClearDepth(d);
|
||||
}
|
||||
|
||||
void GSDevice12::LookupNativeFormat(GSTexture::Format format, DXGI_FORMAT* d3d_format, DXGI_FORMAT* srv_format,
|
||||
|
|
|
@ -282,7 +282,7 @@ public:
|
|||
void ClearRenderTarget(GSTexture* t, const GSVector4& c) override;
|
||||
void ClearRenderTarget(GSTexture* t, u32 c) override;
|
||||
void InvalidateRenderTarget(GSTexture* t) override;
|
||||
void ClearDepth(GSTexture* t) override;
|
||||
void ClearDepth(GSTexture* t, float d) override;
|
||||
|
||||
std::unique_ptr<GSDownloadTexture> CreateDownloadTexture(u32 width, u32 height, GSTexture::Format format) override;
|
||||
|
||||
|
|
|
@ -818,7 +818,7 @@ bool GSHwHack::OI_FFX(GSRendererHW& r, GSTexture* rt, GSTexture* ds, GSTextureCa
|
|||
{
|
||||
// random battle transition (z buffer written directly, clear it now)
|
||||
GL_INS("OI_FFX ZB clear");
|
||||
g_gs_device->ClearDepth(ds);
|
||||
g_gs_device->ClearDepth(ds, 0.0f);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -862,7 +862,7 @@ bool GSHwHack::OI_RozenMaidenGebetGarden(GSRendererHW& r, GSTexture* rt, GSTextu
|
|||
if (GSTextureCache::Target* tmp_ds = g_texture_cache->LookupTarget(TEX0, r.GetTargetSize(), r.GetTextureScaleFactor(), GSTextureCache::DepthStencil))
|
||||
{
|
||||
GL_INS("OI_RozenMaidenGebetGarden ZB clear");
|
||||
g_gs_device->ClearDepth(tmp_ds->m_texture);
|
||||
g_gs_device->ClearDepth(tmp_ds->m_texture, 0.0f);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
@ -948,7 +948,7 @@ bool GSHwHack::OI_ArTonelico2(GSRendererHW& r, GSTexture* rt, GSTexture* ds, GST
|
|||
if (r.m_vertex.next == 2 && !RPRIM->TME && RFRAME.FBW == 10 && v->XYZ.Z == 0 && RTEST.ZTST == ZTST_ALWAYS)
|
||||
{
|
||||
GL_INS("OI_ArTonelico2");
|
||||
g_gs_device->ClearDepth(ds);
|
||||
g_gs_device->ClearDepth(ds, 0.0f);
|
||||
}
|
||||
|
||||
return true;
|
||||
|
@ -985,7 +985,7 @@ bool GSHwHack::GSC_Battlefield2(GSRendererHW& r, int& skip)
|
|||
GSTextureCache::Target* dst = g_texture_cache->LookupTarget(TEX0, r.GetTargetSize(), r.GetTextureScaleFactor(), GSTextureCache::DepthStencil);
|
||||
if (dst)
|
||||
{
|
||||
g_gs_device->ClearDepth(dst->m_texture);
|
||||
g_gs_device->ClearDepth(dst->m_texture, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -5146,7 +5146,7 @@ void GSRendererHW::OI_DoubleHalfClear(GSTextureCache::Target*& rt, GSTextureCach
|
|||
{
|
||||
// Only pure clear are supported for depth
|
||||
ASSERT(color == 0);
|
||||
g_gs_device->ClearDepth(tex);
|
||||
g_gs_device->ClearDepth(tex, 0.0f);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -5168,7 +5168,7 @@ void GSRendererHW::OI_DoubleHalfClear(GSTextureCache::Target*& rt, GSTextureCach
|
|||
{
|
||||
// Only pure clear are supported for depth
|
||||
ASSERT(color == 0);
|
||||
g_gs_device->ClearDepth(ds->m_texture);
|
||||
g_gs_device->ClearDepth(ds->m_texture, 0.0f);
|
||||
ds->UpdateValidity(ds->GetUnscaledRect());
|
||||
}
|
||||
else
|
||||
|
|
|
@ -4870,7 +4870,7 @@ bool GSTextureCache::Target::ResizeTexture(int new_unscaled_width, int new_unsca
|
|||
if (tex->GetType() != GSTexture::Type::DepthStencil)
|
||||
g_gs_device->ClearRenderTarget(tex, tex->GetClearColor());
|
||||
else
|
||||
g_gs_device->ClearDepth(tex/*, tex->GetClearDepth()*/);
|
||||
g_gs_device->ClearDepth(tex, tex->GetClearDepth());
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -406,7 +406,7 @@ public:
|
|||
|
||||
void ClearRenderTarget(GSTexture* t, const GSVector4& c) override;
|
||||
void ClearRenderTarget(GSTexture* t, u32 c) override;
|
||||
void ClearDepth(GSTexture* t) override;
|
||||
void ClearDepth(GSTexture* t, float d) override;
|
||||
void InvalidateRenderTarget(GSTexture* t) override;
|
||||
|
||||
std::unique_ptr<GSDownloadTexture> CreateDownloadTexture(u32 width, u32 height, GSTexture::Format format) override;
|
||||
|
|
|
@ -554,7 +554,7 @@ GSTexture* GSDeviceMTL::CreateSurface(GSTexture::Type type, int width, int heigh
|
|||
ClearRenderTarget(t, 0);
|
||||
break;
|
||||
case GSTexture::Type::DepthStencil:
|
||||
ClearDepth(t);
|
||||
ClearDepth(t, 0.0f);
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
|
@ -1442,10 +1442,10 @@ void GSDeviceMTL::ClearRenderTarget(GSTexture* t, uint32 c)
|
|||
ClearRenderTarget(t, color);
|
||||
}
|
||||
|
||||
void GSDeviceMTL::ClearDepth(GSTexture* t)
|
||||
void GSDeviceMTL::ClearDepth(GSTexture* t, float d)
|
||||
{
|
||||
if (!t) return;
|
||||
t->SetClearDepth(0);
|
||||
t->SetClearDepth(d);
|
||||
}
|
||||
|
||||
void GSDeviceMTL::InvalidateRenderTarget(GSTexture* t)
|
||||
|
|
|
@ -939,7 +939,7 @@ void GSDeviceOGL::InvalidateRenderTarget(GSTexture* t)
|
|||
}
|
||||
}
|
||||
|
||||
void GSDeviceOGL::ClearDepth(GSTexture* t)
|
||||
void GSDeviceOGL::ClearDepth(GSTexture* t, float d)
|
||||
{
|
||||
if (!t)
|
||||
return;
|
||||
|
@ -956,15 +956,14 @@ void GSDeviceOGL::ClearDepth(GSTexture* t)
|
|||
|
||||
// TODO: check size of scissor before toggling it
|
||||
glDisable(GL_SCISSOR_TEST);
|
||||
const float c = 0.0f;
|
||||
if (GLState::depth_mask)
|
||||
{
|
||||
glClearBufferfv(GL_DEPTH, 0, &c);
|
||||
glClearBufferfv(GL_DEPTH, 0, &d);
|
||||
}
|
||||
else
|
||||
{
|
||||
glDepthMask(true);
|
||||
glClearBufferfv(GL_DEPTH, 0, &c);
|
||||
glClearBufferfv(GL_DEPTH, 0, &d);
|
||||
glDepthMask(false);
|
||||
}
|
||||
glEnable(GL_SCISSOR_TEST);
|
||||
|
|
|
@ -313,7 +313,7 @@ public:
|
|||
void ClearRenderTarget(GSTexture* t, const GSVector4& c) override;
|
||||
void ClearRenderTarget(GSTexture* t, u32 c) override;
|
||||
void InvalidateRenderTarget(GSTexture* t) override;
|
||||
void ClearDepth(GSTexture* t) override;
|
||||
void ClearDepth(GSTexture* t, float d) override;
|
||||
void ClearStencil(GSTexture* t, u8 c);
|
||||
|
||||
std::unique_ptr<GSDownloadTexture> CreateDownloadTexture(u32 width, u32 height, GSTexture::Format format) override;
|
||||
|
|
|
@ -814,7 +814,7 @@ void GSDeviceVK::InvalidateRenderTarget(GSTexture* t)
|
|||
t->SetState(GSTexture::State::Invalidated);
|
||||
}
|
||||
|
||||
void GSDeviceVK::ClearDepth(GSTexture* t)
|
||||
void GSDeviceVK::ClearDepth(GSTexture* t, float d)
|
||||
{
|
||||
if (!t)
|
||||
return;
|
||||
|
@ -822,7 +822,7 @@ void GSDeviceVK::ClearDepth(GSTexture* t)
|
|||
if (m_current_depth_target == t)
|
||||
EndRenderPass();
|
||||
|
||||
static_cast<GSTextureVK*>(t)->SetClearDepth(0.0f);
|
||||
static_cast<GSTextureVK*>(t)->SetClearDepth(d);
|
||||
}
|
||||
|
||||
VkFormat GSDeviceVK::LookupNativeFormat(GSTexture::Format format) const
|
||||
|
|
|
@ -268,7 +268,7 @@ public:
|
|||
void ClearRenderTarget(GSTexture* t, const GSVector4& c) override;
|
||||
void ClearRenderTarget(GSTexture* t, u32 c) override;
|
||||
void InvalidateRenderTarget(GSTexture* t) override;
|
||||
void ClearDepth(GSTexture* t) override;
|
||||
void ClearDepth(GSTexture* t, float d) override;
|
||||
|
||||
std::unique_ptr<GSDownloadTexture> CreateDownloadTexture(u32 width, u32 height, GSTexture::Format format) override;
|
||||
|
||||
|
|
Loading…
Reference in New Issue