st/mesa: make unsupported renderbuffer formats always fail as FBO incomplete
authorMarek Olšák <maraeo@gmail.com>
Fri, 15 Jun 2012 00:00:36 +0000 (02:00 +0200)
committerMarek Olšák <maraeo@gmail.com>
Sat, 16 Jun 2012 12:20:27 +0000 (14:20 +0200)
instead of failing to allocate a renderbuffer.

This also fixes piglit/get-renderbuffer-internalformat with non-renderable
formats.

Reviewed-by: Brian Paul <brianp@vmware.com>
src/mesa/state_tracker/st_cb_fbo.c

index 012699984530dbba99afed5b6a5244edb14103e9..88c6fa2da9616743c444f061e2366d6bfcb53cba 100644 (file)
@@ -81,10 +81,13 @@ st_renderbuffer_alloc_sw_storage(struct gl_context * ctx,
    }
    else {
       format = st_choose_renderbuffer_format(screen, internalFormat, 0);
-   }
 
-   if (format == PIPE_FORMAT_NONE) {
-      return FALSE;
+      /* Not setting gl_renderbuffer::Format here will cause
+       * FRAMEBUFFER_UNSUPPORTED and ValidateFramebuffer will not be called.
+       */
+      if (format == PIPE_FORMAT_NONE) {
+         return GL_TRUE;
+      }
    }
 
    strb->Base.Format = st_pipe_format_to_mesa_format(format);
@@ -133,8 +136,11 @@ st_renderbuffer_alloc_storage(struct gl_context * ctx,
    format = st_choose_renderbuffer_format(screen, internalFormat,
                                           rb->NumSamples);
 
+   /* Not setting gl_renderbuffer::Format here will cause
+    * FRAMEBUFFER_UNSUPPORTED and ValidateFramebuffer will not be called.
+    */
    if (format == PIPE_FORMAT_NONE) {
-      return FALSE;
+      return GL_TRUE;
    }
 
    strb->Base.Format = st_pipe_format_to_mesa_format(format);