[console] Flush any pending draw data

This takes care of a 5s hang when the engine aborts before the first
frame is rendered (for vulkan).
This commit is contained in:
Bill Currie 2024-01-16 16:44:16 +09:00
parent 87357f98d3
commit 52f012cc11
7 changed files with 27 additions and 0 deletions

View file

@ -88,5 +88,7 @@ void Vulkan_Draw_ResetClip (struct vulkan_ctx_s *ctx);
void Vulkan_LineGraph (int x, int y, int *h_vals, int count, int height,
struct vulkan_ctx_s *ctx);
void Vulkan_SetScrFuncs (SCR_Func *scr_funcs, struct vulkan_ctx_s *ctx);
void Vulkan_Draw_Flush (struct vulkan_ctx_s *ctx);
#endif//__QF_Vulkan_qf_draw_h

View file

@ -281,6 +281,7 @@ int Draw_AddFont (struct font_s *font);
void Draw_Glyph (int x, int y, int fontid, int glyphid, int c);
void Draw_SetClip (int x, int y, int w, int h);
void Draw_ResetClip (void);
void Draw_Flush (void);
///@}

View file

@ -113,6 +113,7 @@ typedef struct vid_render_funcs_s {
void (*Draw_Glyph) (int x, int y, int fontid, int glyphid, int c);
void (*Draw_SetClip) (int x, int y, int w, int h);
void (*Draw_ResetClip) (void);
void (*Draw_Flush) (void);
struct psystem_s *(*ParticleSystem) (void);
struct psystem_s *(*TrailSystem) (void);

View file

@ -1233,6 +1233,8 @@ C_Init (void)
"file");
con_initialized = true;
Draw_Flush ();
}
static void

View file

@ -156,3 +156,11 @@ Draw_MaxScale (void)
{
return r_funcs->Draw_SetScale ? 20 : 1;
}
void
Draw_Flush (void)
{
if (r_funcs->Draw_Flush) {
r_funcs->Draw_Flush ();
}
}

View file

@ -339,6 +339,12 @@ vulkan_Draw_ResetClip (void)
Vulkan_Draw_ResetClip (vulkan_ctx);
}
static void
vulkan_Draw_Flush (void)
{
Vulkan_Draw_Flush (vulkan_ctx);
}
static void
vulkan_set_2d (int scaled)
{
@ -625,6 +631,7 @@ vid_render_funcs_t vulkan_vid_render_funcs = {
.Draw_Glyph = vulkan_Draw_Glyph,
.Draw_SetClip = vulkan_Draw_SetClip,
.Draw_ResetClip = vulkan_Draw_ResetClip,
.Draw_Flush = vulkan_Draw_Flush,
.ParticleSystem = vulkan_ParticleSystem,
.R_Init = vulkan_R_Init,

View file

@ -1867,3 +1867,9 @@ Vulkan_SetScrFuncs (SCR_Func *scr_funcs, vulkan_ctx_t *ctx)
auto dctx = ctx->draw_context;
dctx->scr_funcs = scr_funcs;
}
void
Vulkan_Draw_Flush (vulkan_ctx_t *ctx)
{
flush_draw_scrap (ctx);
}