mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-22 12:31:10 +00:00
[vulkan] Support parsing qfv_output_t
This will be needed by the revamped render pass code.
This commit is contained in:
parent
7829ec3adb
commit
2cb3083f97
3 changed files with 73 additions and 33 deletions
|
@ -292,6 +292,13 @@ vkparse_alloc (void *context, size_t size)
|
|||
return cmemalloc (pctx->ectx->memsuper, size);
|
||||
}
|
||||
|
||||
static int
|
||||
parse_ignore (const plfield_t *field, const plitem_t *item,
|
||||
void *data, plitem_t *messages, void *context)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
|
||||
static int
|
||||
parse_single (const plfield_t *field, const plitem_t *item,
|
||||
void *data, plitem_t *messages, void *context)
|
||||
|
@ -649,6 +656,22 @@ parse_VkPipelineLayout (const plitem_t *item, void **data,
|
|||
return ret;
|
||||
}
|
||||
|
||||
exprtype_t VkImage_type = {
|
||||
.name = "VkImage",
|
||||
.size = sizeof (VkImage),
|
||||
.binops = 0,
|
||||
.unops = 0,
|
||||
.data = 0
|
||||
};
|
||||
|
||||
exprtype_t VkImageView_type = {
|
||||
.name = "VkImageView",
|
||||
.size = sizeof (VkImageView),
|
||||
.binops = 0,
|
||||
.unops = 0,
|
||||
.data = 0
|
||||
};
|
||||
|
||||
static int
|
||||
parse_VkImage (const plitem_t *item, void **data, plitem_t *messages,
|
||||
parsectx_t *pctx)
|
||||
|
@ -668,31 +691,29 @@ parse_VkImage (const plitem_t *item, void **data, plitem_t *messages,
|
|||
return 1;
|
||||
}
|
||||
|
||||
plitem_t *imageItem = 0;
|
||||
exprval_t result = { &cexpr_plitem, &imageItem };
|
||||
exprval_t result = { };
|
||||
ectx.result = &result;
|
||||
ectx.item = item;
|
||||
ret = !cexpr_eval_string (path, &ectx);
|
||||
if (ret) {
|
||||
VkImage image;
|
||||
image = QFV_ParseImage (ctx, imageItem, pctx->properties);
|
||||
*handle = (VkImage) image;
|
||||
if (result.type == &cexpr_plitem) {
|
||||
plitem_t *imageItem = *(plitem_t **) result.value;
|
||||
VkImage image;
|
||||
image = QFV_ParseImage (ctx, imageItem, pctx->properties);
|
||||
*handle = (VkImage) image;
|
||||
|
||||
// path not guaranteed to survive cexpr_eval_string due to va
|
||||
path = resource_path (ctx, "images", name);
|
||||
QFV_AddHandle (sctx->images, path, (uint64_t) image);
|
||||
// path not guaranteed to survive cexpr_eval_string due to va
|
||||
path = resource_path (ctx, "images", name);
|
||||
QFV_AddHandle (sctx->images, path, (uint64_t) image);
|
||||
} else if (result.type == &VkImage_type) {
|
||||
*handle = *(VkImage *) result.value;
|
||||
} else {
|
||||
ret = 0;
|
||||
}
|
||||
}
|
||||
return ret;
|
||||
}
|
||||
|
||||
exprtype_t VkImageView_type = {
|
||||
.name = "VkImageView",
|
||||
.size = sizeof (VkImageView),
|
||||
.binops = 0,
|
||||
.unops = 0,
|
||||
.data = 0
|
||||
};
|
||||
|
||||
static int
|
||||
parse_VkImageView (const plfield_t *field, const plitem_t *item, void *data,
|
||||
plitem_t *messages, void *context)
|
||||
|
@ -977,23 +998,6 @@ parse_specialization_data (const plitem_t *item, void **data,
|
|||
|
||||
#include "libs/video/renderer/vulkan/vkparse.cinc"
|
||||
|
||||
static exprsym_t qfv_output_t_symbols[] = {
|
||||
{"format", &VkFormat_type, (void *)field_offset (qfv_output_t, format)},
|
||||
{"extent", &VkExtent2D_type, (void *)field_offset (qfv_output_t, extent)},
|
||||
{"view", &VkImageView_type, (void *)field_offset (qfv_output_t, view)},
|
||||
{ }
|
||||
};
|
||||
static exprtab_t qfv_output_t_symtab = {
|
||||
qfv_output_t_symbols,
|
||||
};
|
||||
exprtype_t qfv_output_t_type = {
|
||||
.name = "qfv_output_t",
|
||||
.size = sizeof (qfv_output_t),
|
||||
.binops = cexpr_struct_binops,
|
||||
.unops = 0,
|
||||
.data = &qfv_output_t_symtab,
|
||||
};
|
||||
|
||||
static exprsym_t vulkan_frameset_t_symbols[] = {
|
||||
{"size", &cexpr_size_t, (void *)field_offset (vulkan_frameset_t, size)},
|
||||
{ }
|
||||
|
@ -1590,6 +1594,23 @@ QFV_ParseRGBA (vulkan_ctx_t *ctx, float *rgba, plitem_t *plist,
|
|||
return ret;
|
||||
}
|
||||
|
||||
int
|
||||
QFV_ParseOutput (vulkan_ctx_t *ctx, qfv_output_t *output, plitem_t *plist,
|
||||
plitem_t *properties)
|
||||
{
|
||||
memsuper_t *memsuper = new_memsuper ();
|
||||
int ret = 0;
|
||||
qfv_output_t op = {};
|
||||
|
||||
if (parse_object (ctx, memsuper, plist, parse_qfv_output_t, &op,
|
||||
properties)) {
|
||||
memcpy (output, &op, sizeof (*output));
|
||||
ret = 1;
|
||||
}
|
||||
delete_memsuper (memsuper);
|
||||
return ret;
|
||||
}
|
||||
|
||||
int vulkan_frame_count;
|
||||
static cvar_t vulkan_frame_count_cvar = {
|
||||
.name = "vulkan_frame_count",
|
||||
|
|
|
@ -75,4 +75,6 @@ struct qfv_subpassset_s *QFV_ParseSubpasses (vulkan_ctx_t *ctx,
|
|||
plitem_t *properties);
|
||||
int QFV_ParseRGBA (vulkan_ctx_t *ctx, float *rgba, plitem_t *plist,
|
||||
plitem_t *properties);
|
||||
int QFV_ParseOutput (vulkan_ctx_t *ctx, qfv_output_t *output, plitem_t *plist,
|
||||
plitem_t *properties);
|
||||
#endif//__vkparse_h
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
VkRenderPassMultiviewCreateInfo,
|
||||
|
||||
qfv_subpass_t,
|
||||
qfv_output_t,
|
||||
);
|
||||
parse = {
|
||||
VkSubpassDescription = {
|
||||
|
@ -392,5 +393,21 @@
|
|||
string = name;
|
||||
};
|
||||
};
|
||||
|
||||
qfv_output_s = {
|
||||
.name = qfv_output_t;
|
||||
extent = auto;
|
||||
image = {
|
||||
type = (readonly, VkImage);
|
||||
value = image;
|
||||
};
|
||||
view = {
|
||||
type = (readonly, VkImageView);
|
||||
value = view;
|
||||
};
|
||||
format = auto;
|
||||
frames = auto;
|
||||
finalLayout = auto;
|
||||
};
|
||||
};
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue