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

Anuj Phogat anuj.phogat at gmail.com
Mon Apr 27 16:01:01 PDT 2015


On Tue, Mar 3, 2015 at 5:31 PM, Laura Ekstrand <laura at jlekstrand.net> 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;
> +}
> +
>
>  /**
>   * 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,
> --
> 2.1.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

With Fredrik's comment fixed:
Reviewed-by: Anuj Phogat <anuj.phogat at gmail.com>


More information about the mesa-dev mailing list