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:
Iván Briano
2021-11-04 12:30:20 -07:00
parent b32023573d
commit e41436beec
2 changed files with 63 additions and 29 deletions

View File

@@ -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 {

View File

@@ -1817,8 +1817,39 @@ 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) {
const VkCommandBufferInheritanceRenderingInfoKHR *inheritance_info =
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;
result = cmd_buffer_alloc_state_attachments(cmd_buffer,
pass->attachment_count);
if (result != VK_SUCCESS)
return result;
result = genX(cmd_buffer_alloc_att_surf_states)(cmd_buffer, pass,
subpass);
if (result != VK_SUCCESS)
return result;
cmd_buffer->state.pass = pass;
cmd_buffer->state.subpass = subpass;
} else {
subpass = &pass->subpasses[pBeginInfo->pInheritanceInfo->subpass];
ANV_FROM_HANDLE(anv_framebuffer, framebuffer, ANV_FROM_HANDLE(anv_framebuffer, framebuffer,
pBeginInfo->pInheritanceInfo->framebuffer); pBeginInfo->pInheritanceInfo->framebuffer);
@@ -1856,6 +1887,7 @@ genX(BeginCommandBuffer)(
cmd_buffer->state.hiz_enabled = isl_aux_usage_has_hiz(aux_usage); cmd_buffer->state.hiz_enabled = isl_aux_usage_has_hiz(aux_usage);
} }
} }
}
cmd_buffer->state.gfx.dirty |= ANV_CMD_DIRTY_RENDER_TARGETS; cmd_buffer->state.gfx.dirty |= ANV_CMD_DIRTY_RENDER_TARGETS;
} }