From: Maciej Cencora Date: Sun, 14 Jun 2009 23:06:40 +0000 (+0200) Subject: r300: fix 3D textures X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e0eafde746fee546b16205e4a605e28f78e120f9;p=mesa.git r300: fix 3D textures --- 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 */