Просмотр исходного кода

Texture Cache: Secure insertions against deletions.

Fernando Sahmkow 4 лет назад
Родитель
Сommit
5a3463bc2b
1 измененных файлов с 13 добавлено и 3 удалено
  1. 13 3
      src/video_core/texture_cache/texture_cache.h

+ 13 - 3
src/video_core/texture_cache/texture_cache.h

@@ -1137,8 +1137,11 @@ typename TextureCache<P>::BlitImages TextureCache<P>::GetBlitImages(
     } while (has_deleted_images);
     } while (has_deleted_images);
     if (GetFormatType(dst_info.format) != SurfaceType::ColorTexture) {
     if (GetFormatType(dst_info.format) != SurfaceType::ColorTexture) {
         // Make sure the images are depth and/or stencil textures.
         // Make sure the images are depth and/or stencil textures.
-        src_id = FindOrInsertImage(src_info, src_addr, RelaxedOptions{});
-        dst_id = FindOrInsertImage(dst_info, dst_addr, RelaxedOptions{});
+        do {
+            has_deleted_images = false;
+            src_id = FindOrInsertImage(src_info, src_addr, RelaxedOptions{});
+            dst_id = FindOrInsertImage(dst_info, dst_addr, RelaxedOptions{});
+        } while (has_deleted_images);
     }
     }
     return BlitImages{
     return BlitImages{
         .dst_id = dst_id,
         .dst_id = dst_id,
@@ -1196,7 +1199,14 @@ template <class P>
 ImageViewId TextureCache<P>::FindRenderTargetView(const ImageInfo& info, GPUVAddr gpu_addr,
 ImageViewId TextureCache<P>::FindRenderTargetView(const ImageInfo& info, GPUVAddr gpu_addr,
                                                   bool is_clear) {
                                                   bool is_clear) {
     const auto options = is_clear ? RelaxedOptions::Samples : RelaxedOptions{};
     const auto options = is_clear ? RelaxedOptions::Samples : RelaxedOptions{};
-    const ImageId image_id = FindOrInsertImage(info, gpu_addr, options);
+    ImageId image_id{};
+    bool delete_state = has_deleted_images;
+    do {
+        has_deleted_images = false;
+        image_id = FindOrInsertImage(info, gpu_addr, options);
+        delete_state |= has_deleted_images;
+    } while (has_deleted_images);
+    has_deleted_images = delete_state;
     if (!image_id) {
     if (!image_id) {
         return NULL_IMAGE_VIEW_ID;
         return NULL_IMAGE_VIEW_ID;
     }
     }