diff options
Diffstat (limited to '')
| -rw-r--r-- | src/video_core/buffer_cache/buffer_cache.h | 28 | ||||
| -rw-r--r-- | src/video_core/buffer_cache/buffer_cache_base.h | 6 |
2 files changed, 22 insertions, 12 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 8fed08dab..e5c626c36 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h | |||
| @@ -22,7 +22,7 @@ BufferCache<P>::BufferCache(VideoCore::RasterizerInterface& rasterizer_, | |||
| 22 | void(slot_buffers.insert(runtime, NullBufferParams{})); | 22 | void(slot_buffers.insert(runtime, NullBufferParams{})); |
| 23 | common_ranges.clear(); | 23 | common_ranges.clear(); |
| 24 | 24 | ||
| 25 | active_async_buffers = IMPLEMENTS_ASYNC_DOWNLOADS && !Settings::IsGPULevelHigh(); | 25 | active_async_buffers = !Settings::IsGPULevelHigh(); |
| 26 | 26 | ||
| 27 | if (!runtime.CanReportMemoryUsage()) { | 27 | if (!runtime.CanReportMemoryUsage()) { |
| 28 | minimum_memory = DEFAULT_EXPECTED_MEMORY; | 28 | minimum_memory = DEFAULT_EXPECTED_MEMORY; |
| @@ -74,7 +74,7 @@ void BufferCache<P>::TickFrame() { | |||
| 74 | uniform_cache_hits[0] = 0; | 74 | uniform_cache_hits[0] = 0; |
| 75 | uniform_cache_shots[0] = 0; | 75 | uniform_cache_shots[0] = 0; |
| 76 | 76 | ||
| 77 | active_async_buffers = IMPLEMENTS_ASYNC_DOWNLOADS && !Settings::IsGPULevelHigh(); | 77 | active_async_buffers = !Settings::IsGPULevelHigh(); |
| 78 | 78 | ||
| 79 | const bool skip_preferred = hits * 256 < shots * 251; | 79 | const bool skip_preferred = hits * 256 < shots * 251; |
| 80 | uniform_buffer_skip_cache_size = skip_preferred ? DEFAULT_SKIP_CACHE_SIZE : 0; | 80 | uniform_buffer_skip_cache_size = skip_preferred ? DEFAULT_SKIP_CACHE_SIZE : 0; |
| @@ -88,6 +88,13 @@ void BufferCache<P>::TickFrame() { | |||
| 88 | } | 88 | } |
| 89 | ++frame_tick; | 89 | ++frame_tick; |
| 90 | delayed_destruction_ring.Tick(); | 90 | delayed_destruction_ring.Tick(); |
| 91 | |||
| 92 | if constexpr (IMPLEMENTS_ASYNC_DOWNLOADS) { | ||
| 93 | for (auto& buffer : async_buffers_death_ring) { | ||
| 94 | runtime.FreeDeferredStagingBuffer(buffer); | ||
| 95 | } | ||
| 96 | async_buffers_death_ring.clear(); | ||
| 97 | } | ||
| 91 | } | 98 | } |
| 92 | 99 | ||
| 93 | template <class P> | 100 | template <class P> |
| @@ -468,8 +475,10 @@ void BufferCache<P>::CommitAsyncFlushesHigh() { | |||
| 468 | AccumulateFlushes(); | 475 | AccumulateFlushes(); |
| 469 | 476 | ||
| 470 | if (committed_ranges.empty()) { | 477 | if (committed_ranges.empty()) { |
| 471 | if (active_async_buffers) { | 478 | if constexpr (IMPLEMENTS_ASYNC_DOWNLOADS) { |
| 472 | async_buffers.emplace_back(std::optional<Async_Buffer>{}); | 479 | if (active_async_buffers) { |
| 480 | async_buffers.emplace_back(std::optional<Async_Buffer>{}); | ||
| 481 | } | ||
| 473 | } | 482 | } |
| 474 | return; | 483 | return; |
| 475 | } | 484 | } |
| @@ -529,8 +538,10 @@ void BufferCache<P>::CommitAsyncFlushesHigh() { | |||
| 529 | } | 538 | } |
| 530 | committed_ranges.clear(); | 539 | committed_ranges.clear(); |
| 531 | if (downloads.empty()) { | 540 | if (downloads.empty()) { |
| 532 | if (active_async_buffers) { | 541 | if constexpr (IMPLEMENTS_ASYNC_DOWNLOADS) { |
| 533 | async_buffers.emplace_back(std::optional<Async_Buffer>{}); | 542 | if (active_async_buffers) { |
| 543 | async_buffers.emplace_back(std::optional<Async_Buffer>{}); | ||
| 544 | } | ||
| 534 | } | 545 | } |
| 535 | return; | 546 | return; |
| 536 | } | 547 | } |
| @@ -555,6 +566,9 @@ void BufferCache<P>::CommitAsyncFlushesHigh() { | |||
| 555 | runtime.PostCopyBarrier(); | 566 | runtime.PostCopyBarrier(); |
| 556 | pending_downloads.emplace_back(std::move(normalized_copies)); | 567 | pending_downloads.emplace_back(std::move(normalized_copies)); |
| 557 | async_buffers.emplace_back(download_staging); | 568 | async_buffers.emplace_back(download_staging); |
| 569 | } else { | ||
| 570 | committed_ranges.clear(); | ||
| 571 | uncommitted_ranges.clear(); | ||
| 558 | } | 572 | } |
| 559 | } else { | 573 | } else { |
| 560 | if constexpr (USE_MEMORY_MAPS) { | 574 | if constexpr (USE_MEMORY_MAPS) { |
| @@ -629,7 +643,7 @@ void BufferCache<P>::PopAsyncBuffers() { | |||
| 629 | const IntervalType subtract_interval{cpu_addr, cpu_addr + copy.size}; | 643 | const IntervalType subtract_interval{cpu_addr, cpu_addr + copy.size}; |
| 630 | RemoveEachInOverlapCounter(async_downloads, subtract_interval, -1); | 644 | RemoveEachInOverlapCounter(async_downloads, subtract_interval, -1); |
| 631 | } | 645 | } |
| 632 | runtime.FreeDeferredStagingBuffer(*async_buffer); | 646 | async_buffers_death_ring.emplace_back(*async_buffer); |
| 633 | async_buffers.pop_front(); | 647 | async_buffers.pop_front(); |
| 634 | pending_downloads.pop_front(); | 648 | pending_downloads.pop_front(); |
| 635 | } | 649 | } |
diff --git a/src/video_core/buffer_cache/buffer_cache_base.h b/src/video_core/buffer_cache/buffer_cache_base.h index acff22d4f..75cb98ba3 100644 --- a/src/video_core/buffer_cache/buffer_cache_base.h +++ b/src/video_core/buffer_cache/buffer_cache_base.h | |||
| @@ -554,11 +554,7 @@ private: | |||
| 554 | std::deque<boost::container::small_vector<BufferCopy, 4>> pending_downloads; | 554 | std::deque<boost::container::small_vector<BufferCopy, 4>> pending_downloads; |
| 555 | std::optional<Async_Buffer> current_buffer; | 555 | std::optional<Async_Buffer> current_buffer; |
| 556 | 556 | ||
| 557 | // queries | 557 | std::deque<Async_Buffer> async_buffers_death_ring; |
| 558 | boost::container::small_vector<std::pair<VAddr, size_t>, 8> pending_queries; | ||
| 559 | std::deque<boost::container::small_vector<BufferCopy, 8>> committed_queries; | ||
| 560 | boost::container::small_vector<u64, 8> flushed_queries; | ||
| 561 | std::deque<std::optional<Async_Buffer>> query_async_buffers; | ||
| 562 | 558 | ||
| 563 | size_t immediate_buffer_capacity = 0; | 559 | size_t immediate_buffer_capacity = 0; |
| 564 | Common::ScratchBuffer<u8> immediate_buffer_alloc; | 560 | Common::ScratchBuffer<u8> immediate_buffer_alloc; |