static void
radv_render_pass_compile(struct radv_render_pass *pass)
{
+ for (uint32_t i = 0; i < pass->subpass_count; i++) {
+ struct radv_subpass *subpass = &pass->subpasses[i];
+
+ for (uint32_t j = 0; j < subpass->attachment_count; j++) {
+ struct radv_subpass_attachment *subpass_att =
+ &subpass->attachments[j];
+ if (subpass_att->attachment == VK_ATTACHMENT_UNUSED)
+ continue;
+
+ struct radv_render_pass_attachment *pass_att =
+ &pass->attachments[subpass_att->attachment];
+
+ pass_att->first_subpass_idx = UINT32_MAX;
+ }
+ }
+
for (uint32_t i = 0; i < pass->subpass_count; i++) {
struct radv_subpass *subpass = &pass->subpasses[i];
uint32_t color_sample_count = 1, depth_sample_count = 1;
subpass->depth_stencil_attachment->attachment == VK_ATTACHMENT_UNUSED)
subpass->depth_stencil_attachment = NULL;
+ if (subpass->ds_resolve_attachment &&
+ subpass->ds_resolve_attachment->attachment == VK_ATTACHMENT_UNUSED)
+ subpass->ds_resolve_attachment = NULL;
+
for (uint32_t j = 0; j < subpass->attachment_count; j++) {
struct radv_subpass_attachment *subpass_att =
&subpass->attachments[j];
struct radv_render_pass_attachment *pass_att =
&pass->attachments[subpass_att->attachment];
+ if (i < pass_att->first_subpass_idx)
+ pass_att->first_subpass_idx = i;
pass_att->last_subpass_idx = i;
}
subpass->max_sample_count = MAX2(color_sample_count,
depth_sample_count);
+ subpass->color_sample_count = color_sample_count;
+ subpass->depth_sample_count = depth_sample_count;
/* We have to handle resolve attachments specially */
- subpass->has_resolve = false;
+ subpass->has_color_resolve = false;
if (subpass->resolve_attachments) {
for (uint32_t j = 0; j < subpass->color_count; j++) {
struct radv_subpass_attachment *resolve_att =
if (resolve_att->attachment == VK_ATTACHMENT_UNUSED)
continue;
- subpass->has_resolve = true;
+ subpass->has_color_resolve = true;
+ }
+ }
+
+ for (uint32_t j = 0; j < subpass->input_count; ++j) {
+ if (subpass->input_attachments[j].attachment == VK_ATTACHMENT_UNUSED)
+ continue;
+
+ for (uint32_t k = 0; k < subpass->color_count; ++k) {
+ if (subpass->color_attachments[k].attachment == subpass->input_attachments[j].attachment) {
+ subpass->input_attachments[j].in_render_loop = true;
+ subpass->color_attachments[k].in_render_loop = true;
+ }
+ }
+
+ if (subpass->depth_stencil_attachment &&
+ subpass->depth_stencil_attachment->attachment == subpass->input_attachments[j].attachment) {
+ subpass->input_attachments[j].in_render_loop = true;
+ subpass->depth_stencil_attachment->in_render_loop = true;
}
}
}
att->stencil_load_op = pCreateInfo->pAttachments[i].stencilLoadOp;
att->initial_layout = pCreateInfo->pAttachments[i].initialLayout;
att->final_layout = pCreateInfo->pAttachments[i].finalLayout;
+ att->stencil_initial_layout = pCreateInfo->pAttachments[i].initialLayout;
+ att->stencil_final_layout = pCreateInfo->pAttachments[i].finalLayout;
// att->store_op = pCreateInfo->pAttachments[i].storeOp;
// att->stencil_store_op = pCreateInfo->pAttachments[i].stencilStoreOp;
}
subpass->input_attachments[j] = (struct radv_subpass_attachment) {
.attachment = desc->pInputAttachments[j].attachment,
.layout = desc->pInputAttachments[j].layout,
+ .stencil_layout = desc->pInputAttachments[j].layout,
};
}
}
subpass->resolve_attachments[j] = (struct radv_subpass_attachment) {
.attachment = desc->pResolveAttachments[j].attachment,
.layout = desc->pResolveAttachments[j].layout,
+ .stencil_layout = desc->pResolveAttachments[j].layout,
};
}
}
*subpass->depth_stencil_attachment = (struct radv_subpass_attachment) {
.attachment = desc->pDepthStencilAttachment->attachment,
.layout = desc->pDepthStencilAttachment->layout,
+ .stencil_layout = desc->pDepthStencilAttachment->layout,
};
}
}
static unsigned
radv_num_subpass_attachments2(const VkSubpassDescription2KHR *desc)
{
+ const VkSubpassDescriptionDepthStencilResolveKHR *ds_resolve =
+ vk_find_struct_const(desc->pNext,
+ SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE_KHR);
+
return desc->inputAttachmentCount +
desc->colorAttachmentCount +
(desc->pResolveAttachments ? desc->colorAttachmentCount : 0) +
- (desc->pDepthStencilAttachment != NULL);
+ (desc->pDepthStencilAttachment != NULL) +
+ (ds_resolve && ds_resolve->pDepthStencilResolveAttachment);
}
VkResult radv_CreateRenderPass2KHR(
for (uint32_t i = 0; i < pCreateInfo->attachmentCount; i++) {
struct radv_render_pass_attachment *att = &pass->attachments[i];
+ const VkAttachmentDescriptionStencilLayoutKHR *stencil_layout =
+ vk_find_struct_const(pCreateInfo->pAttachments[i].pNext,
+ ATTACHMENT_DESCRIPTION_STENCIL_LAYOUT_KHR);
att->format = pCreateInfo->pAttachments[i].format;
att->samples = pCreateInfo->pAttachments[i].samples;
att->stencil_load_op = pCreateInfo->pAttachments[i].stencilLoadOp;
att->initial_layout = pCreateInfo->pAttachments[i].initialLayout;
att->final_layout = pCreateInfo->pAttachments[i].finalLayout;
+ att->stencil_initial_layout = (stencil_layout ?
+ stencil_layout->stencilInitialLayout :
+ pCreateInfo->pAttachments[i].initialLayout);
+ att->stencil_final_layout = (stencil_layout ?
+ stencil_layout->stencilFinalLayout :
+ pCreateInfo->pAttachments[i].finalLayout);
// att->store_op = pCreateInfo->pAttachments[i].storeOp;
// att->stencil_store_op = pCreateInfo->pAttachments[i].stencilStoreOp;
}
p += desc->inputAttachmentCount;
for (uint32_t j = 0; j < desc->inputAttachmentCount; j++) {
+ const VkAttachmentReferenceStencilLayoutKHR *stencil_attachment =
+ vk_find_struct_const(desc->pInputAttachments[j].pNext,
+ ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR);
+
subpass->input_attachments[j] = (struct radv_subpass_attachment) {
.attachment = desc->pInputAttachments[j].attachment,
.layout = desc->pInputAttachments[j].layout,
+ .stencil_layout = (stencil_attachment ?
+ stencil_attachment->stencilLayout :
+ desc->pInputAttachments[j].layout),
};
}
}
if (desc->pDepthStencilAttachment) {
subpass->depth_stencil_attachment = p++;
+ const VkAttachmentReferenceStencilLayoutKHR *stencil_attachment =
+ vk_find_struct_const(desc->pDepthStencilAttachment->pNext,
+ ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR);
+
*subpass->depth_stencil_attachment = (struct radv_subpass_attachment) {
.attachment = desc->pDepthStencilAttachment->attachment,
.layout = desc->pDepthStencilAttachment->layout,
+ .stencil_layout = (stencil_attachment ?
+ stencil_attachment->stencilLayout :
+ desc->pDepthStencilAttachment->layout),
+ };
+ }
+
+ const VkSubpassDescriptionDepthStencilResolveKHR *ds_resolve =
+ vk_find_struct_const(desc->pNext,
+ SUBPASS_DESCRIPTION_DEPTH_STENCIL_RESOLVE_KHR);
+
+ if (ds_resolve && ds_resolve->pDepthStencilResolveAttachment) {
+ subpass->ds_resolve_attachment = p++;
+
+ const VkAttachmentReferenceStencilLayoutKHR *stencil_resolve_attachment =
+ vk_find_struct_const(ds_resolve->pDepthStencilResolveAttachment->pNext,
+ ATTACHMENT_REFERENCE_STENCIL_LAYOUT_KHR);
+
+ *subpass->ds_resolve_attachment = (struct radv_subpass_attachment) {
+ .attachment = ds_resolve->pDepthStencilResolveAttachment->attachment,
+ .layout = ds_resolve->pDepthStencilResolveAttachment->layout,
+ .stencil_layout = (stencil_resolve_attachment ?
+ stencil_resolve_attachment->stencilLayout :
+ ds_resolve->pDepthStencilResolveAttachment->layout),
};
+
+ subpass->depth_resolve_mode = ds_resolve->depthResolveMode;
+ subpass->stencil_resolve_mode = ds_resolve->stencilResolveMode;
}
}