[Mesa-dev] [PATCH 2/2] mesa: fix error handling for glMapBufferRange

Brian Paul brianp at vmware.com
Mon Sep 19 07:20:58 PDT 2011


On 09/19/2011 04:25 AM, Yuanhan Liu wrote:
> Accroding the man page, GL_INVALID_VALUE would generated if access has any
> bits set other than those valid defined bits.
>
> Signed-off-by: Yuanhan Liu<yuanhan.liu at linux.intel.com>
> ---
>   src/mesa/main/bufferobj.c |   10 ++++++++++
>   1 files changed, 10 insertions(+), 0 deletions(-)
>
> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> index ba2275d..b736329 100644
> --- a/src/mesa/main/bufferobj.c
> +++ b/src/mesa/main/bufferobj.c
> @@ -1376,6 +1376,16 @@ _mesa_MapBufferRange(GLenum target, GLintptr offset, GLsizeiptr length,
>         return NULL;
>      }
>
> +   if (access&  ~(GL_MAP_READ_BIT |
> +                  GL_MAP_WRITE_BIT |
> +                  GL_MAP_INVALIDATE_RANGE_BIT |
> +                  GL_MAP_INVALIDATE_BUFFER_BIT |
> +                  GL_MAP_FLUSH_EXPLICIT_BIT |
> +                  GL_MAP_UNSYNCHRONIZED_BIT)) {
> +      _mesa_error(ctx, GL_INVALID_VALUE, "glMapBufferRange(access)");
> +      return NULL;
> +   }
> +
>      if ((access&  (GL_MAP_READ_BIT | GL_MAP_WRITE_BIT)) == 0) {
>         _mesa_error(ctx, GL_INVALID_OPERATION,
>                     "glMapBufferRange(access indicates neither read or write)");


Reviewed-by: Brian Paul <brianp at vmware.com>

I'll push this soon, but maybe add a comment to the code.

-Brian


More information about the mesa-dev mailing list