gallium: Add pipe_transfer_reference().

This commit is contained in:
Michel Dänzer 2009-02-18 18:12:31 +01:00
parent 3bd7c5ceff
commit aba88b7ed7
1 changed files with 25 additions and 0 deletions

View File

@ -65,6 +65,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
*/