diff options
author | Abdiel Janulgue <[email protected]> | 2012-12-07 13:40:35 +0200 |
---|---|---|
committer | Chad Versace <[email protected]> | 2013-02-01 11:58:12 -0800 |
commit | 163b35e416349c0f079aa6a92eb0bade2cabf5bc (patch) | |
tree | 761d76894d3b307b40ad737e44953efb84a20641 /src/mesa/drivers | |
parent | 7014df0d1da97b655014eb783fa9f34c78a93631 (diff) |
intel: add pixel offset calculator for miptree levels
Add helper to calculate fine-grained x and y adjustment pixels
to an image within a miptree level for tiled regions.
Reviewed-by: Eric Anholt <[email protected]>
Reviewed-by: Chad Versace <[email protected]>
Signed-off-by: Abdiel Janulgue <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_mipmap_tree.c | 15 | ||||
-rw-r--r-- | src/mesa/drivers/dri/intel/intel_mipmap_tree.h | 6 |
2 files changed, 21 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c index 05f5a4d657a..31abdad7207 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.c +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.c @@ -687,6 +687,21 @@ intel_miptree_get_image_offset(struct intel_mipmap_tree *mt, *y = mt->level[level].slice[slice].y_offset; } +void +intel_miptree_get_tile_offsets(struct intel_mipmap_tree *mt, + GLuint level, GLuint slice, + uint32_t *tile_x, + uint32_t *tile_y) +{ + struct intel_region *region = mt->region; + uint32_t mask_x, mask_y; + + intel_region_get_tile_masks(region, &mask_x, &mask_y, false); + + *tile_x = mt->level[level].slice[slice].x_offset & mask_x; + *tile_y = mt->level[level].slice[slice].y_offset & mask_y; +} + static void intel_miptree_copy_slice(struct intel_context *intel, struct intel_mipmap_tree *dst_mt, diff --git a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h index a8f27d96a58..27540bc182f 100644 --- a/src/mesa/drivers/dri/intel/intel_mipmap_tree.h +++ b/src/mesa/drivers/dri/intel/intel_mipmap_tree.h @@ -467,6 +467,12 @@ void intel_miptree_get_dimensions_for_image(struct gl_texture_image *image, int *width, int *height, int *depth); +void +intel_miptree_get_tile_offsets(struct intel_mipmap_tree *mt, + GLuint level, GLuint slice, + uint32_t *tile_x, + uint32_t *tile_y); + void intel_miptree_set_level_info(struct intel_mipmap_tree *mt, GLuint level, GLuint x, GLuint y, |