summaryrefslogtreecommitdiff
path: root/src/video_core/texture_cache
diff options
context:
space:
mode:
Diffstat (limited to 'src/video_core/texture_cache')
-rw-r--r--src/video_core/texture_cache/texture_cache.h22
-rw-r--r--src/video_core/texture_cache/texture_cache_base.h1
2 files changed, 14 insertions, 9 deletions
diff --git a/src/video_core/texture_cache/texture_cache.h b/src/video_core/texture_cache/texture_cache.h
index 543ceb5aa..e601f8446 100644
--- a/src/video_core/texture_cache/texture_cache.h
+++ b/src/video_core/texture_cache/texture_cache.h
@@ -139,6 +139,13 @@ void TextureCache<P>::TickFrame() {
139 runtime.TickFrame(); 139 runtime.TickFrame();
140 critical_gc = 0; 140 critical_gc = 0;
141 ++frame_tick; 141 ++frame_tick;
142
143 if constexpr (IMPLEMENTS_ASYNC_DOWNLOADS) {
144 for (auto& buffer : async_buffers_death_ring) {
145 runtime.FreeDeferredStagingBuffer(buffer);
146 }
147 async_buffers_death_ring.clear();
148 }
142} 149}
143 150
144template <class P> 151template <class P>
@@ -688,10 +695,10 @@ void TextureCache<P>::CommitAsyncFlushes() {
688 } 695 }
689 uncommitted_async_buffers.emplace_back(download_map); 696 uncommitted_async_buffers.emplace_back(download_map);
690 } 697 }
698 async_buffers.emplace_back(std::move(uncommitted_async_buffers));
699 uncommitted_async_buffers.clear();
691 } 700 }
692 committed_downloads.emplace_back(std::move(uncommitted_downloads)); 701 committed_downloads.emplace_back(std::move(uncommitted_downloads));
693 async_buffers.emplace_back(std::move(uncommitted_async_buffers));
694 uncommitted_async_buffers.clear();
695 uncommitted_downloads.clear(); 702 uncommitted_downloads.clear();
696} 703}
697 704
@@ -729,7 +736,7 @@ void TextureCache<P>::PopAsyncFlushes() {
729 } 736 }
730 } 737 }
731 for (auto& download_buffer : download_map) { 738 for (auto& download_buffer : download_map) {
732 runtime.FreeDeferredStagingBuffer(download_buffer); 739 async_buffers_death_ring.emplace_back(download_buffer);
733 } 740 }
734 committed_downloads.pop_front(); 741 committed_downloads.pop_front();
735 async_buffers.pop_front(); 742 async_buffers.pop_front();
@@ -748,7 +755,7 @@ void TextureCache<P>::PopAsyncFlushes() {
748 auto download_map = runtime.DownloadStagingBuffer(total_size_bytes); 755 auto download_map = runtime.DownloadStagingBuffer(total_size_bytes);
749 const size_t original_offset = download_map.offset; 756 const size_t original_offset = download_map.offset;
750 for (const PendingDownload& download_info : download_ids) { 757 for (const PendingDownload& download_info : download_ids) {
751 if (download_info.is_swizzle) { 758 if (!download_info.is_swizzle) {
752 continue; 759 continue;
753 } 760 }
754 Image& image = slot_images[download_info.object_id]; 761 Image& image = slot_images[download_info.object_id];
@@ -761,7 +768,7 @@ void TextureCache<P>::PopAsyncFlushes() {
761 download_map.offset = original_offset; 768 download_map.offset = original_offset;
762 std::span<u8> download_span = download_map.mapped_span; 769 std::span<u8> download_span = download_map.mapped_span;
763 for (const PendingDownload& download_info : download_ids) { 770 for (const PendingDownload& download_info : download_ids) {
764 if (download_info.is_swizzle) { 771 if (!download_info.is_swizzle) {
765 continue; 772 continue;
766 } 773 }
767 const ImageBase& image = slot_images[download_info.object_id]; 774 const ImageBase& image = slot_images[download_info.object_id];
@@ -887,10 +894,7 @@ void TextureCache<P>::DownloadImageIntoBuffer(typename TextureCache<P>::Image* i
887 }; 894 };
888 image->DownloadMemory(buffers, buffer_offsets, copies); 895 image->DownloadMemory(buffers, buffer_offsets, copies);
889 } else { 896 } else {
890 std::array buffers{ 897 image->DownloadMemory(buffer, buffer_offset, copies);
891 buffer,
892 };
893 image->DownloadMemory(buffers, buffer_offset, copies);
894 } 898 }
895} 899}
896 900
diff --git a/src/video_core/texture_cache/texture_cache_base.h b/src/video_core/texture_cache/texture_cache_base.h
index bb9ddb70e..758b7e212 100644
--- a/src/video_core/texture_cache/texture_cache_base.h
+++ b/src/video_core/texture_cache/texture_cache_base.h
@@ -449,6 +449,7 @@ private:
449 std::deque<std::vector<PendingDownload>> committed_downloads; 449 std::deque<std::vector<PendingDownload>> committed_downloads;
450 std::vector<AsyncBuffer> uncommitted_async_buffers; 450 std::vector<AsyncBuffer> uncommitted_async_buffers;
451 std::deque<std::vector<AsyncBuffer>> async_buffers; 451 std::deque<std::vector<AsyncBuffer>> async_buffers;
452 std::deque<AsyncBuffer> async_buffers_death_ring;
452 453
453 struct LRUItemParams { 454 struct LRUItemParams {
454 using ObjectType = ImageId; 455 using ObjectType = ImageId;