[Mesa-dev] [PATCH 4/5] mesa: fix the low limit of width and height for glRenderbufferStorage

Yuanhan Liu yuanhan.liu at linux.intel.com
Wed Nov 2 23:14:11 PDT 2011


On Wed, Nov 02, 2011 at 07:23:31AM -0600, Brian Paul wrote:
> On 11/02/2011 03:56 AM, Yuanhan Liu wrote:
> >glRenderbufferStorage man page says:
> >
> >   GL_INVALID_VALUE is generated if either of width or height is negative,
> >   or greater than the value of GL_MAX_RENDERBUFFER_SIZE.
> >
> >Signed-off-by: Yuanhan Liu<yuanhan.liu at linux.intel.com>
> >---
> >  src/mesa/main/fbobject.c |    4 ++--
> >  1 files changed, 2 insertions(+), 2 deletions(-)
> >
> >diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> >index c56062a..ff46570 100644
> >--- a/src/mesa/main/fbobject.c
> >+++ b/src/mesa/main/fbobject.c
> >@@ -1370,12 +1370,12 @@ renderbuffer_storage(GLenum target, GLenum internalFormat,
> >        return;
> >     }
> >
> >-   if (width<  1 || width>  (GLsizei) ctx->Const.MaxRenderbufferSize) {
> >+   if (width<  0 || width>  (GLsizei) ctx->Const.MaxRenderbufferSize) {
> >        _mesa_error(ctx, GL_INVALID_VALUE, "%s(width)", func);
> >        return;
> >     }
> >
> >-   if (height<  1 || height>  (GLsizei) ctx->Const.MaxRenderbufferSize) {
> >+   if (height<  0 || height>  (GLsizei) ctx->Const.MaxRenderbufferSize) {
> >        _mesa_error(ctx, GL_INVALID_VALUE, "%s(height)", func);
> >        return;
> >     }
> 
> Interestingly, the extension spec (both EXT and ARB) doesn't say
> anything about negative values.  The Errors section says:
> 
> """
>     The error INVALID_VALUE is generated if RenderbufferStorageEXT is
>     called with a <width> or <height> that is greater than
>     MAX_RENDERBUFFER_SIZE_EXT.
> """

Yes, when I first saw this, I feel strange, too. It seems that Spec
somehow missed it.

> 
> But your patch looks good to me and it makes sense.
> 
> Reviewed-by: Brian Paul <brianp at vmware.com>
> 
> Another candidate for the 7.11 branch I think.

Thanks,
Yuanhan Liu


More information about the mesa-dev mailing list