diff options
author | Nanley Chery <[email protected]> | 2017-02-23 12:11:58 -0800 |
---|---|---|
committer | Nanley Chery <[email protected]> | 2017-03-02 13:17:55 -0800 |
commit | 76b8cc2a1c60eafb50434e41e95a801b43d58688 (patch) | |
tree | 1ecc53ea2f95af1ad37842d8a72dc7f3a6c71cc4 /src/intel/vulkan/genX_cmd_buffer.c | |
parent | 0a72b5f3cb443d5ce0d96c3533cb2f42adb08c07 (diff) |
anv/cmd_buffer: Centralize automatic layout transitions
Signed-off-by: Nanley Chery <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Diffstat (limited to 'src/intel/vulkan/genX_cmd_buffer.c')
-rw-r--r-- | src/intel/vulkan/genX_cmd_buffer.c | 54 |
1 files changed, 12 insertions, 42 deletions
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c index 0249999b34f..ae153d23f80 100644 --- a/src/intel/vulkan/genX_cmd_buffer.c +++ b/src/intel/vulkan/genX_cmd_buffer.c @@ -2445,21 +2445,10 @@ genX(cmd_buffer_set_subpass)(struct anv_cmd_buffer *cmd_buffer, cmd_buffer->state.dirty |= ANV_CMD_DIRTY_RENDER_TARGETS; - const struct anv_image_view *iview = - anv_cmd_buffer_get_depth_stencil_view(cmd_buffer); - - if (iview && iview->image->aux_usage == ISL_AUX_USAGE_HIZ) { - const uint32_t ds = subpass->depth_stencil_attachment.attachment; - transition_depth_buffer(cmd_buffer, iview->image, - cmd_buffer->state.attachments[ds].current_layout, - cmd_buffer->state.subpass->depth_stencil_attachment.layout); - cmd_buffer->state.attachments[ds].current_layout = - cmd_buffer->state.subpass->depth_stencil_attachment.layout; - cmd_buffer->state.attachments[ds].aux_usage = - anv_layout_to_aux_usage(&cmd_buffer->device->info, iview->image, - iview->aspect_mask, - cmd_buffer->state.subpass->depth_stencil_attachment.layout); - } + /* Perform transitions to the subpass layout before any writes have + * occurred. + */ + cmd_buffer_subpass_transition_layouts(cmd_buffer, false); cmd_buffer_emit_depth_stencil(cmd_buffer); @@ -2493,21 +2482,12 @@ void genX(CmdNextSubpass)( assert(cmd_buffer->level == VK_COMMAND_BUFFER_LEVEL_PRIMARY); - const struct anv_image_view *iview = - anv_cmd_buffer_get_depth_stencil_view(cmd_buffer); - - if (iview && iview->image->aux_usage == ISL_AUX_USAGE_HIZ) { - const uint32_t ds = cmd_buffer->state.subpass->depth_stencil_attachment.attachment; + anv_cmd_buffer_resolve_subpass(cmd_buffer); - if (cmd_buffer->state.subpass - cmd_buffer->state.pass->subpasses == - cmd_buffer->state.pass->attachments[ds].last_subpass_idx) { - transition_depth_buffer(cmd_buffer, iview->image, - cmd_buffer->state.attachments[ds].current_layout, - cmd_buffer->state.pass->attachments[ds].final_layout); - } - } + /* Perform transitions to the final layout after all writes have occurred. + */ + cmd_buffer_subpass_transition_layouts(cmd_buffer, true); - anv_cmd_buffer_resolve_subpass(cmd_buffer); genX(cmd_buffer_set_subpass)(cmd_buffer, cmd_buffer->state.subpass + 1); } @@ -2516,22 +2496,12 @@ void genX(CmdEndRenderPass)( { ANV_FROM_HANDLE(anv_cmd_buffer, cmd_buffer, commandBuffer); - const struct anv_image_view *iview = - anv_cmd_buffer_get_depth_stencil_view(cmd_buffer); - - if (iview && iview->image->aux_usage == ISL_AUX_USAGE_HIZ) { - const uint32_t ds = cmd_buffer->state.subpass->depth_stencil_attachment.attachment; - - if (cmd_buffer->state.subpass - cmd_buffer->state.pass->subpasses == - cmd_buffer->state.pass->attachments[ds].last_subpass_idx) { - transition_depth_buffer(cmd_buffer, iview->image, - cmd_buffer->state.attachments[ds].current_layout, - cmd_buffer->state.pass->attachments[ds].final_layout); - } - } - anv_cmd_buffer_resolve_subpass(cmd_buffer); + /* Perform transitions to the final layout after all writes have occurred. + */ + cmd_buffer_subpass_transition_layouts(cmd_buffer, true); + cmd_buffer->state.hiz_enabled = false; #ifndef NDEBUG |