Mesa (9.1): mesa: don' t allocate a texture if width or height is 0 in CopyTexImage
Ian Romanick
idr at kemper.freedesktop.org
Mon Mar 25 21:23:58 UTC 2013
Module: Mesa
Branch: 9.1
Commit: b3c8a250e64a014fdd5883d553a9bf17b2e128b1
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=b3c8a250e64a014fdd5883d553a9bf17b2e128b1
Author: Marek Olšák <maraeo at gmail.com>
Date: Mon Mar 4 13:26:51 2013 +0100
mesa: don't allocate a texture if width or height is 0 in CopyTexImage
NOTE: This is a candidate for the stable branches.
Reviewed-by: Brian Paul <brianp at vmware.com>
(cherry picked from commit 4b69c1a92d4e1a03377a91548e0a99c3cf3dfea1)
---
src/mesa/main/teximage.c | 22 ++++++++++++----------
1 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/src/mesa/main/teximage.c b/src/mesa/main/teximage.c
index 138edf6..1b91b89 100644
--- a/src/mesa/main/teximage.c
+++ b/src/mesa/main/teximage.c
@@ -3439,19 +3439,21 @@ copyteximage(struct gl_context *ctx, GLuint dims,
_mesa_init_teximage_fields(ctx, texImage, width, height, 1,
border, internalFormat, texFormat);
- /* Allocate texture memory (no pixel data yet) */
- ctx->Driver.AllocTextureImageBuffer(ctx, texImage);
+ if (width && height) {
+ /* Allocate texture memory (no pixel data yet) */
+ ctx->Driver.AllocTextureImageBuffer(ctx, texImage);
- if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY,
- &width, &height)) {
- struct gl_renderbuffer *srcRb =
- get_copy_tex_image_source(ctx, texImage->TexFormat);
+ if (_mesa_clip_copytexsubimage(ctx, &dstX, &dstY, &srcX, &srcY,
+ &width, &height)) {
+ struct gl_renderbuffer *srcRb =
+ get_copy_tex_image_source(ctx, texImage->TexFormat);
- ctx->Driver.CopyTexSubImage(ctx, dims, texImage, dstX, dstY, dstZ,
- srcRb, srcX, srcY, width, height);
- }
+ ctx->Driver.CopyTexSubImage(ctx, dims, texImage, dstX, dstY, dstZ,
+ srcRb, srcX, srcY, width, height);
+ }
- check_gen_mipmap(ctx, target, texObj, level);
+ check_gen_mipmap(ctx, target, texObj, level);
+ }
_mesa_update_fbo_texture(ctx, texObj, face, level);
More information about the mesa-commit
mailing list