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

Brian Paul brianp at vmware.com
Wed Nov 2 06:23:31 PDT 2011


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.
"""

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.

-Brian


More information about the mesa-dev mailing list