From e5dbdba6385aaf2ec4d1a660dc85119569300718 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 18 Dec 2022 07:14:19 -0800 Subject: [PATCH 1/2] GPU: Keep prevPrim_ set on flush. For continuing previous verts, see #16612. We still don't handle these quite accurately (outside software rendering), but this should be better. --- GPU/D3D11/DrawEngineD3D11.cpp | 1 - GPU/Directx9/DrawEngineDX9.cpp | 1 - GPU/GLES/DrawEngineGLES.cpp | 1 - GPU/Vulkan/DrawEngineVulkan.cpp | 1 - 4 files changed, 4 deletions(-) diff --git a/GPU/D3D11/DrawEngineD3D11.cpp b/GPU/D3D11/DrawEngineD3D11.cpp index ce6c3cfec612..196c8b8399bd 100644 --- a/GPU/D3D11/DrawEngineD3D11.cpp +++ b/GPU/D3D11/DrawEngineD3D11.cpp @@ -732,7 +732,6 @@ void DrawEngineD3D11::DoFlush() { vertexCountInDrawCalls_ = 0; decodeCounter_ = 0; dcid_ = 0; - prevPrim_ = GE_PRIM_INVALID; gstate_c.vertexFullAlpha = true; framebufferManager_->SetColorUpdated(gstate_c.skipDrawReason); diff --git a/GPU/Directx9/DrawEngineDX9.cpp b/GPU/Directx9/DrawEngineDX9.cpp index c1123b05d5c1..aa3f61455b7e 100644 --- a/GPU/Directx9/DrawEngineDX9.cpp +++ b/GPU/Directx9/DrawEngineDX9.cpp @@ -674,7 +674,6 @@ void DrawEngineDX9::DoFlush() { vertexCountInDrawCalls_ = 0; decodeCounter_ = 0; dcid_ = 0; - prevPrim_ = GE_PRIM_INVALID; gstate_c.vertexFullAlpha = true; framebufferManager_->SetColorUpdated(gstate_c.skipDrawReason); diff --git a/GPU/GLES/DrawEngineGLES.cpp b/GPU/GLES/DrawEngineGLES.cpp index ebdf4051b447..9efb65180029 100644 --- a/GPU/GLES/DrawEngineGLES.cpp +++ b/GPU/GLES/DrawEngineGLES.cpp @@ -474,7 +474,6 @@ void DrawEngineGLES::DoFlush() { vertexCountInDrawCalls_ = 0; decodeCounter_ = 0; dcid_ = 0; - prevPrim_ = GE_PRIM_INVALID; gstate_c.vertexFullAlpha = true; framebufferManager_->SetColorUpdated(gstate_c.skipDrawReason); diff --git a/GPU/Vulkan/DrawEngineVulkan.cpp b/GPU/Vulkan/DrawEngineVulkan.cpp index e500920015e8..881c54cc938e 100644 --- a/GPU/Vulkan/DrawEngineVulkan.cpp +++ b/GPU/Vulkan/DrawEngineVulkan.cpp @@ -991,7 +991,6 @@ void DrawEngineVulkan::DoFlush() { vertexCountInDrawCalls_ = 0; decodeCounter_ = 0; dcid_ = 0; - prevPrim_ = GE_PRIM_INVALID; gstate_c.vertexFullAlpha = true; framebufferManager_->SetColorUpdated(gstate_c.skipDrawReason); From 6e8aad727b7f11700be07e34c229df31cc68f8e1 Mon Sep 17 00:00:00 2001 From: "Unknown W. Brackets" Date: Sun, 18 Dec 2022 07:23:58 -0800 Subject: [PATCH 2/2] GPU: Prevent GE_PRIM_INVALID on flush. Wasn't enough to set prim temporarily here. --- GPU/Common/DrawEngineCommon.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/GPU/Common/DrawEngineCommon.cpp b/GPU/Common/DrawEngineCommon.cpp index 762acf066851..f675a255b63c 100644 --- a/GPU/Common/DrawEngineCommon.cpp +++ b/GPU/Common/DrawEngineCommon.cpp @@ -790,9 +790,13 @@ void DrawEngineCommon::SubmitPrim(const void *verts, const void *inds, GEPrimiti DispatchFlush(); } - // TODO: Is this the right thing to do? + // This isn't exactly right, if we flushed, since prims can straddle previous calls. + // But it generally works for common usage. if (prim == GE_PRIM_KEEP_PREVIOUS) { - prim = prevPrim_ != GE_PRIM_INVALID ? prevPrim_ : GE_PRIM_POINTS; + // Has to be set to something, let's assume POINTS (0) if no previous. + if (prevPrim_ == GE_PRIM_INVALID) + prevPrim_ = GE_PRIM_POINTS; + prim = prevPrim_; } else { prevPrim_ = prim; }