[Mesa-dev] [PATCH 1/2] mesa: don't use genned but unnammed xfb objects.

Ian Romanick idr at freedesktop.org
Mon May 9 17:37:47 UTC 2016


On 05/09/2016 08:22 AM, Dave Airlie wrote:
> From: Dave Airlie <airlied at redhat.com>
> 
> If we try to draw or query an XFB object that hasn't been bound,
> we shouldn't return any information.
> 
> This fixes a couple if cases in:
> GL33-CTS.transform_feedback.api_errors_test
> 
> The ObjectLabel test is inspired by another test.
> 
> Signed-off-by: Dave Airlie <airlied at redhat.com>
> ---
>  src/mesa/main/api_validate.c | 5 +++++
>  src/mesa/main/objectlabel.c  | 3 ++-
>  2 files changed, 7 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/main/api_validate.c b/src/mesa/main/api_validate.c
> index 6ec65e5..7fa8f21 100644
> --- a/src/mesa/main/api_validate.c
> +++ b/src/mesa/main/api_validate.c
> @@ -665,6 +665,11 @@ _mesa_validate_DrawTransformFeedback(struct gl_context *ctx,
>        return GL_FALSE;
>     }
>  
> +   if (!obj->EverBound) {
> +      _mesa_error(ctx, GL_INVALID_VALUE, "glDrawTransformFeedback*(name)");
> +      return GL_FALSE;
> +   }
> +
>     if (stream >= ctx->Const.MaxVertexStreams) {
>        _mesa_error(ctx, GL_INVALID_VALUE,
>                    "glDrawTransformFeedbackStream*(index>=MaxVertexStream)");
> diff --git a/src/mesa/main/objectlabel.c b/src/mesa/main/objectlabel.c
> index 5070b00..e4f42d0 100644
> --- a/src/mesa/main/objectlabel.c
> +++ b/src/mesa/main/objectlabel.c
> @@ -179,7 +179,8 @@ get_label_pointer(struct gl_context *ctx, GLenum identifier, GLuint name,
>           struct gl_transform_feedback_object *tfo =
>              _mesa_lookup_transform_feedback_object(ctx, name);
>           if (tfo)
> -            labelPtr = &tfo->Label;
> +            if (tfo->EverBound)
> +               labelPtr = &tfo->Label;

I think the style is either

    if (tfo && tfo->EverBound)

or add some { }.  With either change, this patch is

Reviewed-by: Ian Romanick <ian.d.romanick at intel.com>

>        }
>        break;
>     case GL_SAMPLER:
> 



More information about the mesa-dev mailing list