diff options
| author | 2023-09-11 02:54:32 +0100 | |
|---|---|---|
| committer | 2023-09-11 03:11:29 +0100 | |
| commit | baad1238c3e111551e4012c56772d0068397ccd0 (patch) | |
| tree | 6c3eb608c832d6a303a9f371a9bdc6a6cb9e15df /src/video_core/texture_cache | |
| parent | Merge pull request #11450 from lat9nq/no-vk-device-fix (diff) | |
| download | yuzu-baad1238c3e111551e4012c56772d0068397ccd0.tar.gz yuzu-baad1238c3e111551e4012c56772d0068397ccd0.tar.xz yuzu-baad1238c3e111551e4012c56772d0068397ccd0.zip | |
Look for the most recently modified image for present
Diffstat (limited to 'src/video_core/texture_cache')
| -rw-r--r-- | src/video_core/texture_cache/texture_cache.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h index 4457b366f..1bdb0def5 100644 --- a/src/video_core/texture_cache/texture_cache.h +++ b/src/video_core/texture_cache/texture_cache.h | |||
| @@ -719,6 +719,7 @@ typename P::ImageView* TextureCache<P>::TryFindFramebufferImageView(VAddr cpu_ad | |||
| 719 | return nullptr; | 719 | return nullptr; |
| 720 | } | 720 | } |
| 721 | const auto& image_map_ids = it->second; | 721 | const auto& image_map_ids = it->second; |
| 722 | boost::container::small_vector<const ImageBase*, 4> valid_images; | ||
| 722 | for (const ImageMapId map_id : image_map_ids) { | 723 | for (const ImageMapId map_id : image_map_ids) { |
| 723 | const ImageMapView& map = slot_map_views[map_id]; | 724 | const ImageMapView& map = slot_map_views[map_id]; |
| 724 | const ImageBase& image = slot_images[map.image_id]; | 725 | const ImageBase& image = slot_images[map.image_id]; |
| @@ -728,8 +729,20 @@ typename P::ImageView* TextureCache<P>::TryFindFramebufferImageView(VAddr cpu_ad | |||
| 728 | if (image.image_view_ids.empty()) { | 729 | if (image.image_view_ids.empty()) { |
| 729 | continue; | 730 | continue; |
| 730 | } | 731 | } |
| 731 | return &slot_image_views[image.image_view_ids.at(0)]; | 732 | valid_images.push_back(&image); |
| 732 | } | 733 | } |
| 734 | |||
| 735 | if (valid_images.size() == 1) [[likely]] { | ||
| 736 | return &slot_image_views[valid_images[0]->image_view_ids.at(0)]; | ||
| 737 | } | ||
| 738 | |||
| 739 | if (valid_images.size() > 0) [[unlikely]] { | ||
| 740 | std::ranges::sort(valid_images, [](const auto* a, const auto* b) { | ||
| 741 | return a->modification_tick > b->modification_tick; | ||
| 742 | }); | ||
| 743 | return &slot_image_views[valid_images[0]->image_view_ids.at(0)]; | ||
| 744 | } | ||
| 745 | |||
| 733 | return nullptr; | 746 | return nullptr; |
| 734 | } | 747 | } |
| 735 | 748 | ||