mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2026-11-17 19:44:36 +01:00
Remove image ids from download_images on TextureCache::DeleteImage calls (#4719)
Also adds synchronization since erasing images will invalidate iterators (and trying to emplace mid-downloads could result in image downloads getting skipped)
This commit is contained in:
1 parent
bfc1a588c2
commit
0da2a58b84
2 files changed
+11
No files matched your search
@@ -61,6 +61,7 @@ TextureCache::TextureCache(const Vulkan::Instance& instance_, Vulkan::Scheduler&
|
||||
TextureCache::~TextureCache() = default;
|
||||
|
||||
void TextureCache::ProcessDownloadImages() {
|
||||
std::unique_lock lk{download_images_mutex};
|
||||
for (const ImageId image_id : download_images) {
|
||||
DownloadImageMemory(image_id, true);
|
||||
}
|
||||
@@ -622,6 +623,7 @@ ImageView& TextureCache::FindTexture(ImageId image_id, const ImageDesc& desc) {
|
||||
if (desc.type == BindingType::Storage) {
|
||||
image.flags |= ImageFlagBits::GpuModified;
|
||||
if (readback_linear_images && !image.info.props.is_tiled && image.info.guest_address != 0) {
|
||||
std::unique_lock lk{download_images_mutex};
|
||||
download_images.emplace(image_id);
|
||||
}
|
||||
}
|
||||
@@ -633,6 +635,7 @@ ImageView& TextureCache::FindRenderTarget(ImageId image_id, const ImageDesc& des
|
||||
Image& image = slot_images[image_id];
|
||||
image.flags |= ImageFlagBits::GpuModified;
|
||||
if (readback_linear_images && !image.info.props.is_tiled) {
|
||||
std::unique_lock lk{download_images_mutex};
|
||||
download_images.emplace(image_id);
|
||||
}
|
||||
image.usage.render_target = 1u;
|
||||
@@ -1080,6 +1083,13 @@ void TextureCache::DeleteImage(ImageId image_id) {
|
||||
surface_metas.erase(meta_info.htile_addr);
|
||||
}
|
||||
|
||||
{
|
||||
std::unique_lock lk{download_images_mutex};
|
||||
if (download_images.contains(image_id)) {
|
||||
download_images.erase(image_id);
|
||||
}
|
||||
}
|
||||
|
||||
// Reclaim image and any image views it references.
|
||||
scheduler.DeferOperation([this, image_id] {
|
||||
Image& image = slot_images[image_id];
|
||||
|
||||
@@ -337,6 +337,7 @@ private:
|
||||
PageTable page_table;
|
||||
std::mutex mutex;
|
||||
std::mutex samplers_mutex;
|
||||
std::mutex download_images_mutex;
|
||||
struct MetaDataInfo {
|
||||
enum class Type {
|
||||
CMask,
|
||||
|
||||
Reference in new issue
Block a user