[Mesa-dev] [PATCH 03/38] main: Add utility function _mesa_lookup_renderbuffer_err.

Laura Ekstrand laura at jlekstrand.net
Tue Mar 3 17:31:55 PST 2015


---
 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 b361967..8bc7ec7 100644
--- a/src/mesa/main/fbobject.c
+++ b/src/mesa/main/fbobject.c
@@ -119,6 +119,24 @@ _mesa_lookup_renderbuffer(struct gl_context *ctx, GLuint id)
    return rb;
 }
 
+/**
+ * A convenience function for direct state access that throws
+ * GL_INVALID_OPERATION if the renderbuffer id is not found in the hash table.
+ */
+struct gl_renderbuffer *
+_mesa_lookup_renderbuffer_err(struct gl_context *ctx, GLuint id,
+                              const char *func)
+{
+   struct gl_renderbuffer *rb;
+
+   rb = _mesa_lookup_renderbuffer(ctx, id);
+   if (!rb)
+      _mesa_error(ctx, GL_INVALID_OPERATION,
+                  "%s(non-generated renderbuffer name=%u)", func, id);
+
+   return rb;
+}
+
 
 /**
  * Helper routine for getting a gl_framebuffer.
diff --git a/src/mesa/main/fbobject.h b/src/mesa/main/fbobject.h
index 6bd8968..5143743 100644
--- a/src/mesa/main/fbobject.h
+++ b/src/mesa/main/fbobject.h
@@ -64,6 +64,10 @@ _mesa_get_incomplete_framebuffer(void);
 extern struct gl_renderbuffer *
 _mesa_lookup_renderbuffer(struct gl_context *ctx, GLuint id);
 
+extern struct gl_renderbuffer *
+_mesa_lookup_renderbuffer_err(struct gl_context *ctx, GLuint id,
+                              const char *func);
+
 extern struct gl_framebuffer *
 _mesa_lookup_framebuffer(struct gl_context *ctx, GLuint id);
 
-- 
2.1.0



More information about the mesa-dev mailing list