This commit customises the software renderer specifically for the
3DS, taking into account its rotated framebuffer and BGR format.
With this, the game appears to run full-speed on Old3DSs. Of course,
the level transition effect still makes the console chug, but that
thing was always a bit of a bottleneck.
The old locking/unlocking API was plain inefficient. Soon I'll move
upscaling to the backend anyway, to minimise the overhead where
possible.
Currently only the software renderer has been updated.
Previously, the font batching system was very shoddy: basically,
glyph bitmaps would be cached to system memory, and uploaded
on-demand to the GPU.
The OpenGL3, OpenGLES2, and SDLTexture backends relied on
`cute_spritebatch.h` to handle batching. While nice, this library is
overkill: it's intended for managing a whole game, not just a couple
of glyphs. It also depends on C++11, which is something I'd rather be
without.
Being so complex, it appears that internally it spams the backend
when merging atlases together. According to bug reports, this causes
the game to skip a lot of frames.
Instead, I've ditched the system-memory-side caching, and made the
game maintain its own atlas. Unlike `cute_spritebatch.h`, this one
doesn't purge glyphs after they've gone unused for 30(?) seconds -
instead, glyphs are only purged when room in the atlas runs out, at
which point the oldest glyph is replaced. This method doesn't involve
creating or destroying atlases at runtime, avoiding the overhead of
whatever OpenGL/DirectX do internally when that happens.
Currently only the OpenGL3, OpenGLES2, and Software renderers have
been updated with this - the others will fail to build.
I know immediate-mode renderers won't benefit from this, but it
replaces the leaky old caching system, so it's still an improvement.
We need to avoid `WindowsWrapper.h` in the backends whenever we can,
to avoid name collisions (the Wii U homebrew library) defines its own
BOOL/TRUE/FALSE, which really doesn't work with CSE2.