summaryrefslogtreecommitdiffstats
path: root/src/intel
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-02-12 09:48:12 -0800
committerJason Ekstrand <[email protected]>2018-02-12 15:14:57 -0800
commitf37bd726c7211e8680f4a903b2167dacc4de94f2 (patch)
tree76a8370877be76034bd1205ea25683bae8e1f6bd /src/intel
parentc2c4e5bae3ba27bbdaafd8787a3e96266f82e70c (diff)
anv: Don't resolve or ambiguate non-existent layers
The previous code was trying to avoid non-existent layers by taking a MAX with anv_image_aux_layers. Unfortunately, it wasn't taking into account that layer_count starts at base_layer which may not be zero. Instead, we need to subtract base_layer from anv_image_aux_layers with a guard against roll-over. Fixes: de3be6180169f9 "anv/cmd_buffer: Rework aux tracking" Reviewed-by: Nanley Chery <[email protected]>
Diffstat (limited to 'src/intel')
-rw-r--r--src/intel/vulkan/genX_cmd_buffer.c12
1 files changed, 10 insertions, 2 deletions
diff --git a/src/intel/vulkan/genX_cmd_buffer.c b/src/intel/vulkan/genX_cmd_buffer.c
index f42860b411a..ce47b8a1cc0 100644
--- a/src/intel/vulkan/genX_cmd_buffer.c
+++ b/src/intel/vulkan/genX_cmd_buffer.c
@@ -883,8 +883,12 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,
if (image->samples == 1) {
for (uint32_t l = 0; l < level_count; l++) {
const uint32_t level = base_level + l;
+
+ uint32_t aux_layers = anv_image_aux_layers(image, aspect, level);
+ if (base_layer >= aux_layers)
+ break; /* We will only get fewer layers as level increases */
uint32_t level_layer_count =
- MIN2(layer_count, anv_image_aux_layers(image, aspect, level));
+ MIN2(layer_count, aux_layers - base_layer);
anv_image_ccs_op(cmd_buffer, image, aspect, level,
base_layer, level_layer_count,
@@ -972,8 +976,12 @@ transition_color_buffer(struct anv_cmd_buffer *cmd_buffer,
for (uint32_t l = 0; l < level_count; l++) {
uint32_t level = base_level + l;
+
+ uint32_t aux_layers = anv_image_aux_layers(image, aspect, level);
+ if (base_layer >= aux_layers)
+ break; /* We will only get fewer layers as level increases */
uint32_t level_layer_count =
- MIN2(layer_count, anv_image_aux_layers(image, aspect, level));
+ MIN2(layer_count, aux_layers - base_layer);
for (uint32_t a = 0; a < level_layer_count; a++) {
uint32_t array_layer = base_layer + a;