Merge branch '7.8'
[mesa.git] / src / gallium / auxiliary / util / u_inlines.h
index 0cb3432c6e4a5c983255b9e34c6d0ed0f23c60e1..e22ab188e113897bccde250b759c76f36ab20bb3 100644 (file)
@@ -120,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.
@@ -264,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