From ac016201dc118d506dcd2ad83e2bd6c7c154a263 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Thu, 3 Sep 2026 10:57:33 -0600 Subject: [PATCH] GLES: Small cleanups Scissor the stencil readback to the region actually being read back - latent, every caller passes a zero origin today. Remove a DecodeVerts call that can never do anything: both branches above it have already advanced decodeVertsCounter_ to numDrawVerts_. Worse than useless, since in the non-skinning branch the vertices went to the push buffer, so decoded_ doesn't hold them. --- GPU/GLES/DrawEngineGLES.cpp | 1 - GPU/GLES/StencilBufferGLES.cpp | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/GPU/GLES/DrawEngineGLES.cpp b/GPU/GLES/DrawEngineGLES.cpp index eb8220c2b0..8364ca30ef 100644 --- a/GPU/GLES/DrawEngineGLES.cpp +++ b/GPU/GLES/DrawEngineGLES.cpp @@ -292,7 +292,6 @@ void DrawEngineGLES::Flush() { int vertexCount; int maxIndex; bool useElements; - DecodeVerts(dec_, decoded_); DecodeIndsAndGetData(&prim, &vertexCount, &maxIndex, &useElements, false); gpuStats.perFrame.numVertsDrawn += vertexCount; diff --git a/GPU/GLES/StencilBufferGLES.cpp b/GPU/GLES/StencilBufferGLES.cpp index 40ca65cb35..19b94d21bb 100644 --- a/GPU/GLES/StencilBufferGLES.cpp +++ b/GPU/GLES/StencilBufferGLES.cpp @@ -136,7 +136,9 @@ bool FramebufferManagerGLES::ReadbackStencilbuffer(Draw::Framebuffer *fbo, int x draw_->BindSamplerStates(TEX_SLOT_PSP_TEXTURE, 1, &stencilReadbackSampler_); // We must bind the program after starting the render pass. - draw_->SetScissorRect(0, 0, w, h); + // Note: scissor to the region we're about to read back, not to (0, 0, w, h) - every caller + // passes (0, 0) today, but with a nonzero origin the copy below would read scissored-away pixels. + draw_->SetScissorRect(x, y, w, h); draw_->BindPipeline(stencilReadbackPipeline_); // Fullscreen triangle coordinates.