Tick cute_spritebatch once per frame
...As opposed to once per draw call. This change was made because multiple draw calls can be made per frame, or a only a handful of draw calls may be made per minute. Since draw calls are an inconsistent metric, I just switched to frames instead.
This commit is contained in:
parent
2e5e1994c2
commit
ba6d711d3a
2 changed files with 4 additions and 4 deletions
|
@ -635,7 +635,6 @@ Backend_Surface* Backend_Init(const char *title, int width, int height, BOOL ful
|
|||
config.atlas_width_in_pixels = 256;
|
||||
config.atlas_height_in_pixels = 256;
|
||||
config.lonely_buffer_count_till_flush = 4; // Start making atlases immediately
|
||||
config.ticks_to_decay_texture = 100; // If a glyph hasn't been used for the past 100 draws, destroy it
|
||||
config.batch_callback = GlyphBatch_Draw;
|
||||
config.get_pixels_callback = GlyphBatch_GetPixels;
|
||||
config.generate_texture_callback = GlyphBatch_CreateTexture;
|
||||
|
@ -718,6 +717,8 @@ void Backend_Deinit(void)
|
|||
|
||||
void Backend_DrawScreen(void)
|
||||
{
|
||||
spritebatch_tick(&glyph_batcher);
|
||||
|
||||
FlushVertexBuffer();
|
||||
last_render_mode = MODE_BLANK;
|
||||
last_source_texture = 0;
|
||||
|
@ -1064,7 +1065,6 @@ void Backend_DrawGlyph(Backend_Glyph *glyph, long x, long y)
|
|||
|
||||
void Backend_FlushGlyphs(void)
|
||||
{
|
||||
spritebatch_tick(&glyph_batcher);
|
||||
spritebatch_defrag(&glyph_batcher);
|
||||
spritebatch_flush(&glyph_batcher);
|
||||
}
|
||||
|
|
|
@ -170,7 +170,6 @@ Backend_Surface* Backend_Init(const char *title, int width, int height, BOOL ful
|
|||
config.atlas_width_in_pixels = 256;
|
||||
config.atlas_height_in_pixels = 256;
|
||||
config.lonely_buffer_count_till_flush = 4; // Start making atlases immediately
|
||||
config.ticks_to_decay_texture = 100; // If a glyph hasn't been used for the past 100 draws, destroy it
|
||||
config.batch_callback = GlyphBatch_Draw;
|
||||
config.get_pixels_callback = GlyphBatch_GetPixels;
|
||||
config.generate_texture_callback = GlyphBatch_CreateTexture;
|
||||
|
@ -212,6 +211,8 @@ void Backend_Deinit(void)
|
|||
|
||||
void Backend_DrawScreen(void)
|
||||
{
|
||||
spritebatch_tick(&glyph_batcher);
|
||||
|
||||
SDL_SetRenderTarget(renderer, NULL);
|
||||
SDL_RenderCopy(renderer, framebuffer.texture, NULL, NULL);
|
||||
SDL_RenderPresent(renderer);
|
||||
|
@ -419,7 +420,6 @@ void Backend_DrawGlyph(Backend_Glyph *glyph, long x, long y)
|
|||
|
||||
void Backend_FlushGlyphs(void)
|
||||
{
|
||||
spritebatch_tick(&glyph_batcher);
|
||||
spritebatch_defrag(&glyph_batcher);
|
||||
spritebatch_flush(&glyph_batcher);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue