ftsf / nico

a Game Framework in Nim inspired by Pico-8.
MIT License
624 stars 35 forks source link

Optimization for DitherNone #86

Closed markusgritsch closed 2 years ago

markusgritsch commented 2 years ago

Hi, thanks for creating Nico. I like it a lot.

When using a bigger window size, say 800x600, I noticed quite high CPU comsumption, even when gameDraw() just contains cls().

The cause is that in the very fundamental psetRaw() the functions ditherPass() and stencilTest() are not as cheap as desirable.

Even when not using dithering, the floorMod() calls are performed. This change seeds up drawing a lot, in case dithering is not used.

ftsf commented 2 years ago

Thanks for that!

Also, I would consider making cls() just clear the whole screen buffer to 0 ignoring any dithering or other effects, you can always use rectfill if you want the other behaviour.