diff options
author | Dave Airlie <[email protected]> | 2009-03-22 11:56:41 +1000 |
---|---|---|
committer | Dave Airlie <[email protected]> | 2009-03-22 11:56:41 +1000 |
commit | 0968512f8f4abc5bce84c200bd99f8a522d56122 (patch) | |
tree | 8b48edea4698e9b61516999e5832d3debe857e14 /src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | |
parent | c73f4fdb65a6bae4b02348d73f2efdb8f2c5583a (diff) |
radeon: add miptree offset functions
Diffstat (limited to 'src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c')
-rw-r--r-- | src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c | 26 |
1 files changed, 26 insertions, 0 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c index 3203ee1cba7..228629e3c45 100644 --- a/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c +++ b/src/mesa/drivers/dri/radeon/radeon_mipmap_tree.c @@ -358,3 +358,29 @@ void radeon_try_alloc_miptree(radeonContextPtr rmesa, radeonTexObj *t, texImage->Width, texImage->Height, texImage->Depth, texImage->TexFormat->TexelBytes, t->tile_bits, compressed); } + +/* Although we use the image_offset[] array to store relative offsets + * to cube faces, Mesa doesn't know anything about this and expects + * each cube face to be treated as a separate image. + * + * These functions present that view to mesa: + */ +const GLuint * +radeon_miptree_depth_offsets(radeon_mipmap_tree *mt, GLuint level) +{ + static const GLuint zero = 0; + if (mt->target != GL_TEXTURE_3D || mt->faces == 1) + return &zero; + else + return mt->levels[level].faces[0].offset; +} + +GLuint +radeon_miptree_image_offset(radeon_mipmap_tree *mt, + GLuint face, GLuint level) +{ + if (mt->target == GL_TEXTURE_CUBE_MAP_ARB) + return (mt->levels[level].faces[face].offset); + else + return mt->levels[level].faces[0].offset; +} |