mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-10 23:32:09 +00:00
[vulkan] Register task functions for the pipelines
They're currently just stubs, but this gets the render info loading working without any errors. The next step is to connect up pipelines and create the image resources, then implementing the task functions will have meaning.
This commit is contained in:
parent
f78aab1cb5
commit
422aaf4bc6
10 changed files with 177 additions and 1 deletions
|
@ -194,5 +194,6 @@ typedef struct qfv_renderpass_s_ {
|
|||
void QFV_RunRenderPass (qfv_renderpass_t_ *rp, struct vulkan_ctx_s *ctx);
|
||||
void QFV_LoadRenderPass (struct vulkan_ctx_s *ctx);
|
||||
void QFV_Render_Init (struct vulkan_ctx_s *ctx);
|
||||
void QFV_Render_AddTasks (struct vulkan_ctx_s *ctx, exprsym_t *task_sys);
|
||||
|
||||
#endif//__QF_Vulkan_render_h
|
||||
|
|
|
@ -101,7 +101,6 @@ vulkan_R_Init (void)
|
|||
Vulkan_CreateSwapchain (vulkan_ctx);
|
||||
Vulkan_CreateCapture (vulkan_ctx);
|
||||
|
||||
QFV_LoadRenderPass (vulkan_ctx);
|
||||
Vulkan_CreateRenderPasses (vulkan_ctx);
|
||||
Vulkan_Output_Init (vulkan_ctx);
|
||||
|
||||
|
@ -117,6 +116,8 @@ vulkan_R_Init (void)
|
|||
Vulkan_Translucent_Init (vulkan_ctx);
|
||||
Vulkan_Compose_Init (vulkan_ctx);
|
||||
|
||||
QFV_LoadRenderPass (vulkan_ctx);
|
||||
|
||||
Skin_Init ();
|
||||
|
||||
SCR_Init ();
|
||||
|
|
|
@ -146,3 +146,21 @@ QFV_Render_Init (vulkan_ctx_t *ctx)
|
|||
cexpr_init_symtab (&rctx->task_functions, &ectx);
|
||||
rctx->task_functions.symbols = 0;
|
||||
}
|
||||
|
||||
void
|
||||
QFV_Render_AddTasks (vulkan_ctx_t *ctx, exprsym_t *task_syms)
|
||||
{
|
||||
__auto_type rctx = ctx->render_context;
|
||||
exprctx_t ectx = { .hashctx = &rctx->hashctx };
|
||||
for (exprsym_t *sym = task_syms; sym->name; sym++) {
|
||||
Hash_Add (rctx->task_functions.tab, sym);
|
||||
for (exprfunc_t *f = sym->value; f->func; f++) {
|
||||
for (int i = 0; i < f->num_params; i++) {
|
||||
exprenum_t *e = f->param_types[i]->data;
|
||||
if (e && !e->symtab->tab) {
|
||||
cexpr_init_symtab (e->symtab, &ectx);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "QF/Vulkan/debug.h"
|
||||
#include "QF/Vulkan/device.h"
|
||||
#include "QF/Vulkan/instance.h"
|
||||
#include "QF/Vulkan/render.h"
|
||||
|
||||
#include "r_internal.h"
|
||||
#include "vid_vulkan.h"
|
||||
|
@ -295,12 +296,27 @@ Vulkan_AliasRemoveSkin (vulkan_ctx_t *ctx, qfv_alias_skin_t *skin)
|
|||
skin->descriptor = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
alias_draw (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
||||
{
|
||||
}
|
||||
|
||||
static exprfunc_t alias_draw_func[] = {
|
||||
{ .func = alias_draw },
|
||||
{}
|
||||
};
|
||||
static exprsym_t alias_task_syms[] = {
|
||||
{ "alias_draw", &cexpr_function, alias_draw_func },
|
||||
{}
|
||||
};
|
||||
|
||||
void
|
||||
Vulkan_Alias_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfv_device_t *device = ctx->device;
|
||||
|
||||
qfvPushDebug (ctx, "alias init");
|
||||
QFV_Render_AddTasks (ctx, alias_task_syms);
|
||||
|
||||
aliasctx_t *actx = calloc (1, sizeof (aliasctx_t));
|
||||
ctx->alias_context = actx;
|
||||
|
|
|
@ -69,6 +69,7 @@
|
|||
#include "QF/Vulkan/device.h"
|
||||
#include "QF/Vulkan/image.h"
|
||||
#include "QF/Vulkan/instance.h"
|
||||
#include "QF/Vulkan/render.h"
|
||||
#include "QF/Vulkan/scrap.h"
|
||||
#include "QF/Vulkan/staging.h"
|
||||
|
||||
|
@ -1361,6 +1362,64 @@ create_notexture (vulkan_ctx_t *ctx)
|
|||
bctx->notexture.tex = Vulkan_LoadTexArray (ctx, tex, 2, 1, "notexture");
|
||||
}
|
||||
|
||||
static void
|
||||
bsp_draw_queue (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
||||
{
|
||||
}
|
||||
|
||||
static exprenum_t bsp_stage_enum;
|
||||
static exprtype_t bsp_stage_type = {
|
||||
.name = "bsp_stage",
|
||||
.size = sizeof (int),
|
||||
.get_string = cexpr_enum_get_string,
|
||||
.data = &bsp_stage_enum,
|
||||
};
|
||||
static int bsp_stage_values[] = { 0, };
|
||||
static exprsym_t bsp_stage_symbols[] = {
|
||||
{"main", &bsp_stage_type, bsp_stage_values + 0},
|
||||
{}
|
||||
};
|
||||
static exprtab_t bsp_stage_symtab = { .symbols = bsp_stage_symbols };
|
||||
static exprenum_t bsp_stage_enum = {
|
||||
&bsp_stage_type,
|
||||
&bsp_stage_symtab,
|
||||
};
|
||||
|
||||
static exprenum_t bsp_queue_enum;
|
||||
static exprtype_t bsp_queue_type = {
|
||||
.name = "bsp_queue",
|
||||
.size = sizeof (int),
|
||||
.get_string = cexpr_enum_get_string,
|
||||
.data = &bsp_queue_enum,
|
||||
};
|
||||
static int bsp_queue_values[] = { 0, 1, 2, 3, };
|
||||
static exprsym_t bsp_queue_symbols[] = {
|
||||
{"solid", &bsp_queue_type, bsp_queue_values + 0},
|
||||
{"sky", &bsp_queue_type, bsp_queue_values + 1},
|
||||
{"translucent", &bsp_queue_type, bsp_queue_values + 2},
|
||||
{"turbulent", &bsp_queue_type, bsp_queue_values + 3},
|
||||
{}
|
||||
};
|
||||
static exprtab_t bsp_queue_symtab = { .symbols = bsp_queue_symbols };
|
||||
static exprenum_t bsp_queue_enum = {
|
||||
&bsp_queue_type,
|
||||
&bsp_queue_symtab,
|
||||
};
|
||||
|
||||
static exprtype_t *bsp_draw_queue_params[] = {
|
||||
&bsp_queue_type,
|
||||
&bsp_stage_type,
|
||||
};
|
||||
|
||||
static exprfunc_t bsp_draw_queue_func[] = {
|
||||
{ 0, 2, bsp_draw_queue_params, bsp_draw_queue },
|
||||
{}
|
||||
};
|
||||
static exprsym_t bsp_task_syms[] = {
|
||||
{ "bsp_draw_queue", &cexpr_function, bsp_draw_queue_func },
|
||||
{}
|
||||
};
|
||||
|
||||
void
|
||||
Vulkan_Bsp_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
|
@ -1368,6 +1427,7 @@ Vulkan_Bsp_Init (vulkan_ctx_t *ctx)
|
|||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
|
||||
qfvPushDebug (ctx, "bsp init");
|
||||
QFV_Render_AddTasks (ctx, bsp_task_syms);
|
||||
|
||||
bspctx_t *bctx = calloc (1, sizeof (bspctx_t));
|
||||
ctx->bsp_context = bctx;
|
||||
|
|
|
@ -52,6 +52,7 @@
|
|||
#include "QF/Vulkan/device.h"
|
||||
#include "QF/Vulkan/image.h"
|
||||
#include "QF/Vulkan/instance.h"
|
||||
#include "QF/Vulkan/render.h"
|
||||
|
||||
#include "r_internal.h"
|
||||
#include "vid_vulkan.h"
|
||||
|
@ -120,12 +121,27 @@ static VkWriteDescriptorSet base_image_write = {
|
|||
0, 0, 0
|
||||
};
|
||||
|
||||
static void
|
||||
compose_draw (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
||||
{
|
||||
}
|
||||
|
||||
static exprfunc_t compose_draw_func[] = {
|
||||
{ .func = compose_draw },
|
||||
{}
|
||||
};
|
||||
static exprsym_t compose_task_syms[] = {
|
||||
{ "compose_draw", &cexpr_function, compose_draw_func },
|
||||
{}
|
||||
};
|
||||
|
||||
void
|
||||
Vulkan_Compose_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfv_device_t *device = ctx->device;
|
||||
|
||||
qfvPushDebug (ctx, "compose init");
|
||||
QFV_Render_AddTasks (ctx, compose_task_syms);
|
||||
|
||||
composectx_t *cctx = calloc (1, sizeof (composectx_t));
|
||||
ctx->compose_context = cctx;
|
||||
|
|
|
@ -48,6 +48,7 @@
|
|||
#include "QF/Vulkan/device.h"
|
||||
#include "QF/Vulkan/instance.h"
|
||||
#include "QF/Vulkan/resource.h"
|
||||
#include "QF/Vulkan/render.h"
|
||||
|
||||
#include "r_internal.h"
|
||||
#include "vid_vulkan.h"
|
||||
|
@ -360,12 +361,27 @@ Vulkan_IQMRemoveSkin (vulkan_ctx_t *ctx, qfv_iqm_skin_t *skin)
|
|||
skin->descriptor = 0;
|
||||
}
|
||||
|
||||
static void
|
||||
iqm_draw (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
||||
{
|
||||
}
|
||||
|
||||
static exprfunc_t iqm_draw_func[] = {
|
||||
{ .func = iqm_draw },
|
||||
{}
|
||||
};
|
||||
static exprsym_t iqm_task_syms[] = {
|
||||
{ "iqm_draw", &cexpr_function, iqm_draw_func },
|
||||
{}
|
||||
};
|
||||
|
||||
void
|
||||
Vulkan_IQM_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfv_device_t *device = ctx->device;
|
||||
|
||||
qfvPushDebug (ctx, "iqm init");
|
||||
QFV_Render_AddTasks (ctx, iqm_task_syms);
|
||||
|
||||
iqmctx_t *ictx = calloc (1, sizeof (iqmctx_t));
|
||||
ctx->iqm_context = ictx;
|
||||
|
|
|
@ -66,6 +66,7 @@
|
|||
#include "QF/Vulkan/image.h"
|
||||
#include "QF/Vulkan/instance.h"
|
||||
#include "QF/Vulkan/projection.h"
|
||||
#include "QF/Vulkan/render.h"
|
||||
#include "QF/Vulkan/resource.h"
|
||||
#include "QF/Vulkan/staging.h"
|
||||
|
||||
|
@ -317,6 +318,20 @@ static VkWriteDescriptorSet base_image_write = {
|
|||
0, 0, 0
|
||||
};
|
||||
|
||||
static void
|
||||
lights_draw (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
||||
{
|
||||
}
|
||||
|
||||
static exprfunc_t lights_draw_func[] = {
|
||||
{ .func = lights_draw },
|
||||
{}
|
||||
};
|
||||
static exprsym_t lighting_task_syms[] = {
|
||||
{ "lights_draw", &cexpr_function, lights_draw_func },
|
||||
{}
|
||||
};
|
||||
|
||||
void
|
||||
Vulkan_Lighting_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
|
@ -324,6 +339,7 @@ Vulkan_Lighting_Init (vulkan_ctx_t *ctx)
|
|||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
|
||||
qfvPushDebug (ctx, "lighting init");
|
||||
QFV_Render_AddTasks (ctx, lighting_task_syms);
|
||||
|
||||
// lighting_context initialized in Vulkan_Lighting_CreateRenderPasses
|
||||
|
||||
|
|
|
@ -47,6 +47,7 @@
|
|||
#include "QF/Vulkan/descriptor.h"
|
||||
#include "QF/Vulkan/device.h"
|
||||
#include "QF/Vulkan/instance.h"
|
||||
#include "QF/Vulkan/render.h"
|
||||
#include "QF/Vulkan/resource.h"
|
||||
#include "QF/Vulkan/staging.h"
|
||||
#include "QF/Vulkan/qf_matrices.h"
|
||||
|
@ -272,6 +273,20 @@ create_buffers (vulkan_ctx_t *ctx)
|
|||
}
|
||||
}
|
||||
|
||||
static void
|
||||
particles_draw (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
||||
{
|
||||
}
|
||||
|
||||
static exprfunc_t particles_draw_func[] = {
|
||||
{ .func = particles_draw },
|
||||
{}
|
||||
};
|
||||
static exprsym_t particles_task_syms[] = {
|
||||
{ "particles_draw", &cexpr_function, particles_draw_func },
|
||||
{}
|
||||
};
|
||||
|
||||
void
|
||||
Vulkan_Particles_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
|
@ -279,6 +294,7 @@ Vulkan_Particles_Init (vulkan_ctx_t *ctx)
|
|||
qfv_devfuncs_t *dfunc = device->funcs;
|
||||
|
||||
qfvPushDebug (ctx, "particles init");
|
||||
QFV_Render_AddTasks (ctx, particles_task_syms);
|
||||
|
||||
particlectx_t *pctx = calloc (1, sizeof (particlectx_t));
|
||||
ctx->particle_context = pctx;
|
||||
|
|
|
@ -63,6 +63,7 @@
|
|||
#include "QF/Vulkan/descriptor.h"
|
||||
#include "QF/Vulkan/device.h"
|
||||
#include "QF/Vulkan/instance.h"
|
||||
#include "QF/Vulkan/render.h"
|
||||
|
||||
#include "r_internal.h"
|
||||
#include "vid_vulkan.h"
|
||||
|
@ -284,12 +285,27 @@ Vulkan_Sprint_FreeDescriptors (vulkan_ctx_t *ctx, qfv_sprite_t *sprite)
|
|||
&sprite->descriptors);
|
||||
}
|
||||
|
||||
static void
|
||||
sprite_draw (const exprval_t **params, exprval_t *result, exprctx_t *ectx)
|
||||
{
|
||||
}
|
||||
|
||||
static exprfunc_t sprite_draw_func[] = {
|
||||
{ .func = sprite_draw },
|
||||
{}
|
||||
};
|
||||
static exprsym_t sprite_task_syms[] = {
|
||||
{ "sprite_draw", &cexpr_function, sprite_draw_func },
|
||||
{}
|
||||
};
|
||||
|
||||
void
|
||||
Vulkan_Sprite_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfv_device_t *device = ctx->device;
|
||||
|
||||
qfvPushDebug (ctx, "sprite init");
|
||||
QFV_Render_AddTasks (ctx, sprite_task_syms);
|
||||
|
||||
spritectx_t *sctx = calloc (1, sizeof (spritectx_t));
|
||||
ctx->sprite_context = sctx;
|
||||
|
|
Loading…
Reference in a new issue