From f1c448d2e59bd14b4ddb63654e7b6d605f877d10 Mon Sep 17 00:00:00 2001 From: Brian Paul Date: Fri, 21 Sep 2012 08:09:01 -0600 Subject: [PATCH] st/mesa: check for zero-size image in st_TestProxyTexImage() MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Fixes divide by zero issue in llvmpipe driver. Reviewed-by: José Fonseca --- src/mesa/state_tracker/st_cb_texture.c | 5 +++++ 1 file changed, 5 insertions(+) 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 = -- 2.30.2