summaryrefslogtreecommitdiffstats
path: root/src/video_core/texture_cache
diff options
context:
space:
mode:
authorFernando Sahmkow <fsahmkow27@gmail.com>2023-04-23 21:37:13 +0200
committerFernando Sahmkow <fsahmkow27@gmail.com>2023-04-29 15:31:38 +0200
commit4bc5469f52157cd18e697120df40e40e32365e89 (patch)
tree43879297dd91ac1ab824010610e724c37ec3cb95 /src/video_core/texture_cache
parentAddress Feedback & Clang Format (diff)
downloadyuzu-4bc5469f52157cd18e697120df40e40e32365e89.tar
yuzu-4bc5469f52157cd18e697120df40e40e32365e89.tar.gz
yuzu-4bc5469f52157cd18e697120df40e40e32365e89.tar.bz2
yuzu-4bc5469f52157cd18e697120df40e40e32365e89.tar.lz
yuzu-4bc5469f52157cd18e697120df40e40e32365e89.tar.xz
yuzu-4bc5469f52157cd18e697120df40e40e32365e89.tar.zst
yuzu-4bc5469f52157cd18e697120df40e40e32365e89.zip
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() {
runtime.TickFrame();
critical_gc = 0;
++frame_tick;
+
+ if constexpr (IMPLEMENTS_ASYNC_DOWNLOADS) {
+ for (auto& buffer : async_buffers_death_ring) {
+ runtime.FreeDeferredStagingBuffer(buffer);
+ }
+ async_buffers_death_ring.clear();
+ }
}
template <class P>
@@ -688,10 +695,10 @@ void TextureCache<P>::CommitAsyncFlushes() {
}
uncommitted_async_buffers.emplace_back(download_map);
}
+ async_buffers.emplace_back(std::move(uncommitted_async_buffers));
+ uncommitted_async_buffers.clear();
}
committed_downloads.emplace_back(std::move(uncommitted_downloads));
- async_buffers.emplace_back(std::move(uncommitted_async_buffers));
- uncommitted_async_buffers.clear();
uncommitted_downloads.clear();
}
@@ -729,7 +736,7 @@ void TextureCache<P>::PopAsyncFlushes() {
}
}
for (auto& download_buffer : download_map) {
- runtime.FreeDeferredStagingBuffer(download_buffer);
+ async_buffers_death_ring.emplace_back(download_buffer);
}
committed_downloads.pop_front();
async_buffers.pop_front();
@@ -748,7 +755,7 @@ void TextureCache<P>::PopAsyncFlushes() {
auto download_map = runtime.DownloadStagingBuffer(total_size_bytes);
const size_t original_offset = download_map.offset;
for (const PendingDownload& download_info : download_ids) {
- if (download_info.is_swizzle) {
+ if (!download_info.is_swizzle) {
continue;
}
Image& image = slot_images[download_info.object_id];
@@ -761,7 +768,7 @@ void TextureCache<P>::PopAsyncFlushes() {
download_map.offset = original_offset;
std::span<u8> download_span = download_map.mapped_span;
for (const PendingDownload& download_info : download_ids) {
- if (download_info.is_swizzle) {
+ if (!download_info.is_swizzle) {
continue;
}
const ImageBase& image = slot_images[download_info.object_id];
@@ -887,10 +894,7 @@ void TextureCache<P>::DownloadImageIntoBuffer(typename TextureCache<P>::Image* i
};
image->DownloadMemory(buffers, buffer_offsets, copies);
} else {
- std::array buffers{
- buffer,
- };
- image->DownloadMemory(buffers, buffer_offset, copies);
+ image->DownloadMemory(buffer, buffer_offset, copies);
}
}
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:
std::deque<std::vector<PendingDownload>> committed_downloads;
std::vector<AsyncBuffer> uncommitted_async_buffers;
std::deque<std::vector<AsyncBuffer>> async_buffers;
+ std::deque<AsyncBuffer> async_buffers_death_ring;
struct LRUItemParams {
using ObjectType = ImageId;