From f0ed0285f3e42add670848fc19ff5bb7fa288d2a Mon Sep 17 00:00:00 2001 From: kd-11 Date: Thu, 10 Oct 2019 21:40:03 +0300 Subject: [PATCH] rsx: Implement range-based subresource descriptor cache - The previous address-based approach was pretty awful when it comes to invalidating --- rpcs3/Emu/RSX/Common/texture_cache.h | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/rpcs3/Emu/RSX/Common/texture_cache.h b/rpcs3/Emu/RSX/Common/texture_cache.h index c7e17724bf..3d89429410 100644 --- a/rpcs3/Emu/RSX/Common/texture_cache.h +++ b/rpcs3/Emu/RSX/Common/texture_cache.h @@ -1429,7 +1429,8 @@ namespace rsx { for (auto It = m_temporary_subresource_cache.begin(); It != m_temporary_subresource_cache.end();) { - if (range.overlaps(It->second.cache_range)) + const auto& desc = It->second.first; + if (range.overlaps(desc.cache_range)) { It = m_temporary_subresource_cache.erase(It); } @@ -1765,7 +1766,7 @@ namespace rsx if (UNLIKELY(!result.image_handle)) { // Deferred reconstruct - result.external_subresource_range.cache_range = lookup_range; + result.external_subresource_desc.cache_range = lookup_range; } if (subsurface_count == 1) @@ -1849,7 +1850,7 @@ namespace rsx } const u32 cache_end = attr2.address + (attr2.pitch * attr2.height); - result.external_subresource_desc.cache_range = utils::address_range::start_end(attributes.address, end); + result.external_subresource_desc.cache_range = utils::address_range::start_end(attributes.address, cache_end); result.external_subresource_desc.sections_to_copy = std::move(sections); return result;