mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 15:22:04 +00:00
[vulkan] Add a very simple job window
It shows the list of steps in the render job, but acts as something for testing.
This commit is contained in:
parent
3944cab95f
commit
9289e26211
5 changed files with 106 additions and 1 deletions
|
@ -422,6 +422,7 @@ typedef struct qfv_renderctx_s {
|
|||
qfv_job_t *job;
|
||||
qfv_renderframeset_t frames;
|
||||
int64_t size_time;
|
||||
struct imui_window_s *job_window;
|
||||
} qfv_renderctx_t;
|
||||
|
||||
typedef struct qfv_taskctx_s {
|
||||
|
@ -454,6 +455,10 @@ VkSampler QFV_Render_Sampler (struct vulkan_ctx_s *ctx, const char *name);
|
|||
qfv_step_t *QFV_GetStep (const exprval_t *param, qfv_job_t *job);
|
||||
qfv_step_t *QFV_FindStep (const char *step, qfv_job_t *job) __attribute__((pure));
|
||||
|
||||
struct imui_ctx_s;
|
||||
void QFV_Render_UI (struct vulkan_ctx_s *ctx, struct imui_ctx_s *imui_ctx);
|
||||
void QFV_Render_UI_Shutdown (struct vulkan_ctx_s *ctx);
|
||||
|
||||
#endif//__QFCC__
|
||||
|
||||
#endif//__QF_Vulkan_render_h
|
||||
|
|
|
@ -227,6 +227,7 @@ libs_video_renderer_librender_vulkan_la_SOURCES = \
|
|||
libs/video/renderer/vulkan/projection.c \
|
||||
libs/video/renderer/vulkan/render.c \
|
||||
libs/video/renderer/vulkan/render_load.c \
|
||||
libs/video/renderer/vulkan/render_ui.c \
|
||||
libs/video/renderer/vulkan/resource.c \
|
||||
libs/video/renderer/vulkan/scrap.c \
|
||||
libs/video/renderer/vulkan/shader.c \
|
||||
|
|
|
@ -68,7 +68,7 @@
|
|||
#include "QF/Vulkan/render.h"
|
||||
#include "QF/Vulkan/staging.h"
|
||||
#include "QF/Vulkan/swapchain.h"
|
||||
#include "QF/ui/view.h"
|
||||
#include "QF/ui/imui.h"
|
||||
|
||||
#include "QF/scene/entity.h"
|
||||
#include "QF/scene/scene.h"
|
||||
|
@ -367,6 +367,16 @@ vulkan_capture_screen (capfunc_t callback, void *data)
|
|||
QFV_Capture_Screen (vulkan_ctx, callback, data);
|
||||
}
|
||||
|
||||
static void
|
||||
vulkan_debug_ui (struct imui_ctx_s *imui_ctx)
|
||||
{
|
||||
#define IMUI_context imui_ctx
|
||||
UI_ExtendPanel ("Renderer##menu") {
|
||||
QFV_Render_UI (vulkan_ctx, imui_ctx);
|
||||
}
|
||||
#undef IMUI_context
|
||||
}
|
||||
|
||||
static void
|
||||
vulkan_Mod_LoadLighting (model_t *mod, bsp_t *bsp)
|
||||
{
|
||||
|
@ -603,6 +613,8 @@ vid_render_funcs_t vulkan_vid_render_funcs = {
|
|||
|
||||
.capture_screen = vulkan_capture_screen,
|
||||
|
||||
.debug_ui = vulkan_debug_ui,
|
||||
|
||||
.model_funcs = &model_funcs
|
||||
};
|
||||
|
||||
|
|
|
@ -556,6 +556,9 @@ QFV_Render_Shutdown (vulkan_ctx_t *ctx)
|
|||
}
|
||||
}
|
||||
Hash_DelContext (rctx->hashctx);
|
||||
|
||||
QFV_Render_UI_Shutdown (ctx);
|
||||
free (rctx);
|
||||
}
|
||||
|
||||
void
|
||||
|
|
84
libs/video/renderer/vulkan/render_ui.c
Normal file
84
libs/video/renderer/vulkan/render_ui.c
Normal file
|
@ -0,0 +1,84 @@
|
|||
/*
|
||||
render_ui.c
|
||||
|
||||
Vulkan render manager UI
|
||||
|
||||
Copyright (C) 2023 Bill Currie <bill@taniwha.org>
|
||||
|
||||
This program is free software; you can redistribute it and/or
|
||||
modify it under the terms of the GNU General Public License
|
||||
as published by the Free Software Foundation; either version 2
|
||||
of the License, or (at your option) any later version.
|
||||
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
|
||||
|
||||
See the GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with this program; if not, write to:
|
||||
|
||||
Free Software Foundation, Inc.
|
||||
59 Temple Place - Suite 330
|
||||
Boston, MA 02111-1307, USA
|
||||
|
||||
*/
|
||||
#ifdef HAVE_CONFIG_H
|
||||
# include "config.h"
|
||||
#endif
|
||||
|
||||
#include "QF/va.h"
|
||||
#include "QF/ui/imui.h"
|
||||
|
||||
#include "QF/Vulkan/render.h"
|
||||
#include "vid_vulkan.h"
|
||||
|
||||
#define IMUI_context imui_ctx
|
||||
|
||||
static void
|
||||
job_window (vulkan_ctx_t *ctx, imui_ctx_t *imui_ctx)
|
||||
{
|
||||
auto rctx = ctx->render_context;
|
||||
if (!rctx->job_window) {
|
||||
rctx->job_window = malloc (sizeof (imui_window_t));
|
||||
*rctx->job_window = (imui_window_t) {
|
||||
.name = nva ("Job##%p.window", rctx),
|
||||
.xpos = 100,
|
||||
.ypos = 50,
|
||||
};
|
||||
}
|
||||
UI_Window (rctx->job_window) {
|
||||
if (rctx->job_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 ();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
QFV_Render_UI (vulkan_ctx_t *ctx, imui_ctx_t *imui_ctx)
|
||||
{
|
||||
auto rctx = ctx->render_context;
|
||||
if (UI_Button (va (ctx->va_ctx, "Job##%p", rctx))) {
|
||||
rctx->job_window->is_open = true;
|
||||
}
|
||||
job_window (ctx, imui_ctx);
|
||||
}
|
||||
|
||||
void
|
||||
QFV_Render_UI_Shutdown (vulkan_ctx_t *ctx)
|
||||
{
|
||||
auto rctx = ctx->render_context;
|
||||
if (rctx->job_window) {
|
||||
free ((char *) rctx->job_window->name);
|
||||
free (rctx->job_window);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue