mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-01 12:28:07 +02:00
vulkan: add support for vkCustomResolveCreateInfoEXT
This basically remaps color attachment formats for the resolve operation. Co-Authored-by: Connor Abbott <cwabbott0@gmail.com> Signed-off-by: Samuel Pitoiset <samuel.pitoiset@gmail.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/38442>
This commit is contained in:
parent
d46be8fbf2
commit
d700205a9d
2 changed files with 32 additions and 12 deletions
|
|
@ -1247,6 +1247,10 @@ vk_render_pass_state_init(struct vk_render_pass_state *rp,
|
|||
|
||||
rp->view_mask = r_info->viewMask;
|
||||
|
||||
const VkCustomResolveCreateInfoEXT *crc_info =
|
||||
vk_find_struct_const(info->pNext, CUSTOM_RESOLVE_CREATE_INFO_EXT);
|
||||
rp->custom_resolve = crc_info != NULL && crc_info->customResolve;
|
||||
|
||||
/* From the Vulkan 1.3.218 spec description of pre-rasterization state:
|
||||
*
|
||||
* "Fragment shader state is defined by:
|
||||
|
|
@ -1271,20 +1275,23 @@ vk_render_pass_state_init(struct vk_render_pass_state *rp,
|
|||
|
||||
assert(r_info->colorAttachmentCount <= MESA_VK_MAX_COLOR_ATTACHMENTS);
|
||||
rp->color_attachment_count = r_info->colorAttachmentCount;
|
||||
for (uint32_t i = 0; i < r_info->colorAttachmentCount; i++) {
|
||||
rp->color_attachment_formats[i] = r_info->pColorAttachmentFormats[i];
|
||||
if (r_info->pColorAttachmentFormats[i] != VK_FORMAT_UNDEFINED)
|
||||
rp->attachments |= MESA_VK_RP_ATTACHMENT_COLOR_BIT(i);
|
||||
|
||||
if (rp->custom_resolve) {
|
||||
assert(crc_info->colorAttachmentCount == r_info->colorAttachmentCount);
|
||||
|
||||
for (uint32_t i = 0; i < crc_info->colorAttachmentCount; i++)
|
||||
rp->color_attachment_formats[i] = crc_info->pColorAttachmentFormats[i];
|
||||
|
||||
rp->depth_attachment_format = crc_info->depthAttachmentFormat;
|
||||
rp->stencil_attachment_format = crc_info->stencilAttachmentFormat;
|
||||
} else {
|
||||
for (uint32_t i = 0; i < r_info->colorAttachmentCount; i++)
|
||||
rp->color_attachment_formats[i] = r_info->pColorAttachmentFormats[i];
|
||||
|
||||
rp->depth_attachment_format = r_info->depthAttachmentFormat;
|
||||
rp->stencil_attachment_format = r_info->stencilAttachmentFormat;
|
||||
}
|
||||
|
||||
rp->depth_attachment_format = r_info->depthAttachmentFormat;
|
||||
if (r_info->depthAttachmentFormat != VK_FORMAT_UNDEFINED)
|
||||
rp->attachments |= MESA_VK_RP_ATTACHMENT_DEPTH_BIT;
|
||||
|
||||
rp->stencil_attachment_format = r_info->stencilAttachmentFormat;
|
||||
if (r_info->stencilAttachmentFormat != VK_FORMAT_UNDEFINED)
|
||||
rp->attachments |= MESA_VK_RP_ATTACHMENT_STENCIL_BIT;
|
||||
|
||||
const VkAttachmentSampleCountInfoAMD *asc_info =
|
||||
vk_get_pipeline_sample_count_info_amd(info);
|
||||
if (asc_info != NULL) {
|
||||
|
|
@ -1295,6 +1302,16 @@ vk_render_pass_state_init(struct vk_render_pass_state *rp,
|
|||
|
||||
rp->depth_stencil_attachment_samples = asc_info->depthStencilAttachmentSamples;
|
||||
}
|
||||
|
||||
for (uint32_t i = 0; i < r_info->colorAttachmentCount; i++) {
|
||||
if (rp->color_attachment_formats[i] != VK_FORMAT_UNDEFINED)
|
||||
rp->attachments |= MESA_VK_RP_ATTACHMENT_COLOR_BIT(i);
|
||||
}
|
||||
if (rp->depth_attachment_format != VK_FORMAT_UNDEFINED)
|
||||
rp->attachments |= MESA_VK_RP_ATTACHMENT_DEPTH_BIT;
|
||||
|
||||
if (rp->stencil_attachment_format != VK_FORMAT_UNDEFINED)
|
||||
rp->attachments |= MESA_VK_RP_ATTACHMENT_STENCIL_BIT;
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
|||
|
|
@ -794,6 +794,9 @@ struct vk_render_pass_state {
|
|||
|
||||
/** VkAttachmentSampleCountInfoAMD::depthStencilAttachmentSamples */
|
||||
uint8_t depth_stencil_attachment_samples;
|
||||
|
||||
/** VkCustomResolveCreateInfoEXT::customResolve */
|
||||
bool custom_resolve;
|
||||
};
|
||||
|
||||
static inline bool
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue