[Mesa-dev] [PATCH 3/7] anv/blorp: Use regular blorp clears for subpass clears
Jason Ekstrand
jason at jlekstrand.net
Sat Nov 19 19:40:05 UTC 2016
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.
---
src/intel/vulkan/anv_blorp.c | 29 +++++++++++++++++++----------
1 file changed, 19 insertions(+), 10 deletions(-)
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index ae650de..f4b6c7e 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -1163,24 +1163,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;
--
2.5.0.400.gff86faf
More information about the mesa-dev
mailing list