anv: allocate fake render pass for continuation command buffers
v4: Assert if there's no VkCommandBufferInheritanceRenderingInfoKHR (Lionel) Reviewed-by: Lionel Landwerlin <lionel.g.landwerlin@intel.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/13980>
This commit is contained in:
@@ -3086,6 +3086,8 @@ struct anv_cmd_state {
|
|||||||
* is one of the states in attachment_states.
|
* is one of the states in attachment_states.
|
||||||
*/
|
*/
|
||||||
struct anv_state null_surface_state;
|
struct anv_state null_surface_state;
|
||||||
|
|
||||||
|
struct anv_dynamic_render_pass dynamic_render_pass;
|
||||||
};
|
};
|
||||||
|
|
||||||
struct anv_cmd_pool {
|
struct anv_cmd_pool {
|
||||||
|
@@ -1817,43 +1817,75 @@ genX(BeginCommandBuffer)(
|
|||||||
assert(pBeginInfo->pInheritanceInfo);
|
assert(pBeginInfo->pInheritanceInfo);
|
||||||
ANV_FROM_HANDLE(anv_render_pass, pass,
|
ANV_FROM_HANDLE(anv_render_pass, pass,
|
||||||
pBeginInfo->pInheritanceInfo->renderPass);
|
pBeginInfo->pInheritanceInfo->renderPass);
|
||||||
struct anv_subpass *subpass =
|
struct anv_subpass *subpass;
|
||||||
&pass->subpasses[pBeginInfo->pInheritanceInfo->subpass];
|
if (!pass) {
|
||||||
ANV_FROM_HANDLE(anv_framebuffer, framebuffer,
|
const VkCommandBufferInheritanceRenderingInfoKHR *inheritance_info =
|
||||||
pBeginInfo->pInheritanceInfo->framebuffer);
|
vk_find_struct_const(pBeginInfo->pInheritanceInfo->pNext,
|
||||||
|
COMMAND_BUFFER_INHERITANCE_RENDERING_INFO_KHR);
|
||||||
|
assert(inheritance_info);
|
||||||
|
struct anv_dynamic_pass_create_info info = {
|
||||||
|
.viewMask = inheritance_info->viewMask,
|
||||||
|
.colorAttachmentCount = inheritance_info->colorAttachmentCount,
|
||||||
|
.pColorAttachmentFormats = inheritance_info->pColorAttachmentFormats,
|
||||||
|
.depthAttachmentFormat = inheritance_info->depthAttachmentFormat,
|
||||||
|
.stencilAttachmentFormat = inheritance_info->stencilAttachmentFormat,
|
||||||
|
.rasterizationSamples = inheritance_info->rasterizationSamples,
|
||||||
|
};
|
||||||
|
anv_dynamic_pass_init(&cmd_buffer->state.dynamic_render_pass, &info);
|
||||||
|
pass = &cmd_buffer->state.dynamic_render_pass.pass;
|
||||||
|
subpass = &cmd_buffer->state.dynamic_render_pass.subpass;
|
||||||
|
|
||||||
cmd_buffer->state.pass = pass;
|
result = cmd_buffer_alloc_state_attachments(cmd_buffer,
|
||||||
cmd_buffer->state.subpass = subpass;
|
pass->attachment_count);
|
||||||
|
if (result != VK_SUCCESS)
|
||||||
|
return result;
|
||||||
|
|
||||||
/* This is optional in the inheritance info. */
|
result = genX(cmd_buffer_alloc_att_surf_states)(cmd_buffer, pass,
|
||||||
cmd_buffer->state.framebuffer = framebuffer;
|
subpass);
|
||||||
|
if (result != VK_SUCCESS)
|
||||||
|
return result;
|
||||||
|
|
||||||
result = genX(cmd_buffer_setup_attachments)(cmd_buffer, pass,
|
cmd_buffer->state.pass = pass;
|
||||||
framebuffer, NULL);
|
cmd_buffer->state.subpass = subpass;
|
||||||
if (result != VK_SUCCESS)
|
} else {
|
||||||
return result;
|
subpass = &pass->subpasses[pBeginInfo->pInheritanceInfo->subpass];
|
||||||
|
|
||||||
result = genX(cmd_buffer_alloc_att_surf_states)(cmd_buffer, pass,
|
ANV_FROM_HANDLE(anv_framebuffer, framebuffer,
|
||||||
subpass);
|
pBeginInfo->pInheritanceInfo->framebuffer);
|
||||||
if (result != VK_SUCCESS)
|
|
||||||
return result;
|
|
||||||
|
|
||||||
/* Record that HiZ is enabled if we can. */
|
cmd_buffer->state.pass = pass;
|
||||||
if (cmd_buffer->state.framebuffer) {
|
cmd_buffer->state.subpass = subpass;
|
||||||
const struct anv_image_view * const iview =
|
|
||||||
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
|
||||||
|
|
||||||
if (iview) {
|
/* This is optional in the inheritance info. */
|
||||||
VkImageLayout layout =
|
cmd_buffer->state.framebuffer = framebuffer;
|
||||||
cmd_buffer->state.subpass->depth_stencil_attachment->layout;
|
|
||||||
|
|
||||||
enum isl_aux_usage aux_usage =
|
result = genX(cmd_buffer_setup_attachments)(cmd_buffer, pass,
|
||||||
anv_layout_to_aux_usage(&cmd_buffer->device->info, iview->image,
|
framebuffer, NULL);
|
||||||
VK_IMAGE_ASPECT_DEPTH_BIT,
|
if (result != VK_SUCCESS)
|
||||||
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
|
return result;
|
||||||
layout);
|
|
||||||
|
|
||||||
cmd_buffer->state.hiz_enabled = isl_aux_usage_has_hiz(aux_usage);
|
result = genX(cmd_buffer_alloc_att_surf_states)(cmd_buffer, pass,
|
||||||
|
subpass);
|
||||||
|
if (result != VK_SUCCESS)
|
||||||
|
return result;
|
||||||
|
|
||||||
|
/* Record that HiZ is enabled if we can. */
|
||||||
|
if (cmd_buffer->state.framebuffer) {
|
||||||
|
const struct anv_image_view * const iview =
|
||||||
|
anv_cmd_buffer_get_depth_stencil_view(cmd_buffer);
|
||||||
|
|
||||||
|
if (iview) {
|
||||||
|
VkImageLayout layout =
|
||||||
|
cmd_buffer->state.subpass->depth_stencil_attachment->layout;
|
||||||
|
|
||||||
|
enum isl_aux_usage aux_usage =
|
||||||
|
anv_layout_to_aux_usage(&cmd_buffer->device->info, iview->image,
|
||||||
|
VK_IMAGE_ASPECT_DEPTH_BIT,
|
||||||
|
VK_IMAGE_USAGE_DEPTH_STENCIL_ATTACHMENT_BIT,
|
||||||
|
layout);
|
||||||
|
|
||||||
|
cmd_buffer->state.hiz_enabled = isl_aux_usage_has_hiz(aux_usage);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user