diff options
| author | 2022-04-14 09:57:55 -0400 | |
|---|---|---|
| committer | 2022-04-14 10:46:48 -0400 | |
| commit | d4571b123d814272c4a7069cfe29ba8e957b1f10 (patch) | |
| tree | 342892cbeffbf88b46665619750b99ee09097147 | |
| parent | maxwell3d: add small_index_2 register (diff) | |
| download | yuzu-d4571b123d814272c4a7069cfe29ba8e957b1f10.tar.gz yuzu-d4571b123d814272c4a7069cfe29ba8e957b1f10.tar.xz yuzu-d4571b123d814272c4a7069cfe29ba8e957b1f10.zip | |
buffer_cache: cap vertex buffer sizes
Diffstat (limited to '')
| -rw-r--r-- | src/video_core/buffer_cache/buffer_cache.h | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/src/video_core/buffer_cache/buffer_cache.h b/src/video_core/buffer_cache/buffer_cache.h index 21bfb76a4..3f2bf6294 100644 --- a/src/video_core/buffer_cache/buffer_cache.h +++ b/src/video_core/buffer_cache/buffer_cache.h | |||
| @@ -1311,7 +1311,20 @@ void BufferCache<P>::UpdateVertexBuffer(u32 index) { | |||
| 1311 | const GPUVAddr gpu_addr_begin = array.StartAddress(); | 1311 | const GPUVAddr gpu_addr_begin = array.StartAddress(); |
| 1312 | const GPUVAddr gpu_addr_end = limit.LimitAddress() + 1; | 1312 | const GPUVAddr gpu_addr_end = limit.LimitAddress() + 1; |
| 1313 | const std::optional<VAddr> cpu_addr = gpu_memory.GpuToCpuAddress(gpu_addr_begin); | 1313 | const std::optional<VAddr> cpu_addr = gpu_memory.GpuToCpuAddress(gpu_addr_begin); |
| 1314 | const u32 address_size = static_cast<u32>(gpu_addr_end - gpu_addr_begin); | 1314 | u32 address_size = static_cast<u32>(gpu_addr_end - gpu_addr_begin); |
| 1315 | if (address_size >= 64_MiB) { | ||
| 1316 | // Reported vertex buffer size is very large, cap to mapped buffer size | ||
| 1317 | GPUVAddr submapped_addr_end = gpu_addr_begin; | ||
| 1318 | |||
| 1319 | const auto ranges{gpu_memory.GetSubmappedRange(gpu_addr_begin, address_size)}; | ||
| 1320 | if (ranges.size() > 0) { | ||
| 1321 | const auto& [addr, size] = *ranges.begin(); | ||
| 1322 | submapped_addr_end = addr + size; | ||
| 1323 | } | ||
| 1324 | |||
| 1325 | address_size = | ||
| 1326 | std::min(address_size, static_cast<u32>(submapped_addr_end - gpu_addr_begin)); | ||
| 1327 | } | ||
| 1315 | const u32 size = address_size; // TODO: Analyze stride and number of vertices | 1328 | const u32 size = address_size; // TODO: Analyze stride and number of vertices |
| 1316 | if (array.enable == 0 || size == 0 || !cpu_addr) { | 1329 | if (array.enable == 0 || size == 0 || !cpu_addr) { |
| 1317 | vertex_buffers[index] = NULL_BINDING; | 1330 | vertex_buffers[index] = NULL_BINDING; |