From c476d986f7de0d360e25b203af382e3c626c1116 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 3 May 2023 00:23:31 +0200 Subject: [PATCH 1/2] Bump the index/vertex cpu-side buffer sizes a little. Replaces #17387 --- GPU/Common/DrawEngineCommon.h | 8 ++++++-- GPU/Common/SplineCommon.cpp | 4 +++- GPU/Common/SplineCommon.h | 1 + 3 files changed, 10 insertions(+), 3 deletions(-) diff --git a/GPU/Common/DrawEngineCommon.h b/GPU/Common/DrawEngineCommon.h index 94ce1f35e7..34efe70d6c 100644 --- a/GPU/Common/DrawEngineCommon.h +++ b/GPU/Common/DrawEngineCommon.h @@ -30,10 +30,14 @@ class VertexDecoder; +// int maxVerts = DECODED_VERTEX_BUFFER_SIZE / 2 / vertexSize; =~ 54000 +// 65536 * 6 * 2 + + enum { VERTEX_BUFFER_MAX = 65536, - DECODED_VERTEX_BUFFER_SIZE = VERTEX_BUFFER_MAX * 64, - DECODED_INDEX_BUFFER_SIZE = VERTEX_BUFFER_MAX * 16, + DECODED_VERTEX_BUFFER_SIZE = VERTEX_BUFFER_MAX * 2 * 36, // 36 == sizeof(SimpleVertex) + DECODED_INDEX_BUFFER_SIZE = VERTEX_BUFFER_MAX * 6 * 6 * 2, // * 6 for spline tessellation, then * 6 again for converting into points/lines, and * 2 for 2 bytes per index }; enum { diff --git a/GPU/Common/SplineCommon.cpp b/GPU/Common/SplineCommon.cpp index 5e514b31d7..ce6fef470b 100644 --- a/GPU/Common/SplineCommon.cpp +++ b/GPU/Common/SplineCommon.cpp @@ -548,7 +548,9 @@ void DrawEngineCommon::SubmitCurve(const void *control_points, const void *indic output.indices = decIndex; output.count = 0; - surface.Init(DECODED_VERTEX_BUFFER_SIZE / 2 / vertexSize); + int maxVerts = DECODED_VERTEX_BUFFER_SIZE / 2 / vertexSize; + + surface.Init(maxVerts); if (CanUseHardwareTessellation(surface.primType)) { HardwareTessellation(output, surface, origVertType, points, tessDataTransfer); diff --git a/GPU/Common/SplineCommon.h b/GPU/Common/SplineCommon.h index f1a834b265..e3acec7a67 100644 --- a/GPU/Common/SplineCommon.h +++ b/GPU/Common/SplineCommon.h @@ -27,6 +27,7 @@ #define HALF_CEIL(x) (x + 1) / 2 // Integer ceil = (int)ceil((float)x / 2.0f) // PSP compatible format so we can use the end of the pipeline in beziers etc +// 8 + 4 + 12 + 12 = 36 bytes struct SimpleVertex { float uv[2]; union { From cee9d2bdd2a76841952b62c8bb65ac11b9b1303a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Wed, 3 May 2023 08:35:07 +0200 Subject: [PATCH 2/2] Delete outdated lines --- GPU/Common/DrawEngineCommon.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/GPU/Common/DrawEngineCommon.h b/GPU/Common/DrawEngineCommon.h index 34efe70d6c..23f42f8c1a 100644 --- a/GPU/Common/DrawEngineCommon.h +++ b/GPU/Common/DrawEngineCommon.h @@ -30,10 +30,6 @@ class VertexDecoder; -// int maxVerts = DECODED_VERTEX_BUFFER_SIZE / 2 / vertexSize; =~ 54000 -// 65536 * 6 * 2 - - enum { VERTEX_BUFFER_MAX = 65536, DECODED_VERTEX_BUFFER_SIZE = VERTEX_BUFFER_MAX * 2 * 36, // 36 == sizeof(SimpleVertex)