fix(agc): avoid storage snapshot overlap
Create uploads before publishing snapshot validity. Keep allocation edits separate from the per-unit validity changes in #5024.
This commit is contained in:
parent
3f314030b4
commit
0612c181ff
|
|
@ -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;
|
||||
|
|
|
|||
|
|
@ -2144,9 +2144,9 @@ void StorageTexture::upload(const std::vector<bool>* layers) {
|
|||
return;
|
||||
}
|
||||
originalValid = true;
|
||||
original.resize(static_cast<std::size_t>(guestBytes));
|
||||
forgetBorrowed(0, trackedLayers);
|
||||
stampLayers(false);
|
||||
original.resize(static_cast<std::size_t>(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<bool>& layers) {
|
|||
}
|
||||
return;
|
||||
}
|
||||
original.resize(static_cast<std::size_t>(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<std::size_t>(guestBytes));
|
||||
if (!wasValid) GuestMemory::ReadCommitted(descriptor.baseAddress, original);
|
||||
DeviceBuffer linear(context, static_cast<std::size_t>(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);
|
||||
|
|
|
|||
Loading…
Reference in New Issue