Skip to content

gu: honor scissor extent for offscreen clears - #417

Open
fjtrujy wants to merge 4 commits into
pspdev:masterfrom
fjtrujy:fix/gu-offscreen-clear
Open

fjtrujy wants to merge 4 commits into
pspdev:masterfrom
fjtrujy:fix/gu-offscreen-clear

Conversation

@fjtrujy

@fjtrujy fjtrujy commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Problem

sceGuClear() sizes its clear geometry using the display dimensions saved by sceGuDispBuffer(). After switching to a larger offscreen draw buffer, this leaves pixels outside 480x272 uncleared. See libsdl-org/SDL#16029.

Changes

  • Use the active scissor end coordinates for normal and fast clear geometry when GU_SCISSOR_TEST is enabled, retaining display dimensions when disabled.
  • Allow up to 1024x1024 scissor regions in debug assertions.
  • Add a native regression sample that checks every pixel of a 512x512 render target, as well as screen-buffer isolation and restoration.

Validation

  • Real PSP (6.61, PSPLinkUSB): 26/26 cases pass.
  • PPSSPP: 26/26 cases pass; the same suite detects 13 failing cases against the unpatched library.
  • Covers nonzero scissor origins, edge and single-pixel boundaries, repeated clears, both buffer APIs, RGB565/RGBA8888, fast clears, and disabled scissoring.
  • Compiles with -Wall -Wextra -Werror, including debug GU builds. CI sample build passes.
  • Test results are written to ms0:/pspsdk-gu-clear-results.txt.

SDL must still set a target-sized scissor region before issuing its clear command.

@fjtrujy
fjtrujy marked this pull request as ready for review November 17, 2026 16:33

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant