Mesa (master): anv: Add and use color auxiliary buffer helpers
Nanley Chery
nchery at kemper.freedesktop.org
Mon Jun 26 18:22:50 UTC 2017
Module: Mesa
Branch: master
Commit: bc838fc759dd268aebf31f91daf6c18ce76610ee
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=bc838fc759dd268aebf31f91daf6c18ce76610ee
Author: Nanley Chery <nanley.g.chery at intel.com>
Date: Tue Apr 4 09:56:16 2017 -0700
anv: Add and use color auxiliary buffer helpers
v2:
- Check for aux levels in layer helper (Jason Ekstrand)
- Don't assert aux is present, return 0 if it isn't.
- Use the helpers.
v3:
- Make the helpers aspect-agnostic (Jason Ekstrand)
- Drop anv_image_has_color_aux()
Signed-off-by: Nanley Chery <nanley.g.chery at intel.com>
Reviewed-by: Iago Toral Quiroga <itoral at igalia.com> (v2)
Reviewed-by: Jason Ekstrand <jason at jlekstrand.net>
---
src/intel/vulkan/anv_blorp.c | 3 +++
src/intel/vulkan/anv_private.h | 29 +++++++++++++++++++++++++++++
2 files changed, 32 insertions(+)
diff --git a/src/intel/vulkan/anv_blorp.c b/src/intel/vulkan/anv_blorp.c
index d28ea90928..292cee8e3e 100644
--- a/src/intel/vulkan/anv_blorp.c
+++ b/src/intel/vulkan/anv_blorp.c
@@ -1491,6 +1491,9 @@ anv_image_ccs_clear(struct anv_cmd_buffer *cmd_buffer,
blorp_layer_count = anv_get_layerCount(image, subresourceRange);
}
+ assert(level < anv_image_aux_levels(image));
+ assert(blorp_base_layer + blorp_layer_count <=
+ anv_image_aux_layers(image, level));
blorp_fast_clear(&batch, &surf, surf.surf->format,
level, blorp_base_layer, blorp_layer_count,
0, 0, extent.width, extent.height);
diff --git a/src/intel/vulkan/anv_private.h b/src/intel/vulkan/anv_private.h
index 8079378ae6..1110088b82 100644
--- a/src/intel/vulkan/anv_private.h
+++ b/src/intel/vulkan/anv_private.h
@@ -2083,6 +2083,35 @@ struct anv_image {
struct anv_surface aux_surface;
};
+/* Returns the number of auxiliary buffer levels attached to an image. */
+static inline uint8_t
+anv_image_aux_levels(const struct anv_image * const image)
+{
+ assert(image);
+ return image->aux_surface.isl.size > 0 ? image->aux_surface.isl.levels : 0;
+}
+
+/* Returns the number of auxiliary buffer layers attached to an image. */
+static inline uint32_t
+anv_image_aux_layers(const struct anv_image * const image,
+ const uint8_t miplevel)
+{
+ assert(image);
+
+ /* The miplevel must exist in the main buffer. */
+ assert(miplevel < image->levels);
+
+ if (miplevel >= anv_image_aux_levels(image)) {
+ /* There are no layers with auxiliary data because the miplevel has no
+ * auxiliary data.
+ */
+ return 0;
+ } else {
+ return MAX2(image->aux_surface.isl.logical_level0_px.array_len,
+ image->aux_surface.isl.logical_level0_px.depth >> miplevel);
+ }
+}
+
/* Returns true if a HiZ-enabled depth buffer can be sampled from. */
static inline bool
anv_can_sample_with_hiz(const struct gen_device_info * const devinfo,
More information about the mesa-commit
mailing list