[vulkan] Delay main render resizes by 2s

This makes window resizing a little more responsive (though it could be
better yet (maybe, could be an X11 limitation)).
This commit is contained in:
Bill Currie 2023-07-03 23:38:57 +09:00
parent e37b477739
commit 6fa016e23b
3 changed files with 7 additions and 3 deletions

View File

@ -419,8 +419,9 @@ typedef struct qfv_renderctx_s {
exprtab_t task_functions;
qfv_jobinfo_t *jobinfo;
qfv_samplerinfo_t *samplerinfo;
qfv_job_t *job;
qfv_job_t *job;
qfv_renderframeset_t frames;
int64_t size_time;
} qfv_renderctx_t;
typedef struct qfv_taskctx_s {

View File

@ -420,8 +420,9 @@ update_framebuffer (const exprval_t **params, exprval_t *result,
qfv_output_t output = {};
Vulkan_ConfigOutput (ctx, &output);
if (output.extent.width != render->output.extent.width
|| output.extent.height != render->output.extent.height) {
if ((output.extent.width != render->output.extent.width
|| output.extent.height != render->output.extent.height)
&& (Sys_LongTime () - ctx->render_context->size_time) > 2*1000*1000) {
QFV_DestroyFramebuffer (ctx, rp);
update_viewport_scissor (render, &output);
render->output.extent = output.extent;
@ -455,6 +456,7 @@ QFV_Render_Init (vulkan_ctx_t *ctx)
{
qfv_renderctx_t *rctx = calloc (1, sizeof (*rctx));
ctx->render_context = rctx;
rctx->size_time = -1000*1000*1000;
exprctx_t ectx = { .hashctx = &rctx->hashctx };
exprsym_t syms[] = { {} };

View File

@ -122,6 +122,7 @@ acquire_output (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
pl->scissor.extent = sc->extent;
}
}
rctx->size_time = Sys_LongTime ();
}
ctx->swapImageIndex = imageIndex;
rp->beginInfo.framebuffer = octx->framebuffers[imageIndex];