summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorliamwhite <liamwhite@users.noreply.github.com>2023-09-02 20:42:28 +0200
committerGitHub <noreply@github.com>2023-09-02 20:42:28 +0200
commit84eb1cdb654b6724f69cfeeb4546d4ee6ff860f5 (patch)
treee3b0627bcdde3ddcc1a38ab563d4f0c85d278067 /src
parentMerge pull request #11412 from liamwhite/key-area-keys (diff)
parentMaxwell3D: Improve Index buffer size estimation. (diff)
downloadyuzu-84eb1cdb654b6724f69cfeeb4546d4ee6ff860f5.tar
yuzu-84eb1cdb654b6724f69cfeeb4546d4ee6ff860f5.tar.gz
yuzu-84eb1cdb654b6724f69cfeeb4546d4ee6ff860f5.tar.bz2
yuzu-84eb1cdb654b6724f69cfeeb4546d4ee6ff860f5.tar.lz
yuzu-84eb1cdb654b6724f69cfeeb4546d4ee6ff860f5.tar.xz
yuzu-84eb1cdb654b6724f69cfeeb4546d4ee6ff860f5.tar.zst
yuzu-84eb1cdb654b6724f69cfeeb4546d4ee6ff860f5.zip
Diffstat (limited to '')
-rw-r--r--src/video_core/engines/maxwell_3d.cpp6
1 files changed, 5 insertions, 1 deletions
diff --git a/src/video_core/engines/maxwell_3d.cpp b/src/video_core/engines/maxwell_3d.cpp
index c3696096d..06e349e43 100644
--- a/src/video_core/engines/maxwell_3d.cpp
+++ b/src/video_core/engines/maxwell_3d.cpp
@@ -257,6 +257,7 @@ u32 Maxwell3D::GetMaxCurrentVertices() {
const u32 address_size = static_cast<u32>(gpu_addr_end - gpu_addr_begin);
num_vertices = std::max(
num_vertices, address_size / std::max(attribute.SizeInBytes(), array.stride.Value()));
+ break;
}
return num_vertices;
}
@@ -269,10 +270,13 @@ size_t Maxwell3D::EstimateIndexBufferSize() {
std::numeric_limits<u32>::max()};
const size_t byte_size = regs.index_buffer.FormatSizeInBytes();
const size_t log2_byte_size = Common::Log2Ceil64(byte_size);
+ const size_t cap{GetMaxCurrentVertices() * 3 * byte_size};
+ const size_t lower_cap =
+ std::min<size_t>(static_cast<size_t>(end_address - start_address), cap);
return std::min<size_t>(
memory_manager.GetMemoryLayoutSize(start_address, byte_size * max_sizes[log2_byte_size]) /
byte_size,
- static_cast<size_t>(end_address - start_address));
+ lower_cap);
}
u32 Maxwell3D::ProcessShadowRam(u32 method, u32 argument) {