aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers/dri
diff options
context:
space:
mode:
authorEric Anholt <[email protected]>2013-04-19 11:44:53 -0700
committerEric Anholt <[email protected]>2013-04-30 10:40:43 -0700
commit0c883e46d871797cd1141498850d51cde6e54b76 (patch)
tree54019d9f77240229e7da69de95be45eb47de4984 /src/mesa/drivers/dri
parente7ecc11311d142a8ac919627011372a265224bcd (diff)
swrast: Replace ImageOffsets with an ImageSlices pointer.
This is a step toward allowing drivers to use their normal mapping paths, instead of requiring that all slice mappings come from an aligned offset from the first slice's map. This incidentally fixes missing slice handling in FXT1 swrast. v2: Use slice height helper function. Reviewed-by: Kenneth Graunke <[email protected]> Reviewed-by: Brian Paul <[email protected]>
Diffstat (limited to 'src/mesa/drivers/dri')
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_validate.c37
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.c13
2 files changed, 16 insertions, 34 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex_validate.c b/src/mesa/drivers/dri/intel/intel_tex_validate.c
index c880bcee102..60687332191 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_validate.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_validate.c
@@ -163,34 +163,19 @@ intel_tex_map_image_for_swrast(struct intel_context *intel,
for (int i = 0; i < mt->level[level].depth; i++)
intel_miptree_slice_resolve_depth(intel, mt, level, i);
- if (mt->target == GL_TEXTURE_3D ||
- mt->target == GL_TEXTURE_2D_ARRAY ||
- mt->target == GL_TEXTURE_1D_ARRAY) {
- int i;
-
- /* ImageOffsets[] is only used for swrast's fetch_texel_3d, so we can't
- * share code with the normal path.
- */
- for (i = 0; i < mt->level[level].depth; i++) {
- intel_miptree_get_image_offset(mt, level, i, &x, &y);
- intel_image->base.ImageOffsets[i] = x + y * (mt->region->pitch /
- mt->region->cpp);
- }
-
- DBG("%s \n", __FUNCTION__);
-
- intel_image->base.Map = intel_miptree_map_raw(intel, mt);
- } else {
- assert(intel_image->base.Base.Depth == 1);
- intel_miptree_get_image_offset(mt, level, face, &x, &y);
-
- DBG("%s: (%d,%d) -> (%d, %d)/%d\n",
- __FUNCTION__, face, level, x, y, mt->region->pitch);
-
- intel_image->base.Map = intel_miptree_map_raw(intel, mt) +
- x * mt->cpp + y * mt->region->pitch;
+ void *map = intel_miptree_map_raw(intel, mt);
+
+ for (int i = 0; i < mt->level[level].depth; i++) {
+ intel_miptree_get_image_offset(mt, level, i, &x, &y);
+ intel_image->base.ImageSlices[i] = (map +
+ y * mt->region->pitch +
+ x * mt->cpp);
+ DBG("%s: (%d,%d,%d) -> (%d, %d)/%d\n",
+ __FUNCTION__, face, level, i, x, y, mt->region->pitch);
}
+ intel_image->base.Map = intel_image->base.ImageSlices[0];
+
assert(mt->region->pitch % mt->region->cpp == 0);
intel_image->base.RowStride = mt->region->pitch / mt->region->cpp;
}
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 23942cbb0a0..aa2f734c657 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -638,7 +638,6 @@ radeon_swrast_map_image(radeonContextPtr rmesa,
radeon_mipmap_tree *mt;
GLuint texel_size;
radeon_mipmap_level *lvl;
- int rs;
if (!image || !image->mt)
return;
@@ -650,18 +649,16 @@ radeon_swrast_map_image(radeonContextPtr rmesa,
lvl = &image->mt->levels[level];
- rs = lvl->rowstride / texel_size;
-
radeon_bo_map(mt->bo, 1);
image->base.Map = mt->bo->ptr + lvl->faces[face].offset;
- if (mt->target == GL_TEXTURE_3D) {
- int i;
- for (i = 0; i < mt->levels[level].depth; i++)
- image->base.ImageOffsets[i] = rs * lvl->height * i;
+ for (int i = 0; i < mt->levels[level].depth; i++) {
+ image->base.ImageSlices[i] =
+ image->base.Map + (lvl->rowstride * lvl->height * i);
}
- image->base.RowStride = rs;
+
+ image->base.RowStride = lvl->rowstride / texel_size;
}
static void