Skip to content

Recreate frame buffers when the pixel size changes (Mario Tennis shadows) - #2992

Open
JoeysRetroHandhelds wants to merge 1 commit into
gonetz:masterfrom
JoeysRetroHandhelds:fix-mario-tennis-shadows
Open

JoeysRetroHandhelds wants to merge 1 commit into
gonetz:masterfrom
JoeysRetroHandhelds:fix-mario-tennis-shadows

Conversation

@JoeysRetroHandhelds

Copy link
Copy Markdown

Mario Tennis draws each player's shadow into a small aux buffer: it fills the buffer as a 16-bit image, then sets the same address as an 8-bit color image, draws the silhouette, and samples it back as an I8 texture.

FrameBufferList::saveBuffer kept the existing 16-bit buffer for the 8-bit color image and only relabelled it (m_size, texture format/size), so the silhouette was drawn into an RGBA texture that the 8-bit (single channel) paths can't read. The shadow showed as a dark box, or as stripes when loaded from RDRAM, and flickered between the two with async color buffer copy.

Change: when the pixel size of the current buffer changes, the buffer is removed and recreated (the same path a width or scale change already takes), so it gets the right texture format. Like the old relabel path, the new buffer is cleared with the fill color when only the pixel size changed. The m_size < _size check becomes m_size != _size, so a 16 -> 8 change is covered too.

Testing: Mario Tennis (U) through the libretro core (mupen64plus-next) on Android: the shadows now match parallel-RDP, in both color copy modes. I've only checked Mario Tennis; other games that reuse a buffer at a different pixel size now get a new buffer instead of a relabelled one, so a wider check would be welcome. src/FrameBuffer.cpp on this branch (master a04081a + this commit) compiles cleanly with clang (NDK 27.3, arm64); I haven't run a full standalone build.

…ows)

Mario Tennis draws each player's shadow into a small aux buffer: it
fills the buffer as a 16-bit image, sets the same address as an 8-bit
color image and draws the silhouette, then samples it as an I8 texture.

saveBuffer kept the 16-bit buffer and only relabelled it 8-bit, so the
silhouette went into an RGBA texture that the 8-bit (single channel)
paths can't read: the shadow showed as a dark box, or as stripes when
loaded from RDRAM, flickering between the two with async color copy.

Now a pixel size change recreates the buffer with the right texture
format and clears it with the fill color, as the relabel path did.
Shadows match parallel-RDP.
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