Skip to content

Fix tearing in hidden BG FMV playback#2668

Open
ZironZ wants to merge 1 commit into
melonDS-emu:masterfrom
ZironZ:fmv-BG-tearing
Open

Fix tearing in hidden BG FMV playback#2668
ZironZ wants to merge 1 commit into
melonDS-emu:masterfrom
ZironZ:fmv-BG-tearing

Conversation

@ZironZ

@ZironZ ZironZ commented May 20, 2026

Copy link
Copy Markdown

This fixes FMV tearing in games that stream video data into an inactive BG layer, then later switch that BG on-screen.

The OpenGL renderer could prerender a hidden BG layer while the game was still updating it, leaving the cached BG texture with a mix of old and new frame data. This change still uploads VRAM changes normally, but defers rebuilding the BG texture until the layer is actually visible. That avoids building an FMV's BG texture from a half-updated video frame.

This partially addresses #2555. It affects several games that use Mobiclip FMVs. I tested it with Kingdom Hearts 358/2 Days and Ni no Kuni.

I also looked into Pokémon Black, but that seems to be a different case where it updates BG layers that are already visible. Fixing that safely would need a larger change, since games can also update visible BGs mid-frame for other effects.

@ZironZ ZironZ changed the title Fix tearing in hidden BG video playback Fix tearing in hidden BG FMV playback May 20, 2026
@KostaSaizo7

Copy link
Copy Markdown
Contributor

I can confirm that this fixes the tearing in Ghost Trick, Inazuma Eleven and Kingdom Hearts

@Arisotura

Copy link
Copy Markdown
Member

thanks, I'll review this when I find some time

things been busy for me lately

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.

3 participants