It may fail with an unsupported format, but that's not an allowed case where RenderbufferStorage may fail. And on success, we should return valid values from GetRenderbufferParameteriv.
This fixes piglit: get-renderbuffer-internalformat --- src/mesa/main/fbobject.c | 18 +++++++++++++----- 1 file changed, 13 insertions(+), 5 deletions(-) diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c index 777783e..c67b5be 100644 --- a/src/mesa/main/fbobject.c +++ b/src/mesa/main/fbobject.c @@ -1402,13 +1402,21 @@ renderbuffer_storage(GLenum target, GLenum internalFormat, assert(rb->_BaseFormat != 0); } else { - /* Probably ran out of memory - clear the fields */ - rb->Width = 0; - rb->Height = 0; + /* Probably ran out of memory - set the fields anyway, because + * the ARB_fbo spec says: + * + * "Upon success, ... RENDERBUFFER_WIDTH is set to <width>, + * RENDERBUFFER_HEIGHT is set to <height>, and + * RENDERBUFFER_INTERNAL_FORMAT is set to <internalformat>." + * + * Assuming the "success" means no GL errors. + */ + rb->Width = width; + rb->Height = height; rb->Format = MESA_FORMAT_NONE; - rb->InternalFormat = GL_NONE; + rb->InternalFormat = internalFormat; rb->_BaseFormat = GL_NONE; - rb->NumSamples = 0; + rb->NumSamples = samples; } /* Invalidate the framebuffers the renderbuffer is attached in. */ -- 1.7.9.5 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev