summaryrefslogtreecommitdiffstats
path: root/src/mesa/main/teximage.c
diff options
context:
space:
mode:
authorIlia Mirkin <imirkin@alum.mit.edu>2015-08-27 15:28:24 -0400
committerIlia Mirkin <imirkin@alum.mit.edu>2015-08-27 17:18:43 -0400
commit2259b111003f2e8c55cae42677ec45345fb1b6e3 (patch)
tree53bef10e9f046336b9e43b0d78ce263e4eddd7e5 /src/mesa/main/teximage.c
parent0a913a9d85f2eb772be6a133965c5b8a4aa3c800 (diff)
downloadexternal_mesa3d-2259b111003f2e8c55cae42677ec45345fb1b6e3.zip
external_mesa3d-2259b111003f2e8c55cae42677ec45345fb1b6e3.tar.gz
external_mesa3d-2259b111003f2e8c55cae42677ec45345fb1b6e3.tar.bz2
mesa: only copy the requested teximage faces
Cube maps are special in that they have separate teximages for each face. We handled that by copying the data to them separately, but in case zoffset != 0 or depth != 6 we would read off the end of the client array or modify the wrong images. zoffset/depth have already been verified by the time the code gets to this stage, so no need to double-check. Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu> Reviewed-by: Brian Paul <brianp@vmware.com> Cc: "10.6 11.0" <mesa-stable@lists.freedesktop.org>
Diffstat (limited to 'src/mesa/main/teximage.c')
-rw-r--r--src/mesa/main/teximage.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 8d94903..ee4b610 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3805,12 +3805,12 @@ texturesubimage(struct gl_context *ctx, GLuint dims,
rowStride = _mesa_image_image_stride(&ctx->Unpack, width, height,
format, type);
/* Copy in each face. */
- for (i = 0; i < 6; ++i) {
+ for (i = zoffset; i < zoffset + depth; ++i) {
texImage = texObj->Image[i][level];
assert(texImage);
_mesa_texture_sub_image(ctx, 3, texObj, texImage, texObj->Target,
- level, xoffset, yoffset, zoffset,
+ level, xoffset, yoffset, 0,
width, height, 1, format,
type, pixels, true);
pixels = (GLubyte *) pixels + rowStride;