Texture Cache: Secure insertions against deletions.

This commit is contained in:
Fernando Sahmkow 2021-11-27 23:49:56 +01:00
parent ecefc932e6
commit 5a3463bc2b
1 changed files with 13 additions and 3 deletions

View File

@ -1137,8 +1137,11 @@ typename TextureCache<P>::BlitImages TextureCache<P>::GetBlitImages(
} while (has_deleted_images);
if (GetFormatType(dst_info.format) != SurfaceType::ColorTexture) {
// 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{
.dst_id = dst_id,
@ -1196,7 +1199,14 @@ template <class P>
ImageViewId TextureCache<P>::FindRenderTargetView(const ImageInfo& info, GPUVAddr gpu_addr,
bool is_clear) {
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) {
return NULL_IMAGE_VIEW_ID;
}