[Mesa-dev] [PATCH 07/15] i965/miptree: Prepare aux state map for isl based

Topi Pohjolainen topi.pohjolainen at gmail.com
Tue Jun 13 19:10:58 UTC 2017


Signed-off-by: Topi Pohjolainen <topi.pohjolainen at intel.com>
---
 src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 21 ++++++++++++++++++---
 1 file changed, 18 insertions(+), 3 deletions(-)

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index 4472f822ea..9fdd56eaf2 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -609,8 +609,14 @@ create_aux_state_map(struct intel_mipmap_tree *mt,
    const uint32_t levels = mt->last_level + 1;
 
    uint32_t total_slices = 0;
-   for (uint32_t level = 0; level < levels; level++)
-      total_slices += mt->level[level].depth;
+   for (uint32_t level = 0; level < levels; level++) {
+      if (mt->surf.size > 0)
+         total_slices += (mt->surf.dim == ISL_SURF_DIM_3D ?
+                             minify(mt->surf.phys_level0_sa.depth, level) :
+                             mt->surf.phys_level0_sa.array_len);
+      else
+         total_slices += mt->level[level].depth;
+   }
 
    const size_t per_level_array_size = levels * sizeof(enum isl_aux_state *);
 
@@ -628,7 +634,16 @@ create_aux_state_map(struct intel_mipmap_tree *mt,
    enum isl_aux_state *s = data + per_level_array_size;
    for (uint32_t level = 0; level < levels; level++) {
       per_level_arr[level] = s;
-      for (uint32_t a = 0; a < mt->level[level].depth; a++)
+
+      unsigned level_depth;
+      if (mt->surf.size > 0)
+         level_depth = mt->surf.dim == ISL_SURF_DIM_3D ?
+                          minify(mt->surf.phys_level0_sa.depth, level) :
+                          mt->surf.phys_level0_sa.array_len;
+      else
+         level_depth = mt->level[level].depth;
+              
+      for (uint32_t a = 0; a < level_depth; a++)
          *(s++) = initial;
    }
    assert((void *)s == data + total_size);
-- 
2.11.0



More information about the mesa-dev mailing list