summaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2011-10-04 18:26:39 -0600
committerBrian Paul <[email protected]>2011-10-05 21:06:47 -0600
commit5253cf98057dad54e25b4b8c36f8cf24f559314c (patch)
treee3eae8ee98685f9a1795e3d301680e96871d651a /src/mesa/drivers
parentc3ef232315a4e9c18b3d812dbb28ffac6830d6f8 (diff)
mesa: get rid of imageOffsets arrays in texstore code
These were used to find the start of a 3D image slice (or 2D array texture slice) given a base address. Instead, use a simple array of address of image slices instead. This is a step toward getting rid of the gl_texture_image::ImageOffsets field. Reviewed-by: Eric Anholt <[email protected]>
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/intel/intel_tex_subimage.c8
-rw-r--r--src/mesa/drivers/dri/nouveau/nouveau_texture.c9
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.c12
3 files changed, 18 insertions, 11 deletions
diff --git a/src/mesa/drivers/dri/intel/intel_tex_subimage.c b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
index e58d906b4f2..cbbf7e1d48d 100644
--- a/src/mesa/drivers/dri/intel/intel_tex_subimage.c
+++ b/src/mesa/drivers/dri/intel/intel_tex_subimage.c
@@ -57,6 +57,7 @@ intel_blit_texsubimage(struct gl_context * ctx,
unsigned int blit_x = 0, blit_y = 0;
unsigned long pitch;
uint32_t tiling_mode = I915_TILING_NONE;
+ GLubyte *dstMap;
/* Try to do a blit upload of the subimage if the texture is
* currently busy.
@@ -108,8 +109,7 @@ intel_blit_texsubimage(struct gl_context * ctx,
return false;
}
- texImage->Data = temp_bo->virtual;
- texImage->ImageOffsets[0] = 0;
+ dstMap = temp_bo->virtual;
dstRowStride = pitch;
intel_miptree_get_image_offset(intelImage->mt, level,
@@ -122,10 +122,9 @@ intel_blit_texsubimage(struct gl_context * ctx,
if (!_mesa_texstore(ctx, 2, texImage->_BaseFormat,
texImage->TexFormat,
- texImage->Data,
xoffset, yoffset, 0,
dstRowStride,
- texImage->ImageOffsets,
+ &dstMap,
width, height, 1,
format, type, pixels, packing)) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "intelTexSubImage");
@@ -136,7 +135,6 @@ intel_blit_texsubimage(struct gl_context * ctx,
intelImage->mt->cpp;
drm_intel_gem_bo_unmap_gtt(temp_bo);
- texImage->Data = NULL;
ret = intelEmitCopyBlit(intel,
intelImage->mt->cpp,
diff --git a/src/mesa/drivers/dri/nouveau/nouveau_texture.c b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
index 17fa6f576a3..2212d895ae4 100644
--- a/src/mesa/drivers/dri/nouveau/nouveau_texture.c
+++ b/src/mesa/drivers/dri/nouveau/nouveau_texture.c
@@ -477,9 +477,9 @@ nouveau_teximage(struct gl_context *ctx, GLint dims, GLenum target, GLint level,
0, 0, width, height);
ret = _mesa_texstore(ctx, dims, ti->_BaseFormat,
- ti->TexFormat, ti->Data,
+ ti->TexFormat,
0, 0, 0, s->pitch,
- ti->ImageOffsets,
+ (GLubyte **) &ti->Data,
width, height, depth,
format, type, pixels, packing);
assert(ret);
@@ -565,8 +565,9 @@ nouveau_texsubimage(struct gl_context *ctx, GLint dims, GLenum target, GLint lev
xoffset, yoffset, width, height);
ret = _mesa_texstore(ctx, 3, ti->_BaseFormat, ti->TexFormat,
- ti->Data, 0, 0, 0, s->pitch,
- ti->ImageOffsets, width, height, depth,
+ 0, 0, 0, s->pitch,
+ (GLubyte **) &ti->Data,
+ width, height, depth,
format, type, pixels, packing);
assert(ret);
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 6bd89671083..24e40e9853b 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -785,11 +785,19 @@ static void radeon_store_teximage(struct gl_context* ctx, int dims,
copy_rows(img_start, dstRowStride, pixels, srcRowStride, rows, bytesPerRow);
}
else {
+ GLubyte *slices[512];
+ GLuint texelBytes = _mesa_get_format_bytes(texImage->TexFormat);
+ GLuint i;
+ assert(depth <= 512);
+ for (i = 0; i < depth; i++) {
+ slices[i] = (GLubyte *) texImage->Data
+ + dstImageOffsets[i] * texelBytes;
+ }
if (!_mesa_texstore(ctx, dims, texImage->_BaseFormat,
- texImage->TexFormat, texImage->Data,
+ texImage->TexFormat,
xoffset, yoffset, zoffset,
dstRowStride,
- dstImageOffsets,
+ slices,
width, height, depth,
format, type, pixels, packing)) {
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexSubImage");