diff options
Diffstat (limited to '')
| -rw-r--r-- | src/video_core/buffer_cache/buffer_cache.h | 29 | ||||
| -rw-r--r-- | src/video_core/buffer_cache/buffer_cache_base.h | 3 |
2 files changed, 4 insertions, 28 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index fff57ffa9..98756e4da 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h | |||
| @@ -131,33 +131,15 @@ std::optional<VideoCore::RasterizerDownloadArea> BufferCache<P>::GetFlushArea(VA | |||
| 131 | 131 | ||
| 132 | template <class P> | 132 | template <class P> |
| 133 | void BufferCache<P>::DownloadMemory(VAddr cpu_addr, u64 size) { | 133 | void BufferCache<P>::DownloadMemory(VAddr cpu_addr, u64 size) { |
| 134 | WaitOnAsyncFlushes(cpu_addr, size); | ||
| 135 | ForEachBufferInRange(cpu_addr, size, [&](BufferId, Buffer& buffer) { | 134 | ForEachBufferInRange(cpu_addr, size, [&](BufferId, Buffer& buffer) { |
| 136 | DownloadBufferMemory(buffer, cpu_addr, size); | 135 | DownloadBufferMemory(buffer, cpu_addr, size); |
| 137 | }); | 136 | }); |
| 138 | } | 137 | } |
| 139 | 138 | ||
| 140 | template <class P> | 139 | template <class P> |
| 141 | void BufferCache<P>::WaitOnAsyncFlushes(VAddr cpu_addr, u64 size) { | ||
| 142 | bool must_wait = false; | ||
| 143 | ForEachInOverlapCounter(async_downloads, cpu_addr, size, | ||
| 144 | [&](VAddr, VAddr, int) { must_wait = true; }); | ||
| 145 | bool must_release = false; | ||
| 146 | ForEachInRangeSet(pending_ranges, cpu_addr, size, [&](VAddr, VAddr) { must_release = true; }); | ||
| 147 | if (must_release) { | ||
| 148 | std::function<void()> tmp([]() {}); | ||
| 149 | rasterizer.SignalFence(std::move(tmp)); | ||
| 150 | } | ||
| 151 | if (must_wait || must_release) { | ||
| 152 | rasterizer.ReleaseFences(); | ||
| 153 | } | ||
| 154 | } | ||
| 155 | |||
| 156 | template <class P> | ||
| 157 | void BufferCache<P>::ClearDownload(IntervalType subtract_interval) { | 140 | void BufferCache<P>::ClearDownload(IntervalType subtract_interval) { |
| 158 | RemoveEachInOverlapCounter(async_downloads, subtract_interval, -1024); | 141 | RemoveEachInOverlapCounter(async_downloads, subtract_interval, -1024); |
| 159 | uncommitted_ranges.subtract(subtract_interval); | 142 | uncommitted_ranges.subtract(subtract_interval); |
| 160 | pending_ranges.subtract(subtract_interval); | ||
| 161 | for (auto& interval_set : committed_ranges) { | 143 | for (auto& interval_set : committed_ranges) { |
| 162 | interval_set.subtract(subtract_interval); | 144 | interval_set.subtract(subtract_interval); |
| 163 | } | 145 | } |
| @@ -177,7 +159,6 @@ bool BufferCache<P>::DMACopy(GPUVAddr src_address, GPUVAddr dest_address, u64 am | |||
| 177 | } | 159 | } |
| 178 | 160 | ||
| 179 | const IntervalType subtract_interval{*cpu_dest_address, *cpu_dest_address + amount}; | 161 | const IntervalType subtract_interval{*cpu_dest_address, *cpu_dest_address + amount}; |
| 180 | WaitOnAsyncFlushes(*cpu_src_address, static_cast<u32>(amount)); | ||
| 181 | ClearDownload(subtract_interval); | 162 | ClearDownload(subtract_interval); |
| 182 | 163 | ||
| 183 | BufferId buffer_a; | 164 | BufferId buffer_a; |
| @@ -205,7 +186,6 @@ bool BufferCache<P>::DMACopy(GPUVAddr src_address, GPUVAddr dest_address, u64 am | |||
| 205 | const IntervalType add_interval{new_base_address, new_base_address + size}; | 186 | const IntervalType add_interval{new_base_address, new_base_address + size}; |
| 206 | tmp_intervals.push_back(add_interval); | 187 | tmp_intervals.push_back(add_interval); |
| 207 | uncommitted_ranges.add(add_interval); | 188 | uncommitted_ranges.add(add_interval); |
| 208 | pending_ranges.add(add_interval); | ||
| 209 | }; | 189 | }; |
| 210 | ForEachInRangeSet(common_ranges, *cpu_src_address, amount, mirror); | 190 | ForEachInRangeSet(common_ranges, *cpu_src_address, amount, mirror); |
| 211 | // This subtraction in this order is important for overlapping copies. | 191 | // This subtraction in this order is important for overlapping copies. |
| @@ -492,7 +472,6 @@ void BufferCache<P>::CommitAsyncFlushesHigh() { | |||
| 492 | } | 472 | } |
| 493 | MICROPROFILE_SCOPE(GPU_DownloadMemory); | 473 | MICROPROFILE_SCOPE(GPU_DownloadMemory); |
| 494 | 474 | ||
| 495 | pending_ranges.clear(); | ||
| 496 | auto it = committed_ranges.begin(); | 475 | auto it = committed_ranges.begin(); |
| 497 | while (it != committed_ranges.end()) { | 476 | while (it != committed_ranges.end()) { |
| 498 | auto& current_intervals = *it; | 477 | auto& current_intervals = *it; |
| @@ -1232,7 +1211,6 @@ void BufferCache<P>::MarkWrittenBuffer(BufferId buffer_id, VAddr cpu_addr, u32 s | |||
| 1232 | const IntervalType base_interval{cpu_addr, cpu_addr + size}; | 1211 | const IntervalType base_interval{cpu_addr, cpu_addr + size}; |
| 1233 | common_ranges.add(base_interval); | 1212 | common_ranges.add(base_interval); |
| 1234 | uncommitted_ranges.add(base_interval); | 1213 | uncommitted_ranges.add(base_interval); |
| 1235 | pending_ranges.add(base_interval); | ||
| 1236 | } | 1214 | } |
| 1237 | 1215 | ||
| 1238 | template <class P> | 1216 | template <class P> |
| @@ -1677,14 +1655,15 @@ typename BufferCache<P>::Binding BufferCache<P>::StorageBufferBinding(GPUVAddr s | |||
| 1677 | const bool is_nvn_cbuf = cbuf_index == 0; | 1655 | const bool is_nvn_cbuf = cbuf_index == 0; |
| 1678 | // The NVN driver buffer (index 0) is known to pack the SSBO address followed by its size. | 1656 | // The NVN driver buffer (index 0) is known to pack the SSBO address followed by its size. |
| 1679 | if (is_nvn_cbuf) { | 1657 | if (is_nvn_cbuf) { |
| 1680 | return gpu_memory->Read<u32>(ssbo_addr + 8); | 1658 | const u32 ssbo_size = gpu_memory->Read<u32>(ssbo_addr + 8); |
| 1659 | if (ssbo_size != 0) { | ||
| 1660 | return ssbo_size; | ||
| 1661 | } | ||
| 1681 | } | 1662 | } |
| 1682 | // Other titles (notably Doom Eternal) may use STG/LDG on buffer addresses in custom defined | 1663 | // Other titles (notably Doom Eternal) may use STG/LDG on buffer addresses in custom defined |
| 1683 | // cbufs, which do not store the sizes adjacent to the addresses, so use the fully | 1664 | // cbufs, which do not store the sizes adjacent to the addresses, so use the fully |
| 1684 | // mapped buffer size for now. | 1665 | // mapped buffer size for now. |
| 1685 | const u32 memory_layout_size = static_cast<u32>(gpu_memory->GetMemoryLayoutSize(gpu_addr)); | 1666 | const u32 memory_layout_size = static_cast<u32>(gpu_memory->GetMemoryLayoutSize(gpu_addr)); |
| 1686 | LOG_INFO(HW_GPU, "Binding storage buffer for cbuf index {}, MemoryLayoutSize 0x{:X}", | ||
| 1687 | cbuf_index, memory_layout_size); | ||
| 1688 | return memory_layout_size; | 1667 | return memory_layout_size; |
| 1689 | }(); | 1668 | }(); |
| 1690 | const std::optional<VAddr> cpu_addr = gpu_memory->GpuToCpuAddress(gpu_addr); | 1669 | const std::optional<VAddr> cpu_addr = gpu_memory->GpuToCpuAddress(gpu_addr); |
diff --git a/src/video_core/buffer_cache/buffer_cache_base.h b/src/video_core/buffer_cache/buffer_cache_base.h index 0445ec47f..ac00d4d9d 100644 --- a/src/video_core/buffer_cache/buffer_cache_base.h +++ b/src/video_core/buffer_cache/buffer_cache_base.h | |||
| @@ -381,8 +381,6 @@ private: | |||
| 381 | 381 | ||
| 382 | void RunGarbageCollector(); | 382 | void RunGarbageCollector(); |
| 383 | 383 | ||
| 384 | void WaitOnAsyncFlushes(VAddr cpu_addr, u64 size); | ||
| 385 | |||
| 386 | void BindHostIndexBuffer(); | 384 | void BindHostIndexBuffer(); |
| 387 | 385 | ||
| 388 | void BindHostVertexBuffers(); | 386 | void BindHostVertexBuffers(); |
| @@ -547,7 +545,6 @@ private: | |||
| 547 | IntervalSet uncommitted_ranges; | 545 | IntervalSet uncommitted_ranges; |
| 548 | IntervalSet common_ranges; | 546 | IntervalSet common_ranges; |
| 549 | IntervalSet cached_ranges; | 547 | IntervalSet cached_ranges; |
| 550 | IntervalSet pending_ranges; | ||
| 551 | std::deque<IntervalSet> committed_ranges; | 548 | std::deque<IntervalSet> committed_ranges; |
| 552 | 549 | ||
| 553 | // Async Buffers | 550 | // Async Buffers |