[vulkan] Expose pipeline disable controls

Finally, runtime control of the debug pipelines (and all the rest, but
that might come in handy at some stage).
This commit is contained in:
Bill Currie 2023-07-21 19:45:54 +09:00
parent 4b86a0376d
commit 99c6c58e25
2 changed files with 108 additions and 14 deletions

View file

@ -430,7 +430,8 @@ typedef struct qfv_renderctx_s {
qfv_job_t *job; qfv_job_t *job;
qfv_renderframeset_t frames; qfv_renderframeset_t frames;
int64_t size_time; int64_t size_time;
struct imui_window_s *job_window; struct imui_window_s *job_timings_window;
struct imui_window_s *job_control_window;
} qfv_renderctx_t; } qfv_renderctx_t;
typedef struct qfv_taskctx_s { typedef struct qfv_taskctx_s {

View file

@ -36,6 +36,12 @@
#define IMUI_context imui_ctx #define IMUI_context imui_ctx
static void
hs (imui_ctx_t *imui_ctx, int size)
{
IMUI_Spacer (imui_ctx, imui_size_pixels, 30 * size, imui_size_expand, 100);
}
static void static void
reset_time (qfv_time_t *time) reset_time (qfv_time_t *time)
{ {
@ -52,19 +58,19 @@ show_time (qfv_time_t *time, imui_ctx_t *imui_ctx, const char *suffix)
} }
static void static void
job_window (vulkan_ctx_t *ctx, imui_ctx_t *imui_ctx) job_timings_window (vulkan_ctx_t *ctx, imui_ctx_t *imui_ctx)
{ {
auto rctx = ctx->render_context; auto rctx = ctx->render_context;
if (!rctx->job_window) { if (!rctx->job_timings_window) {
rctx->job_window = malloc (sizeof (imui_window_t)); rctx->job_timings_window = malloc (sizeof (imui_window_t));
*rctx->job_window = (imui_window_t) { *rctx->job_timings_window = (imui_window_t) {
.name = nva ("Job##%p.window", rctx), .name = nva ("Job Timings##%p.window", rctx),
.xpos = 100, .xpos = 100,
.ypos = 50, .ypos = 50,
}; };
} }
UI_Window (rctx->job_window) { UI_Window (rctx->job_timings_window) {
if (rctx->job_window->is_collapsed) { if (rctx->job_timings_window->is_collapsed) {
continue; continue;
} }
auto job = rctx->job; auto job = rctx->job;
@ -95,18 +101,101 @@ job_window (vulkan_ctx_t *ctx, imui_ctx_t *imui_ctx)
} }
} }
static void
show_pipeline (const char *type, qfv_pipeline_t *pipeline,
imui_ctx_t *imui_ctx, vulkan_ctx_t *ctx)
{
auto rctx = ctx->render_context;
int indent;
if (!strcmp (type, "compute")) {
indent = 1;
} else {
indent = 3;
}
UI_Horizontal {
hs (imui_ctx, indent);
UI_Labelf ("%s##%p.pipeline.%p.%s",
pipeline->label.name, rctx, pipeline, type);
UI_FlexibleSpace ();
UI_Checkbox (&pipeline->disabled,
va (ctx->va_ctx, "##pipeline.disabled.%p", pipeline));
}
}
static void
job_control_window (vulkan_ctx_t *ctx, imui_ctx_t *imui_ctx)
{
auto rctx = ctx->render_context;
if (!rctx->job_control_window) {
rctx->job_control_window = malloc (sizeof (imui_window_t));
*rctx->job_control_window = (imui_window_t) {
.name = nva ("Job Control##%p.window", rctx),
.xpos = 100,
.ypos = 50,
};
}
UI_Window (rctx->job_control_window) {
if (rctx->job_control_window->is_collapsed) {
continue;
}
auto job = rctx->job;
for (uint32_t i = 0; i < job->num_steps; i++) {
auto step = &job->steps[i];
UI_Horizontal {
UI_Labelf ("%s##%p.job.step.%d", step->label.name, rctx, i);
UI_FlexibleSpace ();
}
if (step->render) {
auto rp = step->render->active;
UI_Horizontal {
hs (imui_ctx, 1);
UI_Labelf ("%s##%p.job.step.%d.render", rp->label.name,
rctx, i);
UI_FlexibleSpace ();
}
for (uint32_t j = 0; j < rp->subpass_count; j++) {
auto sp = &rp->subpasses[j];
UI_Horizontal {
hs (imui_ctx, 2);
UI_Labelf ("%s##%p.job.step.%d.subpass",
sp->label.name, rctx, i);
UI_FlexibleSpace ();
}
for (uint32_t j = 0; j < sp->pipeline_count; j++) {
auto pipeline = &sp->pipelines[j];
show_pipeline ("graphics", pipeline, imui_ctx, ctx);
}
}
}
if (step->compute) {
auto compute = step->compute;
for (uint32_t j = 0; j < compute->pipeline_count; j++) {
auto pipeline = &compute->pipelines[j];
show_pipeline ("compute", pipeline, imui_ctx, ctx);
}
}
if (step->process) {
}
}
}
}
void void
QFV_Render_UI (vulkan_ctx_t *ctx, imui_ctx_t *imui_ctx) QFV_Render_UI (vulkan_ctx_t *ctx, imui_ctx_t *imui_ctx)
{ {
job_window (ctx, imui_ctx); job_timings_window (ctx, imui_ctx);
job_control_window (ctx, imui_ctx);
} }
void void
QFV_Render_Menu (vulkan_ctx_t *ctx, imui_ctx_t *imui_ctx) QFV_Render_Menu (vulkan_ctx_t *ctx, imui_ctx_t *imui_ctx)
{ {
auto rctx = ctx->render_context; auto rctx = ctx->render_context;
if (UI_MenuItem (va (ctx->va_ctx, "Job##%p", rctx))) { if (UI_MenuItem (va (ctx->va_ctx, "Job Timings##%p", rctx))) {
rctx->job_window->is_open = true; rctx->job_timings_window->is_open = true;
}
if (UI_MenuItem (va (ctx->va_ctx, "Job Control##%p", rctx))) {
rctx->job_control_window->is_open = true;
} }
} }
@ -114,8 +203,12 @@ void
QFV_Render_UI_Shutdown (vulkan_ctx_t *ctx) QFV_Render_UI_Shutdown (vulkan_ctx_t *ctx)
{ {
auto rctx = ctx->render_context; auto rctx = ctx->render_context;
if (rctx->job_window) { if (rctx->job_timings_window) {
free ((char *) rctx->job_window->name); free ((char *) rctx->job_timings_window->name);
free (rctx->job_window); free (rctx->job_timings_window);
}
if (rctx->job_control_window) {
free ((char *) rctx->job_control_window->name);
free (rctx->job_control_window);
} }
} }