[Mesa-dev] [PATCH 14/22] anv/blorp: Add a surface-state-based CCS resolve function

Nanley Chery nanleychery at gmail.com
Thu Apr 27 18:32:13 UTC 2017


This will be used in conjunction with the buffer of clear values.

Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
---
 src/intel/vulkan/anv_blorp.c   | 41 +++++++++++++++++++++++++++++++++++++++++
 src/intel/vulkan/anv_private.h |  6 ++++++
 2 files changed, 47 insertions(+)

diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index 5e7d4b06b8..332ad14b37 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -1611,3 +1611,44 @@ anv_gen8_hiz_op_resolve(struct anv_cmd_buffer *cmd_buffer,
    blorp_gen6_hiz_op(&batch, &surf, 0, 0, op);
    blorp_batch_finish(&batch);
 }
+
+void
+anv_ccs_resolve(struct anv_cmd_buffer * const cmd_buffer,
+                const struct anv_state surface_state,
+                const struct anv_image * const image,
+                const uint8_t level, const uint32_t layer,
+                const enum blorp_fast_clear_op op)
+{
+   assert(cmd_buffer && image);
+
+   /* This image must have a CCS buffer. */
+   assert(anv_image_has_color_aux(image) &&
+          image->samples == 1);
+
+   /* This level and layer must have auxiliary data. */
+   assert(level < anv_color_aux_levels(image));
+   assert(layer < anv_color_aux_layers(image, level));
+
+   /* Create a binding table for this surface state. */
+   uint32_t binding_table;
+   VkResult result =
+      binding_table_for_surface_state(cmd_buffer, surface_state,
+                                      &binding_table);
+   if (result != VK_SUCCESS)
+      return;
+
+   struct blorp_batch batch;
+   blorp_batch_init(&cmd_buffer->device->blorp, &batch, cmd_buffer,
+                    BLORP_BATCH_NO_EMIT_DEPTH_STENCIL);
+
+   struct blorp_surf surf;
+   get_blorp_surf_for_anv_image(image, VK_IMAGE_ASPECT_COLOR_BIT,
+                                image->aux_usage == ISL_AUX_USAGE_CCS_E ?
+                                ISL_AUX_USAGE_CCS_E : ISL_AUX_USAGE_CCS_D,
+                                &surf);
+
+   blorp_ccs_resolve_bt(&batch, binding_table, &surf, level, layer,
+                        image->color_surface.isl.format, op);
+
+   blorp_batch_finish(&batch);
+}
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index b49a5a0009..667176270a 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -2040,6 +2040,12 @@ void
 anv_gen8_hiz_op_resolve(struct anv_cmd_buffer *cmd_buffer,
                         const struct anv_image *image,
                         enum blorp_hiz_op op);
+void
+anv_ccs_resolve(struct anv_cmd_buffer * const cmd_buffer,
+                const struct anv_state surface_state,
+                const struct anv_image * const image,
+                const uint8_t level, const uint32_t layer,
+                const enum blorp_fast_clear_op op);
 
 enum isl_aux_usage
 anv_layout_to_aux_usage(const struct gen_device_info * const devinfo,
-- 
2.12.2



More information about the mesa-dev mailing list