summaryrefslogtreecommitdiffstats
path: root/src/mesa
diff options
context:
space:
mode:
authorBrian Paul <[email protected]>2012-09-21 08:09:01 -0600
committerBrian Paul <[email protected]>2012-09-24 07:58:45 -0600
commitf1c448d2e59bd14b4ddb63654e7b6d605f877d10 (patch)
tree51b523362a397907cdaddcfc3522d21407f1ba84 /src/mesa
parentc432c86e6aeebeb46c028af940224c59faa16e88 (diff)
st/mesa: check for zero-size image in st_TestProxyTexImage()
Fixes divide by zero issue in llvmpipe driver. Reviewed-by: José Fonseca <[email protected]>
Diffstat (limited to 'src/mesa')
-rw-r--r--src/mesa/state_tracker/st_cb_texture.c5
1 files changed, 5 insertions, 0 deletions
diff --git a/src/mesa/state_tracker/st_cb_texture.c b/src/mesa/state_tracker/st_cb_texture.c
index 4f4fe77dad3..5634a3e6e54 100644
--- a/src/mesa/state_tracker/st_cb_texture.c
+++ b/src/mesa/state_tracker/st_cb_texture.c
@@ -1379,6 +1379,11 @@ st_TestProxyTexImage(struct gl_context *ctx, GLenum target,
struct st_context *st = st_context(ctx);
struct pipe_context *pipe = st->pipe;
+ if (width == 0 || height == 0 || depth == 0) {
+ /* zero-sized images are legal, and always fit! */
+ return GL_TRUE;
+ }
+
if (pipe->screen->can_create_resource) {
/* Ask the gallium driver if the texture is too large */
struct gl_texture_object *texObj =