[Mesa-dev] [PATCH v2 11/13] anv/blorp: Add a surface-state-based CCS resolve function
Nanley Chery
nanleychery at gmail.com
Thu Jun 22 00:15:20 UTC 2017
This will be used in the next patch.
v2:
- Omit BLORP_BATCH_NO_EMIT_DEPTH_STENCIL (Jason Ekstrand)
- Update commit message.
Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com>
---
src/intel/vulkan/anv_blorp.c | 38 ++++++++++++++++++++++++++++++++++++++
src/intel/vulkan/anv_private.h | 6 ++++++
2 files changed, 44 insertions(+)
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index 60ebbd9dec..c4c744868c 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -1736,3 +1736,41 @@ anv_gen8_hiz_op_resolve(struct anv_cmd_buffer *cmd_buffer,
blorp_hiz_op(&batch, &surf, 0, 0, 1, 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_count,
+ const enum blorp_fast_clear_op op)
+{
+ assert(cmd_buffer && image);
+
+ /* The resolved subresource range must have a CCS buffer. */
+ assert(level < anv_image_aux_levels(image));
+ assert(layer_count <= anv_image_aux_layers(image, level));
+ assert(image->aspects == VK_IMAGE_ASPECT_COLOR_BIT && image->samples == 1);
+
+ /* 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_count, 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 e538507fc2..303fe8e31f 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -2116,6 +2116,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_count,
+ const enum blorp_fast_clear_op op);
void
anv_image_ccs_clear(struct anv_cmd_buffer *cmd_buffer,
--
2.13.1
More information about the mesa-dev
mailing list