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) <noreply@anthropic.com>
This commit is contained in:
Henrik RydgårdandClaude Opus 5.5 committed 2026-10-02 15:09:43 -06:00
1 parent 65421f1f6b
commit e7b21b82ac
2 files changed
+11 -1

No files matched your search

+9 -1
View File
@@ -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.
+2
View File
@@ -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<u8> selfTexBuf_[8];
uint32_t selfTexAddr_[8]{};