aboutsummaryrefslogtreecommitdiffstats
path: root/src/mesa/drivers
diff options
context:
space:
mode:
authorMaciej Cencora <[email protected]>2009-06-15 01:06:40 +0200
committerMaciej Cencora <[email protected]>2009-06-15 01:07:19 +0200
commite0eafde746fee546b16205e4a605e28f78e120f9 (patch)
tree2078e2d841c47bda04fc9b6799d1f134f8211ff4 /src/mesa/drivers
parent18af7c384cf663533f210d95d074c244d4214f29 (diff)
r300: fix 3D textures
Diffstat (limited to 'src/mesa/drivers')
-rw-r--r--src/mesa/drivers/dri/radeon/radeon_texture.c21
1 files changed, 20 insertions, 1 deletions
diff --git a/src/mesa/drivers/dri/radeon/radeon_texture.c b/src/mesa/drivers/dri/radeon/radeon_texture.c
index 3fc750c005d..429ad50a7d4 100644
--- a/src/mesa/drivers/dri/radeon/radeon_texture.c
+++ b/src/mesa/drivers/dri/radeon/radeon_texture.c
@@ -614,6 +614,8 @@ static void radeon_teximage(
memcpy(texImage->Data, pixels, imageSize);
} else {
GLuint dstRowStride;
+ GLuint *dstImageOffsets;
+
if (image->mt) {
radeon_mipmap_level *lvl = &image->mt->levels[image->mtlevel];
dstRowStride = lvl->rowstride;
@@ -621,15 +623,32 @@ static void radeon_teximage(
dstRowStride = texImage->Width * texImage->TexFormat->TexelBytes;
}
+ if (dims == 3) {
+ int i;
+
+ dstImageOffsets = _mesa_malloc(depth * sizeof(GLuint)) ;
+ if (!dstImageOffsets)
+ _mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage");
+
+ for (i = 0; i < depth; ++i) {
+ dstImageOffsets[i] = dstRowStride/texImage->TexFormat->TexelBytes * height * i;
+ }
+ } else {
+ dstImageOffsets = texImage->ImageOffsets;
+ }
+
if (!texImage->TexFormat->StoreImage(ctx, dims,
texImage->_BaseFormat,
texImage->TexFormat,
texImage->Data, 0, 0, 0, /* dstX/Y/Zoffset */
dstRowStride,
- texImage->ImageOffsets,
+ dstImageOffsets,
width, height, depth,
format, type, pixels, packing))
_mesa_error(ctx, GL_OUT_OF_MEMORY, "glTexImage");
+
+ if (dims == 3)
+ _mesa_free(dstImageOffsets);
}
/* SGIS_generate_mipmap */