2 Commits
Author SHA1 Message Date
Gleb Mazovetskiy 23f7feba69 BackBufferState: unordered_map -> vector
A vector is a lot more efficient here as we generally
only have a handful (1-3) backbuffers.

Additionally, this avoids a lot of temporary allocations every frame,
which were apparently triggered by `emplace` even if the element
already existed.
2022-11-14 18:13:46 +01:00
Gleb Mazovetskiy 680ab5ec40 Overhaul backbuffer state handling
When rendering directly to the output buffer, we need to maintain the
state of what has been drawn and what needs redrawing per-buffer.

We previously tried to do it implicitly by checking `SDL_DOUBLEBUF` and
other flags. The previous implementation was broken in several
ways, resulting in rendering issues on devices that support 8-bit output
directly.

Changes this mechanism to explicitly maintain buffer state per output
buffer. The new mechanism doesn't require knowledge of the number of
buffers, and thus also works correctly with triple-buffering.

Fixes #5447
2022-11-01 02:43:24 +00:00