summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorLiam <byteslice@airmail.cc>2022-04-14 15:57:55 +0200
committerLiam <byteslice@airmail.cc>2022-04-14 16:46:48 +0200
commitd4571b123d814272c4a7069cfe29ba8e957b1f10 (patch)
tree342892cbeffbf88b46665619750b99ee09097147 /src
parentmaxwell3d: add small_index_2 register (diff)
downloadyuzu-d4571b123d814272c4a7069cfe29ba8e957b1f10.tar
yuzu-d4571b123d814272c4a7069cfe29ba8e957b1f10.tar.gz
yuzu-d4571b123d814272c4a7069cfe29ba8e957b1f10.tar.bz2
yuzu-d4571b123d814272c4a7069cfe29ba8e957b1f10.tar.lz
yuzu-d4571b123d814272c4a7069cfe29ba8e957b1f10.tar.xz
yuzu-d4571b123d814272c4a7069cfe29ba8e957b1f10.tar.zst
yuzu-d4571b123d814272c4a7069cfe29ba8e957b1f10.zip
Diffstat (limited to 'src')
-rw-r--r--src/video_core/buffer_cache/buffer_cache.h15
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) {
const GPUVAddr gpu_addr_begin = array.StartAddress();
const GPUVAddr gpu_addr_end = limit.LimitAddress() + 1;
const std::optional<VAddr> cpu_addr = gpu_memory.GpuToCpuAddress(gpu_addr_begin);
- const u32 address_size = static_cast<u32>(gpu_addr_end - gpu_addr_begin);
+ u32 address_size = static_cast<u32>(gpu_addr_end - gpu_addr_begin);
+ if (address_size >= 64_MiB) {
+ // Reported vertex buffer size is very large, cap to mapped buffer size
+ GPUVAddr submapped_addr_end = gpu_addr_begin;
+
+ const auto ranges{gpu_memory.GetSubmappedRange(gpu_addr_begin, address_size)};
+ if (ranges.size() > 0) {
+ const auto& [addr, size] = *ranges.begin();
+ submapped_addr_end = addr + size;
+ }
+
+ address_size =
+ std::min(address_size, static_cast<u32>(submapped_addr_end - gpu_addr_begin));
+ }
const u32 size = address_size; // TODO: Analyze stride and number of vertices
if (array.enable == 0 || size == 0 || !cpu_addr) {
vertex_buffers[index] = NULL_BINDING;