diff --git a/include/QF/Vulkan/qf_lighting.h b/include/QF/Vulkan/qf_lighting.h index 3e1047847..99999a3fd 100644 --- a/include/QF/Vulkan/qf_lighting.h +++ b/include/QF/Vulkan/qf_lighting.h @@ -97,6 +97,7 @@ typedef struct light_renderer_s { uint16_t layer; uint8_t numLayers; uint8_t mode; + uint16_t matrix_base; } light_renderer_t; typedef struct light_renderer_set_s diff --git a/include/QF/Vulkan/render.h b/include/QF/Vulkan/render.h index 1c7d9b4d6..fbfbd2663 100644 --- a/include/QF/Vulkan/render.h +++ b/include/QF/Vulkan/render.h @@ -442,13 +442,14 @@ typedef struct qfv_taskctx_s { qfv_pipeline_t *pipeline; qfv_renderpass_t *renderpass; VkCommandBuffer cmd; + void *data; } qfv_taskctx_t; VkCommandBuffer QFV_GetCmdBuffer (struct vulkan_ctx_s *ctx, bool secondary); void QFV_AppendCmdBuffer (struct vulkan_ctx_s *ctx, VkCommandBuffer cmd); void QFV_RunRenderPass (struct vulkan_ctx_s *ctx, qfv_renderpass_t *renderpass, - uint32_t width, uint32_t height); + uint32_t width, uint32_t height, void *data); void QFV_RunRenderJob (struct vulkan_ctx_s *ctx); void QFV_LoadRenderInfo (struct vulkan_ctx_s *ctx, const char *name); void QFV_LoadSamplerInfo (struct vulkan_ctx_s *ctx, const char *name); diff --git a/libs/video/renderer/vulkan/render.c b/libs/video/renderer/vulkan/render.c index 3b50dbc2d..8085022fd 100644 --- a/libs/video/renderer/vulkan/render.c +++ b/libs/video/renderer/vulkan/render.c @@ -150,7 +150,7 @@ run_subpass (qfv_subpass_t *sp, qfv_taskctx_t *taskctx) } static void -run_renderpass (qfv_renderpass_t *rp, vulkan_ctx_t *ctx) +run_renderpass (qfv_renderpass_t *rp, vulkan_ctx_t *ctx, void *data) { qfv_device_t *device = ctx->device; qfv_devfuncs_t *dfunc = device->funcs; @@ -175,6 +175,7 @@ run_renderpass (qfv_renderpass_t *rp, vulkan_ctx_t *ctx) .ctx = ctx, .renderpass = rp, .cmd = QFV_GetCmdBuffer (ctx, true), + .data = data, }; run_subpass (sp, &taskctx); dfunc->vkCmdExecuteCommands (cmd, 1, &taskctx.cmd); @@ -258,7 +259,7 @@ run_process (qfv_process_t *proc, vulkan_ctx_t *ctx) void QFV_RunRenderPass (vulkan_ctx_t *ctx, qfv_renderpass_t *renderpass, - uint32_t width, uint32_t height) + uint32_t width, uint32_t height, void *data) { qfv_output_t output = { .extent = { @@ -267,7 +268,7 @@ QFV_RunRenderPass (vulkan_ctx_t *ctx, qfv_renderpass_t *renderpass, }, }; renderpass_update_viewport_sissor (renderpass, &output); - run_renderpass (renderpass, ctx); + run_renderpass (renderpass, ctx, data); } void @@ -285,7 +286,7 @@ QFV_RunRenderJob (vulkan_ctx_t *ctx) // 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); + run_renderpass (step->render->active, ctx, 0); } if (step->compute) { run_compute (step->compute, ctx, step); diff --git a/libs/video/renderer/vulkan/vulkan_lighting.c b/libs/video/renderer/vulkan/vulkan_lighting.c index a3b52aeed..3f0441822 100644 --- a/libs/video/renderer/vulkan/vulkan_lighting.c +++ b/libs/video/renderer/vulkan/vulkan_lighting.c @@ -274,7 +274,7 @@ lighting_draw_shadow_maps (const exprval_t **params, exprval_t *result, auto bi = &renderpass->beginInfo; auto fbuffer = create_framebuffer (ctx, r, view, bi->renderPass); bi->framebuffer = fbuffer; - QFV_RunRenderPass (ctx, renderpass, r->size, r->size); + QFV_RunRenderPass (ctx, renderpass, r->size, r->size, &r->matrix_base); DARRAY_APPEND (&lframe->views, view); DARRAY_APPEND (&lframe->framebuffers, fbuffer); bi->framebuffer = 0;