diff options
author | Samuel Pitoiset <[email protected]> | 2019-01-29 22:18:51 +0100 |
---|---|---|
committer | Samuel Pitoiset <[email protected]> | 2019-02-04 13:17:54 +0100 |
commit | a20c2e38d840c0e46a0eec590dd7b17b3e511664 (patch) | |
tree | 098ee9e2770d074437b511779302645a680849f2 /src/amd/vulkan/radv_meta_clear.c | |
parent | a7c7d811f1916d6489467f0ed18ebd936fba26c6 (diff) |
radv: store the list of attachments for every subpass
This reworks how the depth stencil attachment is used for
simplicity. This also introduces radv_render_pass_compile()
helper that will be used for further optimizations.
Signed-off-by: Samuel Pitoiset <[email protected]>
Reviewed-by: Bas Nieuwenhuizen <[email protected]>
Diffstat (limited to 'src/amd/vulkan/radv_meta_clear.c')
-rw-r--r-- | src/amd/vulkan/radv_meta_clear.c | 41 |
1 files changed, 23 insertions, 18 deletions
diff --git a/src/amd/vulkan/radv_meta_clear.c b/src/amd/vulkan/radv_meta_clear.c index 06f25aa46d7..c68ce1ee8a8 100644 --- a/src/amd/vulkan/radv_meta_clear.c +++ b/src/amd/vulkan/radv_meta_clear.c @@ -423,7 +423,7 @@ emit_color_clear(struct radv_cmd_buffer *cmd_buffer, .color_attachments = (struct radv_subpass_attachment[]) { subpass->color_attachments[clear_att->colorAttachment] }, - .depth_stencil_attachment = (struct radv_subpass_attachment) { VK_ATTACHMENT_UNUSED, VK_IMAGE_LAYOUT_UNDEFINED } + .depth_stencil_attachment = NULL, }; radv_cmd_buffer_set_subpass(cmd_buffer, &clear_subpass); @@ -702,7 +702,7 @@ emit_depthstencil_clear(struct radv_cmd_buffer *cmd_buffer, struct radv_meta_state *meta_state = &device->meta_state; const struct radv_subpass *subpass = cmd_buffer->state.subpass; const struct radv_framebuffer *fb = cmd_buffer->state.framebuffer; - const uint32_t pass_att = subpass->depth_stencil_attachment.attachment; + const uint32_t pass_att = subpass->depth_stencil_attachment->attachment; VkClearDepthStencilValue clear_value = clear_att->clearValue.depthStencil; VkImageAspectFlags aspects = clear_att->aspectMask; const struct radv_image_view *iview = fb->attachments[pass_att].attachment; @@ -731,7 +731,7 @@ emit_depthstencil_clear(struct radv_cmd_buffer *cmd_buffer, iview, samples_log2, aspects, - subpass->depth_stencil_attachment.layout, + subpass->depth_stencil_attachment->layout, clear_rect, clear_value); if (!pipeline) @@ -741,7 +741,7 @@ emit_depthstencil_clear(struct radv_cmd_buffer *cmd_buffer, pipeline); if (depth_view_can_fast_clear(cmd_buffer, iview, aspects, - subpass->depth_stencil_attachment.layout, + subpass->depth_stencil_attachment->layout, clear_rect, clear_value)) radv_update_ds_clear_metadata(cmd_buffer, iview->image, clear_value, aspects); @@ -1536,8 +1536,8 @@ emit_clear(struct radv_cmd_buffer *cmd_buffer, emit_color_clear(cmd_buffer, clear_att, clear_rect, view_mask); } } else { - const uint32_t pass_att = subpass->depth_stencil_attachment.attachment; - VkImageLayout image_layout = subpass->depth_stencil_attachment.layout; + const uint32_t pass_att = subpass->depth_stencil_attachment->attachment; + VkImageLayout image_layout = subpass->depth_stencil_attachment->layout; const struct radv_image_view *iview = fb->attachments[pass_att].attachment; VkClearDepthStencilValue clear_value = clear_att->clearValue.depthStencil; @@ -1580,7 +1580,10 @@ radv_subpass_needs_clear(struct radv_cmd_buffer *cmd_buffer) return true; } - a = cmd_state->subpass->depth_stencil_attachment.attachment; + if (!cmd_state->subpass->depth_stencil_attachment) + return false; + + a = cmd_state->subpass->depth_stencil_attachment->attachment; return radv_attachment_needs_clear(cmd_state, a); } @@ -1649,17 +1652,19 @@ radv_cmd_buffer_clear_subpass(struct radv_cmd_buffer *cmd_buffer) &post_flush); } - uint32_t ds = cmd_state->subpass->depth_stencil_attachment.attachment; - if (radv_attachment_needs_clear(cmd_state, ds)) { - VkClearAttachment clear_att = { - .aspectMask = cmd_state->attachments[ds].pending_clear_aspects, - .clearValue = cmd_state->attachments[ds].clear_value, - }; - - radv_subpass_clear_attachment(cmd_buffer, - &cmd_state->attachments[ds], - &clear_att, &pre_flush, - &post_flush); + if (cmd_state->subpass->depth_stencil_attachment) { + uint32_t ds = cmd_state->subpass->depth_stencil_attachment->attachment; + if (radv_attachment_needs_clear(cmd_state, ds)) { + VkClearAttachment clear_att = { + .aspectMask = cmd_state->attachments[ds].pending_clear_aspects, + .clearValue = cmd_state->attachments[ds].clear_value, + }; + + radv_subpass_clear_attachment(cmd_buffer, + &cmd_state->attachments[ds], + &clear_att, &pre_flush, + &post_flush); + } } radv_meta_restore(&saved_state, cmd_buffer); |