mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-25 22:01:33 +00:00
[vulkan] Allow render passes to be run by processes
This lets the shadow step run its passes as needed.
This commit is contained in:
parent
ad1b2d00d4
commit
3d4cca4393
2 changed files with 44 additions and 28 deletions
|
@ -447,6 +447,8 @@ typedef struct qfv_taskctx_s {
|
|||
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);
|
||||
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);
|
||||
|
|
|
@ -80,6 +80,34 @@ update_time (qfv_time_t *time, int64_t start, int64_t end)
|
|||
time->max_time = max (time->max_time, delta);
|
||||
}
|
||||
|
||||
static void
|
||||
renderpass_update_viewport_sissor (qfv_renderpass_t *rp,
|
||||
const qfv_output_t *output)
|
||||
{
|
||||
rp->beginInfo.renderArea.extent = output->extent;
|
||||
for (uint32_t i = 0; i < rp->subpass_count; i++) {
|
||||
auto sp = &rp->subpasses[i];
|
||||
for (uint32_t j = 0; j < sp->pipeline_count; j++) {
|
||||
auto pl = &sp->pipelines[j];
|
||||
pl->viewport = (VkViewport) {
|
||||
.width = output->extent.width,
|
||||
.height = output->extent.height,
|
||||
.minDepth = 0,
|
||||
.maxDepth = 1,
|
||||
};
|
||||
pl->scissor.extent = output->extent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
update_viewport_scissor (qfv_render_t *render, const qfv_output_t *output)
|
||||
{
|
||||
for (uint32_t i = 0; i < render->num_renderpasses; i++) {
|
||||
renderpass_update_viewport_sissor (&render->renderpasses[i], output);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
run_tasks (uint32_t task_count, qfv_taskinfo_t *tasks, qfv_taskctx_t *ctx)
|
||||
{
|
||||
|
@ -228,6 +256,20 @@ run_process (qfv_process_t *proc, vulkan_ctx_t *ctx)
|
|||
run_tasks (proc->task_count, proc->tasks, &taskctx);
|
||||
}
|
||||
|
||||
void
|
||||
QFV_RunRenderPass (vulkan_ctx_t *ctx, qfv_renderpass_t *renderpass,
|
||||
uint32_t width, uint32_t height)
|
||||
{
|
||||
qfv_output_t output = {
|
||||
.extent = {
|
||||
.width = width,
|
||||
.height = height,
|
||||
},
|
||||
};
|
||||
renderpass_update_viewport_sissor (renderpass, &output);
|
||||
run_renderpass (renderpass, ctx);
|
||||
}
|
||||
|
||||
void
|
||||
QFV_RunRenderJob (vulkan_ctx_t *ctx)
|
||||
{
|
||||
|
@ -398,34 +440,6 @@ wait_on_fence (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
|||
DARRAY_RESIZE (&job->commands, 0);
|
||||
}
|
||||
|
||||
static void
|
||||
renderpass_update_viewport_sissor (qfv_renderpass_t *rp,
|
||||
const qfv_output_t *output)
|
||||
{
|
||||
rp->beginInfo.renderArea.extent = output->extent;
|
||||
for (uint32_t i = 0; i < rp->subpass_count; i++) {
|
||||
auto sp = &rp->subpasses[i];
|
||||
for (uint32_t j = 0; j < sp->pipeline_count; j++) {
|
||||
auto pl = &sp->pipelines[j];
|
||||
pl->viewport = (VkViewport) {
|
||||
.width = output->extent.width,
|
||||
.height = output->extent.height,
|
||||
.minDepth = 0,
|
||||
.maxDepth = 1,
|
||||
};
|
||||
pl->scissor.extent = output->extent;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
update_viewport_scissor (qfv_render_t *render, const qfv_output_t *output)
|
||||
{
|
||||
for (uint32_t i = 0; i < render->num_renderpasses; i++) {
|
||||
renderpass_update_viewport_sissor (&render->renderpasses[i], output);
|
||||
}
|
||||
}
|
||||
|
||||
static void
|
||||
update_framebuffer (const exprval_t **params, exprval_t *result,
|
||||
exprctx_t *ectx)
|
||||
|
|
Loading…
Reference in a new issue