main: use inline function wrapper for _mesa_reference_buffer_object()
authorBrian Paul <brianp@vmware.com>
Thu, 14 Jul 2011 14:09:21 +0000 (08:09 -0600)
committerBrian Paul <brianp@vmware.com>
Thu, 14 Jul 2011 14:09:38 +0000 (08:09 -0600)
src/mesa/main/bufferobj.c
src/mesa/main/bufferobj.h

index 3e28d3426745a1fd10c7624e4b857f064d73ade9..c52358ecb04579e0893d394b8618f15a86becba4 100644 (file)
@@ -241,15 +241,14 @@ _mesa_delete_buffer_object(struct gl_context *ctx,
 
 /**
  * Set ptr to bufObj w/ reference counting.
+ * This is normally only called from the _mesa_reference_buffer_object() macro
+ * when there's a real pointer change.
  */
 void
-_mesa_reference_buffer_object(struct gl_context *ctx,
-                              struct gl_buffer_object **ptr,
-                              struct gl_buffer_object *bufObj)
+_mesa_reference_buffer_object_(struct gl_context *ctx,
+                               struct gl_buffer_object **ptr,
+                               struct gl_buffer_object *bufObj)
 {
-   if (*ptr == bufObj)
-      return;
-
    if (*ptr) {
       /* Unreference the old buffer */
       GLboolean deleteFlag = GL_FALSE;
index 91fa073b649be7846fa4c48af3dc1fed89cd5261..f82e41411b7b1f033361ebc5d9e06b9a4029feea 100644 (file)
@@ -75,9 +75,19 @@ _mesa_initialize_buffer_object( struct gl_buffer_object *obj,
                                GLuint name, GLenum target );
 
 extern void
+_mesa_reference_buffer_object_(struct gl_context *ctx,
+                               struct gl_buffer_object **ptr,
+                               struct gl_buffer_object *bufObj);
+
+static INLINE void
 _mesa_reference_buffer_object(struct gl_context *ctx,
                               struct gl_buffer_object **ptr,
-                              struct gl_buffer_object *bufObj);
+                              struct gl_buffer_object *bufObj)
+{
+   if (*ptr != bufObj)
+      _mesa_reference_buffer_object_(ctx, ptr, bufObj);
+}
+
 
 extern void
 _mesa_init_buffer_object_functions(struct dd_function_table *driver);