From 2fa44c03a61262b67b9deb3c185c5f1708f7160c Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Mon, 24 Jul 2023 10:07:57 +0900 Subject: [PATCH] [vulkan] Allow process steps to have render or compute If a step has process tasks, any render or compute pipelines/renderpasses are **not** run automatically: the idea is the process tasks need to run the relevant pipelines in a custom manner but needs the objects to be created. --- libs/video/renderer/vulkan/render.c | 15 ++++++++++----- libs/video/renderer/vulkan/render_load.c | 10 ++++++---- 2 files changed, 16 insertions(+), 9 deletions(-) diff --git a/libs/video/renderer/vulkan/render.c b/libs/video/renderer/vulkan/render.c index de2232898..4e25f1c55 100644 --- a/libs/video/renderer/vulkan/render.c +++ b/libs/video/renderer/vulkan/render.c @@ -238,11 +238,16 @@ QFV_RunRenderJob (vulkan_ctx_t *ctx) for (uint32_t i = 0; i < job->num_steps; i++) { int64_t step_start = Sys_LongTime (); __auto_type step = &job->steps[i]; - if (step->render) { - run_renderpass (step->render->active, ctx); - } - if (step->compute) { - run_compute (step->compute, ctx, step); + if (!step->process) { + // run render and compute steps automatically only if there's no + // process for the step (the idea is the proces uses the compute + // and renderpass objects for its own purposes). + if (step->render) { + run_renderpass (step->render->active, ctx); + } + if (step->compute) { + run_compute (step->compute, ctx, step); + } } if (step->process) { run_process (step->process, ctx); diff --git a/libs/video/renderer/vulkan/render_load.c b/libs/video/renderer/vulkan/render_load.c index b64cd6314..52737a38f 100644 --- a/libs/video/renderer/vulkan/render_load.c +++ b/libs/video/renderer/vulkan/render_load.c @@ -183,12 +183,14 @@ count_comp_stuff (qfv_computeinfo_t *ci, objcount_t *counts) static void count_step_stuff (qfv_stepinfo_t *step, objcount_t *counts) { - if ((step->render && step->compute) - || (step->render && step->process) - || (step->compute && step->process)) { - Sys_Error ("%s: invalid step: must be one of render/compute/process", + if (step->render && step->compute && !step->process) { + Sys_Error ("%s: invalid step: must have process for render+compute", step->name); } + if (!step->render && !step->compute && !step->process) { + Sys_Error ("%s: invalid step: must have at least one of " + "proces/render/compute", step->name); + } if (step->render) { __auto_type rinfo = step->render; counts->num_renderpasses += rinfo->num_renderpasses;