diff options
author | Topi Pohjolainen <[email protected]> | 2017-05-12 09:38:10 +0300 |
---|---|---|
committer | Topi Pohjolainen <[email protected]> | 2017-06-19 22:41:45 +0300 |
commit | 5d125f999e4ac0c8b17782a50ca933daec61f491 (patch) | |
tree | 0bdcf85f6a3a5f80844b9f66fe958e098c87785b /src/mesa | |
parent | 71ac909137d9d61d3aa3ec3dbaaba69128e0d558 (diff) |
i965/miptree: Add option to resolve offsets using isl_surf
v2 (Nanley): Add comment telling why "level -= mt->first_level"
Reviewed-by: Nanley Chery <[email protected]>
Reviewed-by: Jason Ekstrand <[email protected]>
Signed-off-by: Topi Pohjolainen <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r-- | src/mesa/drivers/dri/i965/intel_mipmap_tree.c | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c index b50c30e6769..5580ce21c2c 100644 --- a/src/mesa/drivers/dri/i965/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/i965/intel_mipmap_tree.c @@ -1199,6 +1199,25 @@ 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; + + /* Given level is relative to level zero while the miptree may be + * represent just a subset of all levels starting from 'first_level'. + */ + 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; |