[Mesa-stable] [Mesa-dev] [PATCH] mesa: don't call ctx->Driver.ClearBufferSubData() if size==0

Marek Olšák maraeo at gmail.com
Mon Mar 3 09:39:11 PST 2014


Reviewed-by: Marek Olšák <marek.olsak at amd.com>

Marek

On Mon, Mar 3, 2014 at 6:09 PM, Brian Paul <brianp at vmware.com> wrote:
> Fixes failed assertion when trying to map zero-length region.
>
> https://bugs.freedesktop.org/show_bug.cgi?id=75660
> Cc: "10.0" "10.1" <mesa-stable at lists.freedesktop.org>
> ---
>  src/mesa/main/bufferobj.c |   12 ++++++++----
>  1 file changed, 8 insertions(+), 4 deletions(-)
>
> diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> index 237b49c..9ef55a7 100644
> --- a/src/mesa/main/bufferobj.c
> +++ b/src/mesa/main/bufferobj.c
> @@ -1508,8 +1508,10 @@ _mesa_ClearBufferSubData(GLenum target, GLenum internalformat,
>
>     if (data == NULL) {
>        /* clear to zeros, per the spec */
> -      ctx->Driver.ClearBufferSubData(ctx, offset, size,
> -                                     NULL, 0, bufObj);
> +      if (size > 0) {
> +         ctx->Driver.ClearBufferSubData(ctx, offset, size,
> +                                        NULL, 0, bufObj);
> +      }
>        return;
>     }
>
> @@ -1519,8 +1521,10 @@ _mesa_ClearBufferSubData(GLenum target, GLenum internalformat,
>        return;
>     }
>
> -   ctx->Driver.ClearBufferSubData(ctx, offset, size,
> -                                  clearValue, clearValueSize, bufObj);
> +   if (size > 0) {
> +      ctx->Driver.ClearBufferSubData(ctx, offset, size,
> +                                     clearValue, clearValueSize, bufObj);
> +   }
>  }
>
>
> --
> 1.7.10.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-stable mailing list