[Mesa-dev] [PATCH 11/24] anv/cmd_buffer: Don't partially fast-clear image layers
Nanley Chery
nanleychery at gmail.com
Thu May 11 19:05:18 UTC 2017
v2 (Jason Ekstrand):
- Don't pass in the command buffer
Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
---
src/intel/vulkan/genX_cmd_buffer.c | 25 +++++++++++++++++++------
1 file changed, 19 insertions(+), 6 deletions(-)
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index b941447873..5cc8235e38 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -228,12 +228,14 @@ color_is_zero_one(VkClearColorValue value, enum isl_format format)
}
static void
-color_attachment_compute_aux_usage(struct anv_device *device,
- struct anv_attachment_state *att_state,
- struct anv_image_view *iview,
- VkRect2D render_area,
+color_attachment_compute_aux_usage(struct anv_device * device,
+ struct anv_cmd_state * cmd_state,
+ uint32_t att, VkRect2D render_area,
union isl_color_value *fast_clear_color)
{
+ struct anv_attachment_state *att_state = &cmd_state->attachments[att];
+ struct anv_image_view *iview = cmd_state->framebuffer->attachments[att];
+
if (iview->image->aux_surface.isl.size == 0) {
att_state->aux_usage = ISL_AUX_USAGE_NONE;
att_state->input_aux_usage = ISL_AUX_USAGE_NONE;
@@ -317,6 +319,17 @@ color_attachment_compute_aux_usage(struct anv_device *device,
if (GEN_GEN <= 8 && !att_state->clear_color_is_zero_one)
att_state->fast_clear = false;
+ /* We can't fast clear a proper subset of a layered image. See
+ * add_clear_values() for more information.
+ */
+ const uint32_t fb_layers = cmd_state->framebuffer->layers;
+ const uint32_t aux_layers = anv_color_aux_layers(iview->image,
+ iview->isl.base_level);
+ if (fb_layers != aux_layers) {
+ assert(fb_layers < aux_layers);
+ att_state->fast_clear = false;
+ }
+
if (att_state->fast_clear) {
memcpy(fast_clear_color->u32, att_state->clear_value.color.uint32,
sizeof(fast_clear_color->u32));
@@ -511,8 +524,8 @@ genX(cmd_buffer_setup_attachments)(struct anv_cmd_buffer *cmd_buffer,
union isl_color_value clear_color = { .u32 = { 0, } };
if (att_aspects == VK_IMAGE_ASPECT_COLOR_BIT) {
color_attachment_compute_aux_usage(cmd_buffer->device,
- &state->attachments[i],
- iview, begin->renderArea,
+ state, i,
+ begin->renderArea,
&clear_color);
struct isl_view view = iview->isl;
--
2.12.2
More information about the mesa-dev
mailing list