[Mesa-dev] [PATCH] mesa/queryobject: return INVALID_VALUE if offset is < 0

Ilia Mirkin imirkin at alum.mit.edu
Sun May 22 20:26:37 UTC 2016


On Sun, May 22, 2016 at 4:15 PM, Dave Airlie <airlied at gmail.com> wrote:
> This fixes:
> GL45-CTS.direct_state_access.queries_errors
>
> The ARB_direct_state_access spec agrees.
>
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/mesa/main/queryobj.c | 6 ++++++
>  1 file changed, 6 insertions(+)
>
> diff --git a/src/mesa/main/queryobj.c b/src/mesa/main/queryobj.c
> index 7a70b59..71bacc4 100644
> --- a/src/mesa/main/queryobj.c
> +++ b/src/mesa/main/queryobj.c
> @@ -754,6 +754,12 @@ get_query_object(struct gl_context *ctx, const char *func,
>        return;
>     }
>
> +   if (offset < 0) {
> +      _mesa_error(ctx, GL_INVALID_VALUE,
> +                  "%s(offset is negative)", func);
> +      return;
> +   }

Unfortunately offset is a little overloaded here. I think this only
needs to happen in the if (buf) bit of it below. Also probably
GL_INVALID_OPERATION should win over the GL_INVALID_VALUE. I'd put
this before the switch(pname) in the if right below this line.

  -ilia

> +
>     if (buf && buf != ctx->Shared->NullBufferObj) {
>        bool is_64bit = ptype == GL_INT64_ARB ||
>           ptype == GL_UNSIGNED_INT64_ARB;
> --
> 2.7.4
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list