Sprites per Scanline limits

Chat about anything CX16 related that doesn't fit elsewhere
Post Reply
epsilon537
Posts: 31
Joined: Sun May 01, 2022 12:12 pm

Sprites per Scanline limits

Post by epsilon537 »

Hi all,

I've been running some VERA simulations to try and get some insight into its behavior. One area I looked at is the sprites-per-scanline limit for the following configuration:

- 640x480 VGA mode
- Layer 0 and 1 enabled in 8bpp tile mode
- 8bpp sprites

These are the results I got:
- Max. 43 8x8 sprites/scanline.
- Max. 25 16x16 sprites/scanline.
- Max. 13 32x32 sprites/scanline.
- Max. 7 64x64 sprites/scanline.

The results may vary a bit depending on exactly which sprites IDs are enabled in the sprite attribute RAM. The VERA sprite renderer has an FSM that sequentially scans through the sprite attribute RAM to find the sprites that are active on the given scanline. For the simulation, I just used consecutive sprite IDs starting from 0.

With layers 0 and 1 disabled, the results are slightly better because there's less pressure on VERA's main RAM:
- Max. 53 8x8 sprites/scanline.
- Max. 29 16x16 sprites/scanline.
- Max. 15 32x32 sprites/scanline.
- Max. 8 64x64 sprites/scanline.

Has anybody been able to measure the sprites/scanline limits on an actual VERA FPGA?
Kalvan
Posts: 115
Joined: Mon Feb 01, 2021 10:05 pm

Re: Sprites per Scanline limits

Post by Kalvan »

Well, what are the scanline limits for sprites when 4-bit per-pixel tile layers are in play? What about 2-bit per-pixel bitmap mode?
epsilon537
Posts: 31
Joined: Sun May 01, 2022 12:12 pm

Re: Sprites per Scanline limits

Post by epsilon537 »

Kalvan wrote: Tue Feb 28, 2023 12:12 pm Well, what are the scanline limits for sprites when 4-bit per-pixel tile layers are in play? What about 2-bit per-pixel bitmap mode?
There are lots of modes and mode combinations to measure: tile mode, bitmap mode, 8bpp sprites and/or layers, 4bpp sprites and or layers, 2bpp layers, 0-2 layers enabled...
To measure all those cases I should probably create some kind of automated test instead of eyeballing the waveforms. I'll think about it.

In the meantime, I do have some additional results. The numbers I posted before were actually too optimistic. The sprite attribute RAM scanning is expensive, which means that if you're using higher-order sprite IDs (127, 126...) you'll get less sprites-per-scanline than with lower-order sprite IDs (0, 1...). Using higher-order sprite IDs I get these numbers:

- 640x480 VGA mode
- Layer 0 and 1 enabled in 8bpp tile mode
- 8bpp sprites
- higher-order sprite IDs (127, 126...)

- Max. 38 8x8 sprites/scanline.
- Max. 21 16x16 sprites/scanline.
- Max. 10 32x32 sprites/scanline.
- Max. 6 64x64 sprites/scanline.

I also measured 4bpp sprites (layers still in 8bpp tile mode):

- 640x480 VGA mode
- Layer 0 and 1 enabled in 8bpp tile mode
- 4bpp sprites
- lower-order sprite IDs (0, 1...)

- Max. 57 8x8 sprites/scanline.
- Max. 32 16x16 sprites/scanline.
- Max. 16 32x32 sprites/scanline.
- Max. 8 64x64 sprites/scanline.

...and with higher-order sprite IDs:

- 640x480 VGA mode
- Layer 0 and 1 enabled in 8bpp tile mode
- 4bpp sprites
- higher-order sprite IDs (127,126...)

- Max. 51 8x8 sprites/scanline.
- Max. 27 16x16 sprites/scanline.
- Max. 14 32x32 sprites/scanline.
- Max. 7 64x64 sprites/scanline.
epsilon537
Posts: 31
Joined: Sun May 01, 2022 12:12 pm

Re: Sprites per Scanline limits

Post by epsilon537 »

I did a couple more measurements and put the whole thing into a table:
sprites_per_scanline.jpg
sprites_per_scanline.jpg (128.15 KiB) Viewed 2739 times
Attachments
sprites_per_scanline.xlsx
(10.22 KiB) Downloaded 182 times
Post Reply