From a58b68735235f664828aecf069e84dc0461ebf9c Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Sun, 15 Sep 2019 01:13:23 +1000 Subject: [PATCH] GPU: Cap batch sizes at 1024 vertices, flush if exceeded --- src/pse/gpu_hw.cpp | 7 +++++-- src/pse/gpu_hw.h | 2 ++ 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/pse/gpu_hw.cpp b/src/pse/gpu_hw.cpp index 023510254..60f1e8145 100644 --- a/src/pse/gpu_hw.cpp +++ b/src/pse/gpu_hw.cpp @@ -377,8 +377,11 @@ void GPU_HW::DispatchRenderCommand(RenderCommand rc, u32 num_vertices) } // flush when the command changes - if (!m_batch_vertices.empty() && m_batch_command.bits != rc.bits) - FlushRender(); + if (!m_batch_vertices.empty()) + { + if (m_batch_vertices.size() >= MAX_BATCH_VERTEX_COUNT || m_batch_command.bits != rc.bits) + FlushRender(); + } m_batch_command = rc; LoadVertices(rc, num_vertices); diff --git a/src/pse/gpu_hw.h b/src/pse/gpu_hw.h index 32225f73c..a84c3a99e 100644 --- a/src/pse/gpu_hw.h +++ b/src/pse/gpu_hw.h @@ -11,6 +11,8 @@ public: virtual ~GPU_HW(); protected: + static constexpr u32 MAX_BATCH_VERTEX_COUNT = 1024; + struct HWVertex { s32 x;