From 0612c181fff08862b4e4f5c7a22dccd5b6b712cc Mon Sep 17 00:00:00 2001 From: Sanjaysrinivas Date: Tue, 13 Oct 2026 11:11:58 +0200 Subject: [PATCH] fix(agc): avoid storage snapshot overlap Create uploads before publishing snapshot validity. Keep allocation edits separate from the per-unit validity changes in #5024. --- core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp | 2 +- core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp b/core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp index 5051c7718..2ad97c337 100644 --- a/core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp +++ b/core/libs/prx/libSceAgcDriver/Graphics/include/Texture.hpp @@ -545,7 +545,7 @@ private: bool dirty = false; std::uint64_t version = 0; // `original` holds the guest bytes; false after a GPU-side clear, which never read them. - bool originalValid = false; + bool originalValid = true; // The storage cache let the image go (Flush): a lookup makes a new image of the surface, so // no fill may put results into this one (guarded by the live-image registry lock). bool released = false; diff --git a/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp b/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp index ff5bafb7c..6704ead77 100644 --- a/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp +++ b/core/libs/prx/libSceAgcDriver/Graphics/src/Texture.cpp @@ -2144,9 +2144,9 @@ void StorageTexture::upload(const std::vector* layers) { return; } originalValid = true; - original.resize(static_cast(guestBytes)); forgetBorrowed(0, trackedLayers); stampLayers(false); + original.resize(static_cast(guestBytes)); GuestMemory::ReadCommitted(descriptor.baseAddress, original); { Buffer staging(context, original.size(), VK_BUFFER_USAGE_TRANSFER_SRC_BIT); @@ -4265,12 +4265,12 @@ void StorageTexture::writeBackLayers(const std::vector& layers) { } return; } + original.resize(static_cast(guestBytes)); // The store below compares against the guest bytes, read now when `original` does not hold // them (a GPU clear, a dropped or kept unit). Reading them says nothing about the image: a // stale unit (dropped, or kept for the CPU) still differs from them, so `original` vouches for // the content again only where it did before, or once every unit is stored. const bool wasValid = originalValid; - original.resize(static_cast(guestBytes)); if (!wasValid) GuestMemory::ReadCommitted(descriptor.baseAddress, original); DeviceBuffer linear(context, static_cast(sliceLinearBytes * arrayLayers), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT); DeviceBuffer tiled(context, original.size(), VK_BUFFER_USAGE_STORAGE_BUFFER_BIT | VK_BUFFER_USAGE_TRANSFER_SRC_BIT | VK_BUFFER_USAGE_TRANSFER_DST_BIT);