st/mesa: don't try to allocate zero-sized renderbuffers
authorBrian Paul <brianp@vmware.com>
Tue, 29 Nov 2011 01:00:35 +0000 (18:00 -0700)
committerBrian Paul <brianp@vmware.com>
Tue, 29 Nov 2011 01:10:30 +0000 (18:10 -0700)
Fixes https://bugs.freedesktop.org/show_bug.cgi?id=43047
and https://bugs.freedesktop.org/show_bug.cgi?id=43048

Note: This is a candidate for the 7.11 branch.

Tested-by: Vinson Lee <vlee@vmware.com>
Signed-off-by: Brian Paul <brianp@vmware.com>
src/mesa/state_tracker/st_cb_fbo.c

index 1e8ec0556ef110759b4afff0e2cc940d4ef96c3e..2a60ed4df8ab63cc40ac98dfc00e72bf6975a29e 100644 (file)
@@ -124,6 +124,11 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
       pipe_surface_reference( &strb->surface, NULL );
       pipe_resource_reference( &strb->texture, NULL );
 
+      if (width == 0 || height == 0) {
+         /* if size is zero, nothing to allocate */
+         return GL_TRUE;
+      }
+
       /* Setup new texture template.
        */
       memset(&template, 0, sizeof(template));