[Mesa-dev] [PATCH 17/24] anv/blorp: Add a surface-state-based CCS resolve function
Nanley Chery
nanleychery at gmail.com
Thu May 11 19:05:24 UTC 2017
This will be used in conjunction with the buffer of clear values.
v2 (Jason Ekstrand):
- Omit BLORP_BATCH_NO_EMIT_DEPTH_STENCIL
Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
---
src/intel/vulkan/anv_blorp.c | 40 ++++++++++++++++++++++++++++++++++++++++
src/intel/vulkan/anv_private.h | 6 ++++++
2 files changed, 46 insertions(+)
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index 3aa353c15c..24f03367e8 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -1611,3 +1611,43 @@ 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, 0);
+
+ 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_attachment(&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 30147801a6..fa5fc42f1f 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -2117,6 +2117,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