mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-26 06:10:56 +00:00
[vulkan] Create a render context
This gets an empty (no tasks or pipelines connected) render context initialized and available for other subsystems to register their task functions. Nothing is using it yet, but the test parse of rp_main_def fails gracefully (needs those tasks).
This commit is contained in:
parent
91d9d0b251
commit
f78aab1cb5
5 changed files with 29 additions and 22 deletions
|
@ -6,6 +6,7 @@
|
|||
#endif
|
||||
#include <vulkan/vulkan.h>
|
||||
|
||||
#include "QF/cexpr.h"
|
||||
#include "QF/simd/types.h"
|
||||
|
||||
typedef struct qfv_reference_s {
|
||||
|
@ -66,8 +67,8 @@ typedef struct qfv_attachmentinfo_s {
|
|||
} qfv_attachmentinfo_t;
|
||||
|
||||
typedef struct qfv_taskinfo_s {
|
||||
struct exprfunc_s *func;
|
||||
const struct exprval_s **params;
|
||||
exprfunc_t *func;
|
||||
const exprval_t **params;
|
||||
void *param_data;
|
||||
} qfv_taskinfo_t;
|
||||
|
||||
|
@ -134,7 +135,8 @@ typedef struct qfv_renderinfo_s {
|
|||
} qfv_renderinfo_t;
|
||||
|
||||
typedef struct qfv_renderctx_s {
|
||||
struct exprtab_s *task_functions;
|
||||
struct hashctx_s *hashctx;
|
||||
exprtab_t task_functions;
|
||||
} qfv_renderctx_t;
|
||||
|
||||
typedef struct qfv_label_s {
|
||||
|
@ -191,5 +193,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);
|
||||
|
||||
#endif//__QF_Vulkan_render_h
|
||||
|
|
|
@ -46,6 +46,7 @@ typedef struct vulkan_ctx_s {
|
|||
uint32_t swapImageIndex;
|
||||
|
||||
struct scriptctx_s *script_context;
|
||||
struct qfv_renderctx_s *render_context;
|
||||
struct texturectx_s *texture_context;
|
||||
struct matrixctx_s *matrix_context;
|
||||
struct translucentctx_s *translucent_context;
|
||||
|
|
|
@ -91,6 +91,8 @@ vulkan_ParticleSystem (void)
|
|||
static void
|
||||
vulkan_R_Init (void)
|
||||
{
|
||||
QFV_Render_Init (vulkan_ctx);
|
||||
|
||||
Vulkan_CreateStagingBuffers (vulkan_ctx);
|
||||
Vulkan_CreateFrames (vulkan_ctx);
|
||||
Vulkan_Texture_Init (vulkan_ctx);
|
||||
|
|
|
@ -125,27 +125,24 @@ QFV_RunRenderPass (qfv_renderpass_t_ *rp, vulkan_ctx_t *ctx)
|
|||
QFV_CmdEndLabel (device, cmd);
|
||||
}
|
||||
|
||||
static exprsym_t qfv_renderpass_task_symbols[] = {
|
||||
|
||||
{}
|
||||
};
|
||||
|
||||
void
|
||||
QFV_LoadRenderPass (vulkan_ctx_t *ctx)
|
||||
{
|
||||
|
||||
exprtab_t task_tab = { qfv_renderpass_task_symbols, 0 };
|
||||
exprctx_t ectx = {
|
||||
.symtab = &task_tab,
|
||||
.hashctx = &ctx->script_context->hashctx,
|
||||
};
|
||||
cexpr_init_symtab (&task_tab, &ectx);
|
||||
|
||||
qfv_renderctx_t rctx = { .task_functions = &task_tab };
|
||||
__auto_type rctx = ctx->render_context;
|
||||
|
||||
plitem_t *item = Vulkan_GetConfig (ctx, "main_def");
|
||||
__auto_type ri = QFV_ParseRenderInfo (ctx, item, &rctx);
|
||||
printf ("%p\n", ri);
|
||||
|
||||
Hash_DelTable (task_tab.tab);
|
||||
QFV_ParseRenderInfo (ctx, item, rctx);
|
||||
}
|
||||
|
||||
void
|
||||
QFV_Render_Init (vulkan_ctx_t *ctx)
|
||||
{
|
||||
qfv_renderctx_t *rctx = calloc (1, sizeof (*rctx));
|
||||
ctx->render_context = rctx;
|
||||
|
||||
exprctx_t ectx = { .hashctx = &rctx->hashctx };
|
||||
exprsym_t syms[] = { {} };
|
||||
rctx->task_functions.symbols = syms;
|
||||
cexpr_init_symtab (&rctx->task_functions, &ectx);
|
||||
rctx->task_functions.symbols = 0;
|
||||
}
|
||||
|
|
|
@ -1087,7 +1087,7 @@ parse_task_function (const plitem_t *item, void **data,
|
|||
{
|
||||
qfv_renderctx_t *rctx = pctx->data;
|
||||
const char *fname = PL_String (item);
|
||||
exprsym_t *fsym = Hash_Find (rctx->task_functions->tab, fname);
|
||||
exprsym_t *fsym = Hash_Find (rctx->task_functions.tab, fname);
|
||||
|
||||
if (!fsym) {
|
||||
PL_Message (messages, item, "undefined task function %s", fname);
|
||||
|
@ -1145,6 +1145,10 @@ parse_task_params (const plitem_t *item, void **data,
|
|||
{
|
||||
exprfunc_t *func = *(exprfunc_t **) data[0];
|
||||
exprval_t **params = *(exprval_t ***) data[1];
|
||||
if (!func) {
|
||||
PL_Message (messages, item, "task function not set");
|
||||
return 0;
|
||||
}
|
||||
if (PL_A_NumObjects (item) != func->num_params) {
|
||||
PL_Message (messages, item, "incorrect number of parameters");
|
||||
return 0;
|
||||
|
|
Loading…
Reference in a new issue