[vulkan] Remove renderpass from generated code

The creation of a render pass seems to need special handling.
This commit is contained in:
Bill Currie 2021-01-05 17:43:26 +09:00
parent 518befdaed
commit 7c661e7cc5
4 changed files with 78 additions and 32 deletions

View file

@ -44,10 +44,10 @@ typedef struct vulkan_ctx_s {
VkSampleCountFlagBits msaaSamples; // FIXME not here?
struct hashlink_s *hashlinks; //FIXME want per thread
VkSurfaceKHR surface; //FIXME surface = window, so "contains" swapchain
struct plitem_s *pipelineDef;
struct hashtab_s *shaderModules;
struct hashtab_s *setLayouts;
struct hashtab_s *pipelineLayouts;
struct hashtab_s *renderPasses;
VkCommandPool cmdpool;
VkCommandBuffer cmdbuffer;

View file

@ -39,6 +39,81 @@
);
};
};
pipelines = {
something = {
stages = (
{ stage = vertex; name = main; module = passthrough; },
{ stage = fragment; name = main; module = pushcolor; },
);
vertexInput = {
bindings = (
{
binding = 0;
stride = "4 * 4";
inputRate = vertex;
},
);
attributes = (
{
location = 0;
binding = 0;
format = r32g32b32a32_sfloat;
offset = 0;
},
);
};
inputAssembly = {
topology = triangle_list;
primitiveRestartEnable = 0;
};
viewport = {
viewports = (
{
x = 0; y = 0;
width = 640; height = 480;
minDepth = 0; maxDepth = 1000;
}
);
scissors = (
{
offset = { x = 0; y = 0 };
extent = { width = 640; height = 480; };
},
);
};
rasterization = {
depthClampEnable = 1;
rasterizerDiscardEnable = 0;
polygonMode = fill;
cullMode = back;
frontFace = counter_clockwise;
depthBiasEnable = 0;
lineWidth = 1;
};
multisample = {
rasterizationSamples = $msaaSamples;
sampleShadingEnable = 0;
minSampleShading = 0.5;
alphaToCoverageEnable = 0;
alphaToOneEnable = 0;
};
depthStencil = {
depthTestEnable = 1;
depthWriteEnable = 1;
depthCompareOp = less;
depthBoundsTestEnable = 0;
stencilTestEnable = 0;
};
colorBlend = {
logicOpEnable = 0;
};
dymamic = {
dymamicState = ( viewport, scissor );
};
layout = something;
renderPass = renderpass;
};
};
renderpass = {
attachments = (
{
@ -108,5 +183,5 @@
dependencyFlags = 0;
}
);
}
};
}

View file

@ -435,19 +435,6 @@ pipelineLayout_free (void *hr, void *_ctx)
handleref_free (handleref, ctx);
}
static void
renderPass_free (void *hr, void *_ctx)
{
__auto_type handleref = (handleref_t *) hr;
__auto_type renderPass = (VkRenderPass) handleref->handle;
__auto_type ctx = (vulkan_ctx_t *) _ctx;
qfv_device_t *device = ctx->device;
qfv_devfuncs_t *dfunc = device->funcs;
dfunc->vkDestroyRenderPass (device->dev, renderPass, 0);
handleref_free (handleref, ctx);
}
static hashtab_t *enum_symtab;
static int
@ -574,9 +561,6 @@ QFV_ParseResources (vulkan_ctx_t *ctx, plitem_t *pipelinedef)
ctx->pipelineLayouts = Hash_NewTable (23, handleref_getkey,
pipelineLayout_free,
ctx, &exprctx.hashlinks);
ctx->renderPasses = Hash_NewTable (23, handleref_getkey,
renderPass_free,
ctx, &exprctx.hashlinks);
}
for (parseres_t *res = parse_resources; res->name; res++) {

View file

@ -31,11 +31,6 @@
class = "set layout";
create = vkCreateDescriptorSetLayout;
};
VkRenderPass = {
symtab = renderPasses;
class = "render pass";
create = vkCreateRenderPass;
};
VkPipelineLayout = {
symtab = pipelineLayouts;
class = "pipeline layout";
@ -129,7 +124,7 @@
};
};
VkPipelineShaderStageCreateInfo = {
flags = auto;
//flags = auto; reserved for future use (Bits enum does not exist)
stage = auto;
name = {
type = string;
@ -324,14 +319,6 @@
});
value = layout;
};
renderPass = {
type = (single, {
parse_type = (QFDictionary, QFString);
type = VkRenderPass;
parser = parse_VkRenderPass;
});
value = renderPass;
};
basePipelineHandle = {
type = (custom, QFString, parse_BasePipeline);
fields = (basePipelineHandle);