fix: corregir límite de sprites en SHAPE mode con muchas bolas

GpuSpriteBatch::init() ahora acepta capacidad dinámica para soportar
--custom-balls N con N > 200000. El buffer se dimensiona a (N+1) quads,
reservando siempre un slot para el overlay. addFullscreenOverlay() calcula
overlay_index_count_ desde el delta real de indices_ en lugar de fijarlo
a 6 incondicionalmente. Engine calcula la capacidad correcta al init.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
2026-03-21 00:14:28 +01:00
parent 46b24bf075
commit 74d954df1e
3 changed files with 23 additions and 12 deletions

View File

@@ -26,10 +26,10 @@ struct GpuVertex {
// ============================================================================
class GpuSpriteBatch {
public:
// Maximum sprites (background + UI overlay each count as one sprite)
static constexpr int MAX_SPRITES = 200000;
// Default maximum sprites (background + UI overlay each count as one sprite)
static constexpr int DEFAULT_MAX_SPRITES = 200000;
bool init(SDL_GPUDevice* device);
bool init(SDL_GPUDevice* device, int max_sprites = DEFAULT_MAX_SPRITES);
void destroy(SDL_GPUDevice* device);
void beginFrame();
@@ -83,4 +83,6 @@ private:
int sprite_index_count_ = 0;
int overlay_index_offset_ = 0;
int overlay_index_count_ = 0;
int max_sprites_ = DEFAULT_MAX_SPRITES;
};