Stephane-D / SGDK

SGDK - A free and open development kit for the Sega Mega Drive
https://www.patreon.com/SGDK
MIT License
1.75k stars 187 forks source link

Large sprite drawing errors #352

Closed gigiwotou closed 1 month ago

gigiwotou commented 1 month ago

Large sprite drawing errors Var:SGDK 2.00 (January 2024) I draw large sprites in two parts, top and bottom. When opt_level=FAST, the sprite draws incorrectly. err1 err2 If opt_level=MEDIUM the drawing error disappears. ok

Test code is attached. testmd.zip

Stephane-D commented 1 month ago

Using debug build can show you some error logs in the output window (Gens KMod or BlastEm nightly) : KDEBUG MESSAGE: VRAM_alloc(123) failed: no enough free tile in VRAM (free = 109)

It's expected as the number of used tiles can vary depending the cutting process. So in this case you can increase the reserved VRAM for sprite (use SPR_initEx(...) in place of SPR_init(..) to specify the amount of VRAM reserved for the sprite engine)