[vulkan] Parse in descriptor set layouts

For now, just their create info is parsed, but they will be created on
demand. Most importantly, they are named for ease of use in pipeline
layouts.
This commit is contained in:
Bill Currie 2023-02-26 20:54:11 +09:00
parent 44f058869f
commit b10c8dc1a1
3 changed files with 209 additions and 4 deletions

View File

@ -24,6 +24,14 @@ typedef struct qfv_reference_s {
int line;
} qfv_reference_t;
typedef struct qfv_descriptorsetinfo_s {
const char *name;
VkDescriptorSetLayoutCreateFlags flags;
uint32_t num_bindings;
VkDescriptorSetLayoutBinding *bindings;
VkDescriptorSetLayout setLayout;
} qfv_descriptorsetinfo_t;
typedef struct qfv_imageinfo_s {
const char *name;
VkImageCreateFlags flags;
@ -157,6 +165,8 @@ typedef struct qfv_renderinfo_s {
uint32_t num_renderpasses;
qfv_renderpassinfo_t *renderpasses;
qfv_output_t output;
uint32_t num_descriptorsets;
qfv_descriptorsetinfo_t *descriptorsets;
} qfv_renderinfo_t;
typedef struct qfv_label_s {

View File

@ -495,6 +495,190 @@ properties = {
};
}
};
descriptorSetLayouts = {
matrix_set = {
bindings = (
{
binding = 0;
descriptorType = uniform_buffer;
descriptorCount = 1;
stageFlags = vertex|geometry;
},
);
};
quad_data_set = {
bindings = (
{
// glyph texture data
binding = 0;
descriptorType = combined_image_sampler;
descriptorCount = 1;
stageFlags = fragment;
},
{
// glyph geometry data (offset and uv)
binding = 1;
descriptorType = uniform_texel_buffer;
descriptorCount = 1;
stageFlags = vertex;
},
);
};
texture_set = {
bindings = (
{
binding = 0;
descriptorType = combined_image_sampler;
descriptorCount = 1;
stageFlags = fragment|vertex;
},
);
};
oit_set = {
bindings = (
{
binding = 0;
descriptorType = storage_buffer;
descriptorCount = 1;
stageFlags = fragment;
},
{
binding = 1;
descriptorType = storage_buffer;
descriptorCount = 1;
stageFlags = fragment;
},
{
binding = 2;
descriptorType = storage_image;
descriptorCount = 1;
stageFlags = fragment;
},
);
};
entity_set = {
bindings = (
{
binding = 0;
descriptorType = storage_buffer;
descriptorCount = 1;
stageFlags = vertex;
},
);
};
bone_set = {
bindings = (
{
binding = 0;
descriptorType = storage_buffer;
descriptorCount = 1;
stageFlags = vertex;
},
);
};
sprite_set = {
bindings = (
{
binding = 0;
descriptorType = uniform_buffer;
descriptorCount = 1;
stageFlags = vertex;
},
{
binding = 1;
descriptorType = combined_image_sampler;
descriptorCount = 1;
stageFlags = fragment;
},
);
};
lighting_attach = {
bindings = (
{
binding = 0;
descriptorType = input_attachment;
descriptorCount = 1;
stageFlags = fragment;
},
{
binding = 1;
descriptorType = input_attachment;
descriptorCount = 1;
stageFlags = fragment;
},
{
binding = 2;
descriptorType = input_attachment;
descriptorCount = 1;
stageFlags = fragment;
},
{
binding = 3;
descriptorType = input_attachment;
descriptorCount = 1;
stageFlags = fragment;
},
{
binding = 4;
descriptorType = input_attachment;
descriptorCount = 1;
stageFlags = fragment;
},
);
};
lighting_lights = {
bindings = (
{
binding = 0;
descriptorType = uniform_buffer;
descriptorCount = 1;
stageFlags = fragment;
},
);
};
lighting_shadow = {
bindings = (
{
binding = 0;
descriptorType = combined_image_sampler;
descriptorCount = 32;
stageFlags = fragment;
},
);
};
compose_attach = {
bindings = (
{
binding = 0;
descriptorType = input_attachment;
descriptorCount = 1;
stageFlags = fragment;
},
);
};
particle_set = {
bindings = (
{
binding = 0;
descriptorType = storage_buffer;
descriptorCount = 1;
stageFlags = compute;
},
{
binding = 1;
descriptorType = storage_buffer;
descriptorCount = 1;
stageFlags = compute;
},
{
binding = 2;
descriptorType = storage_buffer;
descriptorCount = 1;
stageFlags = compute;
},
);
};
};
images = {
depth = {
@inherit = $image_base;

View File

@ -34,6 +34,7 @@
qfv_subpass_t,
qfv_output_t,
qfv_descriptorsetinfo_t,
qfv_imageinfo_t,
qfv_imageviewinfo_t,
qfv_dependencyinfo_t,
@ -587,10 +588,6 @@
};
qfv_renderpassinfo_s = {
.name = qfv_renderpassinfo_t;
name = {
type = string;
string = name;
};
color = auto;
attachments = {
type = (labeledarray, qfv_attachmentinfo_t, name);
@ -604,6 +601,15 @@
values = subpasses;
};
};
qfv_descriptorsetinfo_s = {
.name = qfv_descriptorsetinfo_t;
flags = auto;
bindings = {
type = (array, VkDescriptorSetLayoutBinding);
size = num_bindings;
values = bindings;
};
};
qfv_renderinfo_s = {
.name = qfv_renderinfo_t;
properties = ignore;
@ -623,6 +629,11 @@
size = num_renderpasses;
values = renderpasses;
};
descriptorSetLayouts = {
type = (labeledarray, qfv_descriptorsetinfo_t, name);
size = num_descriptorsets;
values = descriptorsets;
};
};
};
}