[Mesa-dev] [PATCH 4/6] main: Add utility function _mesa_lookup_bufferobj_err.
Fredrik Höglund
fredrik at kde.org
Tue Mar 3 17:24:39 PST 2015
On Wednesday 04 March 2015, Anuj Phogat wrote:
> On Fri, Feb 27, 2015 at 4:07 PM, Laura Ekstrand <laura at jlekstrand.net> wrote:
> > ---
> > src/mesa/main/bufferobj.c | 19 +++++++++++++++++++
> > src/mesa/main/bufferobj.h | 4 ++++
> > 2 files changed, 23 insertions(+)
> >
> > diff --git a/src/mesa/main/bufferobj.c b/src/mesa/main/bufferobj.c
> > index f026fc3..617242b 100644
> > --- a/src/mesa/main/bufferobj.c
> > +++ b/src/mesa/main/bufferobj.c
> > @@ -1006,6 +1006,25 @@ _mesa_lookup_bufferobj_locked(struct gl_context *ctx, GLuint buffer)
> > _mesa_HashLookupLocked(ctx->Shared->BufferObjects, buffer);
> > }
> >
> > +/**
> > + * A convenience function for direct state access functions that throws
> > + * GL_INVALID_OPERATION if buffer is not the name of a buffer object in the
> > + * hash table.
> > + */
> > +struct gl_buffer_object *
> > +_mesa_lookup_bufferobj_err(struct gl_context *ctx, GLuint buffer,
> > + const char *caller)
> > +{
> > + struct gl_buffer_object *bufObj;
> > +
> > + bufObj = _mesa_lookup_bufferobj(ctx, buffer);
> > + if (!bufObj)
> > + _mesa_error(ctx, GL_INVALID_OPERATION,
> > + "%s(non-generated buffer name %u)", caller, buffer);
> > +
> > + return bufObj;
> > +}
> > +
> >
> > void
> > _mesa_begin_bufferobj_lookups(struct gl_context *ctx)
> > diff --git a/src/mesa/main/bufferobj.h b/src/mesa/main/bufferobj.h
> > index fe294fc..8e53bfd 100644
> > --- a/src/mesa/main/bufferobj.h
> > +++ b/src/mesa/main/bufferobj.h
> > @@ -89,6 +89,10 @@ _mesa_lookup_bufferobj(struct gl_context *ctx, GLuint buffer);
> > extern struct gl_buffer_object *
> > _mesa_lookup_bufferobj_locked(struct gl_context *ctx, GLuint buffer);
> >
> > +extern struct gl_buffer_object *
> > +_mesa_lookup_bufferobj_err(struct gl_context *ctx, GLuint buffer,
> > + const char *caller);
> > +
> This function is used just inside teximage.c in patch 5/6. So, it can be made
> static.
No, I'm using it in arrayobj.c in my arb-direct-state-access branch.
> > extern void
> > _mesa_begin_bufferobj_lookups(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
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
More information about the mesa-dev
mailing list