Open calc84maniac opened 2 weeks ago
While updating all clipped routines to use SMC, I found and fixed two bugs in flood fill clipping, the first being that X clipping on the left was always treated as 0, and the second being that X clipping on the right was off by one (treating the upper bound as inclusive instead of exclusive).
Reworks sprite clipping to use range-based (unsigned) comparisons instead of signed comparisons, and also moves shared pointer calculation logic into the clipping routine. Additionally, logic is added to gfx_SetClipRegion to apply SMC to all clipping routines. This saves
178215 bytes overall, and I measured the following changes in cycle counts for gfx_Sprite (up until the gfx_Wait for drawn sprites, or through the return for culled sprites):fully onscreen: 1177 ->
716644clipped top: 1450 ->
860772 clipped left: 1488 ->864780 clipped right: 1254 ->756684 clipped bottom: 1202 ->744672clipped top left: 1761 ->
1008908 clipped top right: 1527 ->900812 clipped bottom left: 1513 ->892808 clipped bottom right: 1279 ->784712clipped left+right: 1565 ->
863779 clipped top+bottom: 1475 ->859767 clipped top+left+right+bottom: 1863 ->1006902culled top: 471 ->
370334 culled left: 803 ->540468 culled right: 776 ->540468 culled bottom: 474 ->370334I'll probably take a look at gfx_RLETSprite later and add it to this PR if I can improve it.