[Mesa-dev] [PATCH 10/15] i965/miptree: Add option to resolve offsets using isl_surf

Topi Pohjolainen topi.pohjolainen at gmail.com
Tue Jun 13 14:50:08 UTC 2017


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

diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
index c81d345fbc..212dfa30ec 100644
--- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
+++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c
@@ -1175,6 +1175,22 @@ intel_miptree_get_image_offset(const struct intel_mipmap_tree *mt,
 			       GLuint level, GLuint slice,
 			       GLuint *x, GLuint *y)
 {
+   if (mt->surf.size > 0) {
+      uint32_t x_offset_sa, y_offset_sa;
+
+      assert(level >= mt->first_level);
+      level -= mt->first_level;
+
+      const unsigned z = mt->surf.dim == ISL_SURF_DIM_3D ? slice : 0;
+      slice = mt->surf.dim == ISL_SURF_DIM_3D ? 0 : slice;
+      isl_surf_get_image_offset_sa(&mt->surf, level, slice, z,
+                                   &x_offset_sa, &y_offset_sa);
+
+      *x = x_offset_sa;
+      *y = y_offset_sa;
+      return;
+   }
+
    assert(slice < mt->level[level].depth);
 
    *x = mt->level[level].slice[slice].x_offset;
-- 
2.11.0



More information about the mesa-dev mailing list