darkf / darkfo

DarkFO, a post-nuclear RPG remake (of Fallout 2)
Apache License 2.0
136 stars 12 forks source link

Optimize canvas lit tiles renderer #97

Open darkf opened 7 years ago

darkf commented 7 years ago

Currently it writes pixels byte by byte when we could be doing it by 32-bit pixels at a time. In unrelated artificial tests this gives me a ~585% speed up (from an "unplayable" 11 FPS to a playable 60 FPS) just filling a canvas.

Note that this makes it endian-dependent. Honestly I don't forsee a lot of big endian devices using this, but we could always detect endianness and use a branch (ideally by swapping out which makePixel(r, g, b) -> uint32 function we use.)

We should probably implement the native color map lookup table generation and pre-compute the 32-bit values instead of RGB. (#17)