* Reference (or unreference) a texture object.
* If '*ptr', decrement *ptr's refcount (and delete if it becomes zero).
* If 'tex' is non-null, increment its refcount.
+ * This is normally only called from the _mesa_reference_texobj() macro
+ * when there's a real pointer change.
*/
void
-_mesa_reference_texobj(struct gl_texture_object **ptr,
- struct gl_texture_object *tex)
+_mesa_reference_texobj_(struct gl_texture_object **ptr,
+ struct gl_texture_object *tex)
{
assert(ptr);
- if (*ptr == tex) {
- /* no change */
- return;
- }
if (*ptr) {
/* Unreference the old texture */
#define TEXTOBJ_H
+#include "compiler.h"
#include "glheader.h"
struct gl_context;
struct gl_texture_object *obj);
extern void
+_mesa_reference_texobj_(struct gl_texture_object **ptr,
+ struct gl_texture_object *tex);
+
+static INLINE void
_mesa_reference_texobj(struct gl_texture_object **ptr,
- struct gl_texture_object *tex);
+ struct gl_texture_object *tex)
+{
+ if (*ptr != tex)
+ _mesa_reference_texobj_(ptr, tex);
+}
+
extern void
_mesa_test_texobj_completeness( const struct gl_context *ctx,