From e7b21b82ac47fcd67ba509f83e084e1b94e6992f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Henrik=20Rydg=C3=A5rd?= Date: Fri, 2 Oct 2026 01:55:48 -0600 Subject: [PATCH] SoftGPU: Draw single-threaded when the scissor reaches past the stride Pixels past the framebuffer's stride land at the start of the next row, which another binning task may be drawing, so the result raced. Tokimeki Memorial (NPJH50127) blurs a 128 wide buffer under a full screen scissor; its PSP replay is now exact (gpu/probe exp166). Co-Authored-By: Claude Opus 5.5 (1M context) --- GPU/Software/BinManager.cpp | 10 +++++++++- GPU/Software/BinManager.h | 2 ++ 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/GPU/Software/BinManager.cpp b/GPU/Software/BinManager.cpp index c5a2ec06ce..0c4545f526 100644 --- a/GPU/Software/BinManager.cpp +++ b/GPU/Software/BinManager.cpp @@ -220,6 +220,14 @@ void BinManager::UpdateState() { scissor_.x2 = screenScissorBR.x + SCREEN_SCALE_FACTOR - 1; scissor_.y2 = screenScissorBR.y + SCREEN_SCALE_FACTOR - 1; + // Pixels past the stride land in the next row, which another task may be drawing (Tokimeki + // Memorial's 128 wide blur buffer under a full screen scissor). + const bool pastStride = scissorBR.x >= gstate.FrameBufStride(); + if (pastStride != pastStride_) { + pastStride_ = pastStride; + dirty_ |= SoftDirty::BINNER_OVERLAP; + } + // If we're about to texture from something still pending (i.e. depth), flush. if (HasTextureWrite(state)) Flush("tex"); @@ -243,7 +251,7 @@ void BinManager::UpdateState() { // Disallow threads when rendering to the target, even offset. bool selfRender = HasTextureWrite(state); - int newMaxTasks = selfRender || FORCE_SINGLE_THREAD ? 1 : g_threadManager.GetNumLooperThreads(); + int newMaxTasks = selfRender || pastStride_ || FORCE_SINGLE_THREAD ? 1 : g_threadManager.GetNumLooperThreads(); if (newMaxTasks > MAX_POSSIBLE_TASKS) newMaxTasks = MAX_POSSIBLE_TASKS; // We don't want to overlap wrong, so flush any pending. diff --git a/GPU/Software/BinManager.h b/GPU/Software/BinManager.h index f54d18e5b9..5a582db309 100644 --- a/GPU/Software/BinManager.h +++ b/GPU/Software/BinManager.h @@ -271,6 +271,8 @@ private: // Whether the current state textures from what it draws to, and the texture as it was before the // primitive being drawn for one that does. bool selfRender_ = false; + // The scissor reaches past the framebuffer's stride. + bool pastStride_ = false; Rasterizer::RasterizerState selfTexState_; std::vector selfTexBuf_[8]; uint32_t selfTexAddr_[8]{};