[vulkan] Support disabling pipelines

This is useful for selecting post-processing pipelines at run-time.
This commit is contained in:
Bill Currie 2023-06-26 11:54:28 +09:00
parent fc949de24f
commit 25dfa75505
4 changed files with 10 additions and 0 deletions

View file

@ -166,6 +166,7 @@ typedef struct qfv_attachmentsetinfo_s {
typedef struct qfv_pipelineinfo_s {
vec4f_t color;
const char *name;
bool disabled;
uint32_t num_tasks;
qfv_taskinfo_t *tasks;
@ -309,6 +310,7 @@ typedef struct qfv_label_s {
typedef struct qfv_pipeline_s {
qfv_label_t label;
bool disabled;
VkPipelineBindPoint bindPoint;
vec4u_t dispatch;
VkPipeline pipeline;

View file

@ -81,6 +81,9 @@ run_tasks (uint32_t task_count, qfv_taskinfo_t *tasks, qfv_taskctx_t *ctx)
static void
run_pipeline (qfv_pipeline_t *pipeline, qfv_taskctx_t *taskctx)
{
if (pipeline->disabled) {
return;
}
qfv_device_t *device = taskctx->ctx->device;
qfv_devfuncs_t *dfunc = device->funcs;
auto cmd = taskctx->cmd;
@ -158,6 +161,9 @@ static void
run_compute_pipeline (qfv_pipeline_t *pipeline, VkCommandBuffer cmd,
vulkan_ctx_t *ctx)
{
if (pipeline->disabled) {
return;
}
qfv_device_t *device = ctx->device;
qfv_devfuncs_t *dfunc = device->funcs;
dfunc->vkCmdBindPipeline (cmd, pipeline->bindPoint, pipeline->pipeline);

View file

@ -753,6 +753,7 @@ init_pipeline (qfv_pipeline_t *pl, qfv_pipelineinfo_t *plinfo,
.name = plinfo->name,
.color = plinfo->color,
},
.disabled = plinfo->disabled,
.bindPoint = is_compute ? VK_PIPELINE_BIND_POINT_COMPUTE
: VK_PIPELINE_BIND_POINT_GRAPHICS,
.pipeline = is_compute ? s->ptr.cpl[s->inds.num_comp_pipelines]

View file

@ -327,6 +327,7 @@ parse = {
type = string;
string = name;
};
disabled = auto;
tasks = {
type = (array, qfv_taskinfo_t);
size = num_tasks;