X-Git-Url: https://git.libre-soc.org/?a=blobdiff_plain;f=src%2Fgallium%2Fauxiliary%2Futil%2Fu_inlines.h;h=e22ab188e113897bccde250b759c76f36ab20bb3;hb=4fb2daf42c8171579cdc18605c5ceeb1963f8b31;hp=e95d58ea863d527ba156c975fcf027c1447e4ac5;hpb=45dac0d82a5a69166e86dce77c2550f7512c541e;p=mesa.git diff --git a/src/gallium/auxiliary/util/u_inlines.h b/src/gallium/auxiliary/util/u_inlines.h index e95d58ea863..e22ab188e11 100644 --- a/src/gallium/auxiliary/util/u_inlines.h +++ b/src/gallium/auxiliary/util/u_inlines.h @@ -90,7 +90,10 @@ pipe_reference(struct pipe_reference *ptr, struct pipe_reference *reference) static INLINE void pipe_buffer_reference(struct pipe_buffer **ptr, struct pipe_buffer *buf) { - struct pipe_buffer *old_buf = *ptr; + struct pipe_buffer *old_buf; + + assert(ptr); + old_buf = *ptr; if (pipe_reference(&(*ptr)->reference, &buf->reference)) old_buf->screen->buffer_destroy(old_buf); @@ -117,6 +120,16 @@ pipe_texture_reference(struct pipe_texture **ptr, struct pipe_texture *tex) *ptr = tex; } +static INLINE void +pipe_sampler_view_reference(struct pipe_sampler_view **ptr, struct pipe_sampler_view *view) +{ + struct pipe_sampler_view *old_view = *ptr; + + if (pipe_reference(&(*ptr)->reference, &view->reference)) + old_view->context->sampler_view_destroy(old_view->context, old_view); + *ptr = view; +} + /* * Convenience wrappers for screen buffer functions. @@ -261,24 +274,24 @@ pipe_buffer_read(struct pipe_screen *screen, } static INLINE void * -pipe_transfer_map( struct pipe_transfer *transf ) +pipe_transfer_map( struct pipe_context *context, + struct pipe_transfer *transf ) { - struct pipe_screen *screen = transf->texture->screen; - return screen->transfer_map(screen, transf); + return context->transfer_map(context, transf); } static INLINE void -pipe_transfer_unmap( struct pipe_transfer *transf ) +pipe_transfer_unmap( struct pipe_context *context, + struct pipe_transfer *transf ) { - struct pipe_screen *screen = transf->texture->screen; - screen->transfer_unmap(screen, transf); + context->transfer_unmap(context, transf); } static INLINE void -pipe_transfer_destroy( struct pipe_transfer *transf ) +pipe_transfer_destroy( struct pipe_context *context, + struct pipe_transfer *transfer ) { - struct pipe_screen *screen = transf->texture->screen; - screen->tex_transfer_destroy(transf); + context->tex_transfer_destroy(context, transfer); } static INLINE unsigned