mirror of
https://git.code.sf.net/p/quake/quakeforge
synced 2024-11-21 20:11:24 +00:00
[vulkan] Move attachement specs into frambuffer
This does a better job of keeping related data together.
This commit is contained in:
parent
14b24e5b75
commit
3235bb70c8
4 changed files with 69 additions and 71 deletions
|
@ -195,7 +195,7 @@ typedef struct qfv_subpassinfo_s {
|
|||
} qfv_subpassinfo_t;
|
||||
|
||||
typedef struct qfv_framebufferinfo_s {
|
||||
qfv_reference_t *attachments;
|
||||
qfv_attachmentinfo_t *attachments;
|
||||
uint32_t num_attachments;
|
||||
uint32_t width;
|
||||
uint32_t height;
|
||||
|
@ -206,8 +206,6 @@ typedef struct qfv_renderpassinfo_s {
|
|||
vec4f_t color;
|
||||
const char *name;
|
||||
void *pNext;
|
||||
uint32_t num_attachments;
|
||||
qfv_attachmentinfo_t *attachments;
|
||||
qfv_framebufferinfo_t framebuffer;
|
||||
uint32_t num_subpasses;
|
||||
qfv_subpassinfo_t *subpasses;
|
||||
|
|
|
@ -146,7 +146,7 @@ count_sp_stuff (qfv_subpassinfo_t *spi, objcount_t *counts)
|
|||
static void
|
||||
count_rp_stuff (qfv_renderpassinfo_t *rpi, objcount_t *counts)
|
||||
{
|
||||
counts->num_attachments += rpi->num_attachments;
|
||||
counts->num_attachments += rpi->framebuffer.num_attachments;
|
||||
counts->num_subpasses += rpi->num_subpasses;
|
||||
for (uint32_t i = 0; i < rpi->num_subpasses; i++) {
|
||||
count_sp_stuff (&rpi->subpasses[i], counts);
|
||||
|
@ -519,8 +519,8 @@ init_plCreate (VkGraphicsPipelineCreateInfo *plc, const qfv_pipelineinfo_t *pli,
|
|||
static uint32_t __attribute__((pure))
|
||||
find_attachment (qfv_reference_t *ref, objstate_t *s)
|
||||
{
|
||||
for (uint32_t i = 0; i < s->rpi->num_attachments; i++) {
|
||||
__auto_type a = &s->rpi->attachments[i];
|
||||
for (uint32_t i = 0; i < s->rpi->framebuffer.num_attachments; i++) {
|
||||
__auto_type a = &s->rpi->framebuffer.attachments[i];
|
||||
if (strcmp (ref->name, a->name) == 0) {
|
||||
return i;
|
||||
}
|
||||
|
@ -671,8 +671,8 @@ init_rpCreate (uint32_t index, const qfv_renderinfo_t *rinfo, objstate_t *s)
|
|||
__auto_type subpasses = &s->ptr.subpass[s->inds.num_subpasses];
|
||||
__auto_type dependencies = &s->ptr.depend[s->inds.num_dependencies];
|
||||
|
||||
for (uint32_t i = 0; i < s->rpi->num_attachments; i++) {
|
||||
init_atCreate (i, s->rpi->attachments, s);
|
||||
for (uint32_t i = 0; i < s->rpi->framebuffer.num_attachments; i++) {
|
||||
init_atCreate (i, s->rpi->framebuffer.attachments, s);
|
||||
s->inds.num_attachments++;
|
||||
}
|
||||
|
||||
|
@ -685,7 +685,7 @@ init_rpCreate (uint32_t index, const qfv_renderinfo_t *rinfo, objstate_t *s)
|
|||
|
||||
*s->rpc = (VkRenderPassCreateInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_RENDER_PASS_CREATE_INFO,
|
||||
.attachmentCount = s->rpi->num_attachments,
|
||||
.attachmentCount = s->rpi->framebuffer.num_attachments,
|
||||
.pAttachments = attachments,
|
||||
.subpassCount = s->rpi->num_subpasses,
|
||||
.pSubpasses = subpasses,
|
||||
|
@ -777,12 +777,12 @@ init_renderpass (qfv_renderpass_t *rp, qfv_renderpassinfo_t *rpinfo,
|
|||
.beginInfo = (VkRenderPassBeginInfo) {
|
||||
.sType = VK_STRUCTURE_TYPE_RENDER_PASS_BEGIN_INFO,
|
||||
.renderPass = s->ptr.rp[s->inds.num_renderpasses],
|
||||
.clearValueCount = rpinfo->num_attachments,
|
||||
.clearValueCount = rpinfo->framebuffer.num_attachments,
|
||||
.pClearValues = &jp->clearvalues[s->inds.num_attachments],
|
||||
},
|
||||
.subpassContents = VK_SUBPASS_CONTENTS_SECONDARY_COMMAND_BUFFERS,
|
||||
};
|
||||
s->inds.num_attachments += rpinfo->num_attachments;
|
||||
s->inds.num_attachments += rpinfo->framebuffer.num_attachments;
|
||||
for (uint32_t i = 0; i < rpinfo->num_subpasses; i++) {
|
||||
init_subpass (&rp->subpasses[i], &rpinfo->subpasses[i], jp, s);
|
||||
rp->subpasses[i].inherit.renderPass = rp->beginInfo.renderPass;
|
||||
|
|
|
@ -846,55 +846,55 @@ output = {
|
|||
renderpasses = {
|
||||
deferred = {
|
||||
color = "[0, 1, 0, 1]";
|
||||
attachments = {
|
||||
depth = {
|
||||
@inherit = $attachment_base;
|
||||
format = $images.depth.format;
|
||||
loadOp = clear;
|
||||
finalLayout = depth_stencil_attachment_optimal;
|
||||
clearValue = { depthStencil = { depth = 1; stencil = 0; }; };
|
||||
view = $imageviews.depth;
|
||||
};
|
||||
color = {
|
||||
@inherit = $attachment_base;
|
||||
format = $images.color.format;
|
||||
loadOp = clear;
|
||||
view = $imageviews.color;
|
||||
};
|
||||
emission = {
|
||||
@inherit = $attachment_base;
|
||||
format = $images.emission.format;
|
||||
loadOp = clear;
|
||||
view = $imageviews.emission;
|
||||
};
|
||||
normal = {
|
||||
@inherit = $attachment_base;
|
||||
format = $images.normal.format;
|
||||
view = $imageviews.normal;
|
||||
};
|
||||
position = {
|
||||
@inherit = $attachment_base;
|
||||
format = $images.position.format;
|
||||
view = $imageviews.position;
|
||||
};
|
||||
opaque = {
|
||||
@inherit = $attachment_base;
|
||||
format = $images.opaque.format;
|
||||
view = $imageviews.opaque;
|
||||
};
|
||||
output = {
|
||||
@inherit = $attachment_base;
|
||||
format = $render_output.format;
|
||||
loadOp = clear;
|
||||
storeOp = store;
|
||||
finalLayout = $render_output.finalLayout;
|
||||
view = $imageviews.output;
|
||||
};
|
||||
};
|
||||
framebuffer = {
|
||||
width = $render_output.extent.width;
|
||||
height = $render_output.extent.height;
|
||||
layers = 1;
|
||||
attachments = {
|
||||
depth = {
|
||||
@inherit = $attachment_base;
|
||||
format = $images.depth.format;
|
||||
loadOp = clear;
|
||||
finalLayout = depth_stencil_attachment_optimal;
|
||||
clearValue = { depthStencil = { depth = 1; stencil = 0; }; };
|
||||
view = $imageviews.depth;
|
||||
};
|
||||
color = {
|
||||
@inherit = $attachment_base;
|
||||
format = $images.color.format;
|
||||
loadOp = clear;
|
||||
view = $imageviews.color;
|
||||
};
|
||||
emission = {
|
||||
@inherit = $attachment_base;
|
||||
format = $images.emission.format;
|
||||
loadOp = clear;
|
||||
view = $imageviews.emission;
|
||||
};
|
||||
normal = {
|
||||
@inherit = $attachment_base;
|
||||
format = $images.normal.format;
|
||||
view = $imageviews.normal;
|
||||
};
|
||||
position = {
|
||||
@inherit = $attachment_base;
|
||||
format = $images.position.format;
|
||||
view = $imageviews.position;
|
||||
};
|
||||
opaque = {
|
||||
@inherit = $attachment_base;
|
||||
format = $images.opaque.format;
|
||||
view = $imageviews.opaque;
|
||||
};
|
||||
output = {
|
||||
@inherit = $attachment_base;
|
||||
format = $render_output.format;
|
||||
loadOp = clear;
|
||||
storeOp = store;
|
||||
finalLayout = $render_output.finalLayout;
|
||||
view = $imageviews.output;
|
||||
};
|
||||
};
|
||||
};
|
||||
subpasses = {
|
||||
depth = {
|
||||
|
@ -1242,20 +1242,20 @@ renderpasses = {
|
|||
};
|
||||
output = {
|
||||
color = "[0, 1, 1, 1]";
|
||||
attachments = {
|
||||
output = {
|
||||
@inherit = $attachment_base;
|
||||
format = $render_output.format;
|
||||
loadOp = clear;
|
||||
storeOp = store;
|
||||
finalLayout = present_src_khr;
|
||||
view = $render_output.view;
|
||||
};
|
||||
};
|
||||
framebuffer = {
|
||||
width = $render_output.extent.width;
|
||||
height = $render_output.extent.height;
|
||||
layers = 1;
|
||||
attachments = {
|
||||
output = {
|
||||
@inherit = $attachment_base;
|
||||
format = $render_output.format;
|
||||
loadOp = clear;
|
||||
storeOp = store;
|
||||
finalLayout = present_src_khr;
|
||||
view = $render_output.view;
|
||||
};
|
||||
};
|
||||
};
|
||||
subpasses = {
|
||||
compose = {
|
||||
|
|
|
@ -629,6 +629,11 @@ parse = {
|
|||
width = auto;
|
||||
height = auto;
|
||||
layers = auto;
|
||||
attachments = {
|
||||
type = (labeledarray, qfv_attachmentinfo_t, name);
|
||||
size = num_attachments;
|
||||
values = attachments;
|
||||
};
|
||||
};
|
||||
qfv_reference_s = {
|
||||
.name = qfv_reference_t;
|
||||
|
@ -641,11 +646,6 @@ parse = {
|
|||
qfv_renderpassinfo_s = {
|
||||
.name = qfv_renderpassinfo_t;
|
||||
color = auto;
|
||||
attachments = {
|
||||
type = (labeledarray, qfv_attachmentinfo_t, name);
|
||||
size = num_attachments;
|
||||
values = attachments;
|
||||
};
|
||||
framebuffer = auto;
|
||||
subpasses = {
|
||||
type = (labeledarray, qfv_subpassinfo_t, name);
|
||||
|
|
Loading…
Reference in a new issue