mirror of
https://github.com/PCSX2/pcsx2.git
synced 2026-07-11 01:34:17 +02:00
GS/HW: Improve unordered access flag handling for RTs.
Only for DX11, which doesn't track resource state otherwise.
This commit is contained in:
@@ -184,7 +184,7 @@ public:
|
||||
// The unordered access flag is sticky, so once it's set we keep using ROV for the target
|
||||
// until it's recycled/destroyed. Only used for DX11/GL, which don't track actual resource layout/state.
|
||||
virtual bool IsUnorderedAccess() const { return m_unordered_access; }
|
||||
void UseUnorderedAccess() { m_unordered_access = true; }
|
||||
void SetUnorderedAccess() { m_unordered_access = true; }
|
||||
void ClearUnorderedAccess() { m_unordered_access = false; }
|
||||
|
||||
// Helper routines for formats/types
|
||||
|
||||
@@ -7638,11 +7638,6 @@ void GSRendererHW::DetermineROVUsage(GSTextureCache::Target* rt, GSTextureCache:
|
||||
GL_INS("ROV: Color ROV %s / depth ROV %s",
|
||||
use_rov_color ? "enabled" : "disabled", use_rov_depth ? "enabled" : "disabled");
|
||||
|
||||
// Set unordered access flag for backends that don't explicitly track resource state (DX11/GL).
|
||||
// Used only for heuristic above. Not used for depth, since we check for depth color instead.
|
||||
if (use_rov_color)
|
||||
rt->m_texture->UseUnorderedAccess();
|
||||
|
||||
// Do the actual pipeline config.
|
||||
ConfigureROV(use_rov_color, use_rov_depth);
|
||||
}
|
||||
@@ -7795,6 +7790,19 @@ void GSRendererHW::ConfigureROV(bool color_rov, bool depth_rov)
|
||||
}
|
||||
}
|
||||
|
||||
void GSRendererHW::SetUnorderedAccessFlag(GSTextureCache::Target* rt)
|
||||
{
|
||||
// Set flag for ROV activation heuristic. Only used by DX11.
|
||||
// Only needed for RT, as we use a different method for depth.
|
||||
if (rt)
|
||||
{
|
||||
if (m_conf.ps.HasColorROV())
|
||||
rt->m_texture->SetUnorderedAccess();
|
||||
else
|
||||
rt->m_texture->ClearUnorderedAccess();
|
||||
}
|
||||
}
|
||||
|
||||
static void CopyDepthTextureROV(GSTexture* src, GSTexture* dst)
|
||||
{
|
||||
switch (src->GetState())
|
||||
@@ -9429,8 +9437,10 @@ __ri void GSRendererHW::DrawPrims(GSTextureCache::Target* rt, GSTextureCache::Ta
|
||||
// Call before computing the full drawlist in case ROV is used and we don't need it.
|
||||
DetermineROVUsage(rt, ds);
|
||||
ConvertDepthFormatROV(ds);
|
||||
SetUnorderedAccessFlag(rt);
|
||||
|
||||
// Barriers must be determined before indices are modified via HandleProvokingVertexFirst/SetupIA.
|
||||
// This also computes the drawlist if needed.
|
||||
DetermineBarriers(rt, tex);
|
||||
|
||||
// Perform second pass setup here once barriers are determined.
|
||||
|
||||
@@ -256,6 +256,7 @@ private:
|
||||
void GetForcedROVUsage(bool& color_cov, bool& depth_rov); // Whether having color or depth with the current config forces the other.
|
||||
void DetermineROVUsage(GSTextureCache::Target* rt, GSTextureCache::Target* ds); // Heuristics to determine whether to enable/disable ROV
|
||||
void ConfigureROV(bool color_rov, bool depth_rov); // Actual config for ROV
|
||||
void SetUnorderedAccessFlag(GSTextureCache::Target* rt); // Set flag for DX11 ROV heuristic to work.
|
||||
void ConvertDepthFormatROV(GSTextureCache::Target* ds); // Convert between depth and depth color if needed.
|
||||
|
||||
void SetTCOffset();
|
||||
|
||||
Reference in New Issue
Block a user