diff options
author | Michel Dänzer <daenzer@vmware.com> | 2009-02-18 18:12:31 +0100 |
---|---|---|
committer | Michel Dänzer <daenzer@vmware.com> | 2009-02-18 18:12:31 +0100 |
commit | aba88b7ed7a1346adada9532aed9633617eb3b6d (patch) | |
tree | 7b1ec091462589eef862af560e769dc2355ea78f | |
parent | 3bd7c5ceffc88a052c5e8e114df2f2c7549ddb4a (diff) |
gallium: Add pipe_transfer_reference().
-rw-r--r-- | src/gallium/include/pipe/p_inlines.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/gallium/include/pipe/p_inlines.h b/src/gallium/include/pipe/p_inlines.h index 76460d2724..ffbe2d7612 100644 --- a/src/gallium/include/pipe/p_inlines.h +++ b/src/gallium/include/pipe/p_inlines.h @@ -69,6 +69,31 @@ pipe_surface_reference(struct pipe_surface **ptr, struct pipe_surface *surf) * \sa pipe_surface_reference */ static INLINE void +pipe_transfer_reference(struct pipe_transfer **ptr, struct pipe_transfer *trans) +{ + /* bump the refcount first */ + if (trans) { + assert(trans->refcount); + trans->refcount++; + } + + if (*ptr) { + struct pipe_screen *screen; + assert((*ptr)->refcount); + assert((*ptr)->texture); + screen = (*ptr)->texture->screen; + screen->tex_transfer_release( screen, ptr ); + assert(!*ptr); + } + + *ptr = trans; +} + + +/** + * \sa pipe_surface_reference + */ +static INLINE void pipe_texture_reference(struct pipe_texture **ptr, struct pipe_texture *pt) { |