[Mesa-dev] [PATCH 01/38] main: Add utility function _mesa_lookup_framebuffer_err.

Fredrik Höglund fredrik at kde.org
Thu Apr 9 12:32:52 PDT 2015


On Wednesday 04 March 2015, Laura Ekstrand wrote:
> ---
>  src/mesa/main/fbobject.c | 18 ++++++++++++++++++
>  src/mesa/main/fbobject.h |  4 ++++
>  2 files changed, 22 insertions(+)
> 
> diff --git a/src/mesa/main/fbobject.c b/src/mesa/main/fbobject.c
> index f8d0d92..8c2eb25 100644
> --- a/src/mesa/main/fbobject.c
> +++ b/src/mesa/main/fbobject.c
> @@ -136,6 +136,24 @@ _mesa_lookup_framebuffer(struct gl_context *ctx, GLuint id)
>     return fb;
>  }
>  
> +/**
> + * A convenience function for direct state access that throws
> + * GL_INVALID_OPERATION if the framebuffer id is not found in the hash table.
> + */
> +struct gl_framebuffer *
> +_mesa_lookup_framebuffer_err(struct gl_context *ctx, GLuint id,
> +                             const char *func)
> +{
> +   struct gl_framebuffer *fb;
> +
> +   fb = _mesa_lookup_framebuffer(ctx, id);
> +   if (!fb)
> +      _mesa_error(ctx, GL_INVALID_OPERATION,
> +                  "%s(non-generated framebuffer name=%u)", func, id);
> +
> +   return fb;
> +}
> +

I think this function should also generate GL_INVALID_OPERATION when
the looked-up framebuffer is DummyFramebuffer.

All the DSA entry points require that the framebuffer exists.

>  /**
>   * Mark the given framebuffer as invalid.  This will force the
> diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
> index 77fdef4..7aa5205 100644
> --- a/src/mesa/main/fbobject.h
> +++ b/src/mesa/main/fbobject.h
> @@ -67,6 +67,10 @@ _mesa_lookup_renderbuffer(struct gl_context *ctx, GLuint id);
>  extern struct gl_framebuffer *
>  _mesa_lookup_framebuffer(struct gl_context *ctx, GLuint id);
>  
> +extern struct gl_framebuffer *
> +_mesa_lookup_framebuffer_err(struct gl_context *ctx, GLuint id,
> +                             const char *func);
> +
>  
>  void
>  _mesa_update_texture_renderbuffer(struct gl_context *ctx,
> 



More information about the mesa-dev mailing list