From: Jason Ekstrand Date: Fri, 18 Nov 2016 21:35:42 +0000 (-0800) Subject: anv/blorp: Use regular blorp clears for subpass clears X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=878499d323887afff67dd8ef4b1dcbd0a9f1f560;p=mesa.git anv/blorp: Use regular blorp clears for subpass clears At vkCmdNextSubpass time, we have the actual framebuffer so we can use regular blorp_clear for subpass clears. For fast clears, there is no attachment version, so this will make fast clears a bit easier. Reviewed-by: Jordan Justen --- diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c index 0565f0ca926..1b5df6d97c5 100644 --- a/src/intel/vulkan/anv_blorp.c +++ b/src/intel/vulkan/anv_blorp.c @@ -1178,24 +1178,33 @@ anv_cmd_buffer_clear_subpass(struct anv_cmd_buffer *cmd_buffer) .layerCount = cmd_buffer->state.framebuffer->layers, }; + struct anv_framebuffer *fb = cmd_buffer->state.framebuffer; for (uint32_t i = 0; i < cmd_state->subpass->color_count; ++i) { const uint32_t a = cmd_state->subpass->color_attachments[i]; + struct anv_attachment_state *att_state = &cmd_state->attachments[a]; - if (!cmd_state->attachments[a].pending_clear_aspects) + if (!att_state->pending_clear_aspects) continue; - assert(cmd_state->attachments[a].pending_clear_aspects == - VK_IMAGE_ASPECT_COLOR_BIT); + assert(att_state->pending_clear_aspects == VK_IMAGE_ASPECT_COLOR_BIT); - VkClearAttachment clear_att = { - .aspectMask = VK_IMAGE_ASPECT_COLOR_BIT, - .colorAttachment = i, /* Use attachment index relative to subpass */ - .clearValue = cmd_state->attachments[a].clear_value, - }; + struct anv_image_view *iview = fb->attachments[a]; + const struct anv_image *image = iview->image; + struct blorp_surf surf; + get_blorp_surf_for_anv_image(image, VK_IMAGE_ASPECT_COLOR_BIT, + att_state->aux_usage, &surf); + + const VkRect2D render_area = cmd_buffer->state.render_area; - clear_color_attachment(cmd_buffer, &batch, &clear_att, 1, &clear_rect); + blorp_clear(&batch, &surf, iview->isl.format, iview->isl.swizzle, + iview->isl.base_level, + iview->isl.base_array_layer, fb->layers, + render_area.offset.x, render_area.offset.y, + render_area.offset.x + render_area.extent.width, + render_area.offset.y + render_area.extent.height, + vk_to_isl_color(att_state->clear_value.color), NULL); - cmd_state->attachments[a].pending_clear_aspects = 0; + att_state->pending_clear_aspects = 0; } const uint32_t ds = cmd_state->subpass->depth_stencil_attachment;