mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-07-11 01:24:28 +02:00
Avoid storing lambda as a local variable (#4687)
Parameters to the TryWriteBacking call were getting corrupted during async texture downloads after #4593
This commit is contained in:
@@ -124,16 +124,16 @@ void TextureCache::DownloadImageMemory(ImageId image_id, bool sync) {
|
|||||||
cmdbuf.copyImageToBuffer(image.GetImage(), vk::ImageLayout::eTransferSrcOptimal,
|
cmdbuf.copyImageToBuffer(image.GetImage(), vk::ImageLayout::eTransferSrcOptimal,
|
||||||
download_buffer.Handle(), image_download);
|
download_buffer.Handle(), image_download);
|
||||||
|
|
||||||
const auto write_data = [this, device_addr = image.info.guest_address, download,
|
|
||||||
download_size] {
|
|
||||||
Core::Memory::Instance()->TryWriteBacking(std::bit_cast<u8*>(device_addr), download,
|
|
||||||
download_size);
|
|
||||||
};
|
|
||||||
if (sync) {
|
if (sync) {
|
||||||
scheduler.Finish();
|
scheduler.Finish();
|
||||||
write_data();
|
Core::Memory::Instance()->TryWriteBacking(std::bit_cast<u8*>(image.info.guest_address),
|
||||||
|
download, download_size);
|
||||||
} else {
|
} else {
|
||||||
scheduler.DeferPriorityOperation(write_data);
|
scheduler.DeferPriorityOperation(
|
||||||
|
[this, device_addr = image.info.guest_address, download, download_size] {
|
||||||
|
Core::Memory::Instance()->TryWriteBacking(std::bit_cast<u8*>(device_addr), download,
|
||||||
|
download_size);
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user