summaryrefslogtreecommitdiff
path: root/src/mesa/pipe/p_inlines.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/mesa/pipe/p_inlines.h')
-rw-r--r--src/mesa/pipe/p_inlines.h20
1 files changed, 20 insertions, 0 deletions
diff --git a/src/mesa/pipe/p_inlines.h b/src/mesa/pipe/p_inlines.h
index 2418d016e1..c04d46dddd 100644
--- a/src/mesa/pipe/p_inlines.h
+++ b/src/mesa/pipe/p_inlines.h
@@ -80,4 +80,24 @@ pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf)
}
}
+
+/**
+ * \sa pipe_region_reference
+ */
+static INLINE void
+pipe_texture_reference(struct pipe_context *pipe, struct pipe_texture **ptr,
+ struct pipe_texture *pt)
+{
+ assert(ptr);
+ if (*ptr) {
+ pipe->texture_release(pipe, ptr);
+ assert(!*ptr);
+ }
+ if (pt) {
+ /* reference the new thing */
+ pt->refcount++;
+ *ptr = pt;
+ }
+}
+
#endif /* P_INLINES_H */