mirror of
https://github.com/KytyPS5/KytyPS5.git
synced 2026-10-29 16:51:20 +00:00
texture_cache: dedupe region queries with a picked flag
This commit is contained in:
1 parent
8dc0d56b7e
commit
170c107779
4 files changed
+8
-34
No files matched your search
+7
-15
@@ -429,12 +429,6 @@ TextureCache::ImageIds TextureCache::FindImagesInRegion(uint64_t address, uint64
|
|||||||
return {};
|
return {};
|
||||||
}
|
}
|
||||||
|
|
||||||
uint32_t query_epoch = ++m_image_query_epoch;
|
|
||||||
if (query_epoch == 0) {
|
|
||||||
m_slot_images.ForEach([](ImageId, const Image& image) { image.query_epoch = 0; });
|
|
||||||
query_epoch = ++m_image_query_epoch;
|
|
||||||
}
|
|
||||||
|
|
||||||
ImageIds result;
|
ImageIds result;
|
||||||
ForEachPage(address, size, [&](uint64_t page) {
|
ForEachPage(address, size, [&](uint64_t page) {
|
||||||
const auto* owners = m_image_page_table.Find(page);
|
const auto* owners = m_image_page_table.Find(page);
|
||||||
@@ -442,19 +436,17 @@ TextureCache::ImageIds TextureCache::FindImagesInRegion(uint64_t address, uint64
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
owners->ForEach([&](ImageId id) {
|
owners->ForEach([&](ImageId id) {
|
||||||
auto* image = m_slot_images.try_get(id);
|
const auto& image = m_slot_images[id];
|
||||||
if (image == nullptr) {
|
if (image.picked || !image.Overlaps(address, size, page_overlap)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if (image->query_epoch == query_epoch) {
|
image.picked = true;
|
||||||
return;
|
|
||||||
}
|
|
||||||
image->query_epoch = query_epoch;
|
|
||||||
if (image->Overlaps(address, size, page_overlap)) {
|
|
||||||
result.push_back(id);
|
result.push_back(id);
|
||||||
|
});
|
||||||
|
});
|
||||||
|
for (const auto id: result) {
|
||||||
|
m_slot_images[id].picked = false;
|
||||||
}
|
}
|
||||||
});
|
|
||||||
});
|
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -184,7 +184,6 @@ private:
|
|||||||
uint64_t m_pressure_gc_memory = 1536ull * 1024 * 1024;
|
uint64_t m_pressure_gc_memory = 1536ull * 1024 * 1024;
|
||||||
uint64_t m_critical_gc_memory = 3ull * 1024 * 1024 * 1024;
|
uint64_t m_critical_gc_memory = 3ull * 1024 * 1024 * 1024;
|
||||||
uint64_t m_gc_tick = 0;
|
uint64_t m_gc_tick = 0;
|
||||||
mutable uint32_t m_image_query_epoch = 0;
|
|
||||||
bool m_readback_linear_images = false;
|
bool m_readback_linear_images = false;
|
||||||
bool m_readback_tiled_images = false;
|
bool m_readback_tiled_images = false;
|
||||||
|
|
||||||
|
|||||||
@@ -149,7 +149,7 @@ public:
|
|||||||
ImageUsage usage;
|
ImageUsage usage;
|
||||||
ImageBinding binding;
|
ImageBinding binding;
|
||||||
bool registered = false;
|
bool registered = false;
|
||||||
mutable uint32_t query_epoch = 0;
|
mutable bool picked = false; // Set only while FindImagesInRegion collects it.
|
||||||
uint64_t track_addr = 0;
|
uint64_t track_addr = 0;
|
||||||
uint64_t track_addr_end = 0;
|
uint64_t track_addr_end = 0;
|
||||||
ImageId depth_id {};
|
ImageId depth_id {};
|
||||||
|
|||||||
@@ -331,16 +331,6 @@ struct TextureCacheTestAccess {
|
|||||||
return count;
|
return count;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void SetQueryEpoch(TextureCache &cache, uint32_t epoch) {
|
|
||||||
std::lock_guard lock(cache.m_lock);
|
|
||||||
cache.m_image_query_epoch = epoch;
|
|
||||||
}
|
|
||||||
|
|
||||||
static uint32_t QueryEpoch(TextureCache &cache) {
|
|
||||||
std::lock_guard lock(cache.m_lock);
|
|
||||||
return cache.m_image_query_epoch;
|
|
||||||
}
|
|
||||||
|
|
||||||
static ImageId InsertImage(TextureCache &cache, const ImageInfo &info) {
|
static ImageId InsertImage(TextureCache &cache, const ImageInfo &info) {
|
||||||
std::lock_guard lock(cache.m_lock);
|
std::lock_guard lock(cache.m_lock);
|
||||||
return cache.InsertImage(info);
|
return cache.InsertImage(info);
|
||||||
@@ -6063,13 +6053,6 @@ public:
|
|||||||
large_owner) == 0,
|
large_owner) == 0,
|
||||||
"large image unregister left coarse memberships behind");
|
"large image unregister left coarse memberships behind");
|
||||||
|
|
||||||
TextureCacheTestAccess::SetQueryEpoch(texture_cache, UINT32_MAX);
|
|
||||||
const auto wrap_results = TextureCacheTestAccess::FindImages(
|
|
||||||
texture_cache, base, sizeof(initial), false);
|
|
||||||
Require(name, "page-owner query epoch wrap",
|
|
||||||
IsOnlyImage(wrap_results, first) &&
|
|
||||||
TextureCacheTestAccess::QueryEpoch(texture_cache) == 1,
|
|
||||||
"query deduplication failed while wrapping its epoch");
|
|
||||||
|
|
||||||
auto &image = texture_cache.GetImage(first);
|
auto &image = texture_cache.GetImage(first);
|
||||||
constexpr uint32_t final_sampled_value = 0x88776655u;
|
constexpr uint32_t final_sampled_value = 0x88776655u;
|
||||||
|
|||||||
Reference in new issue
Block a user