Merge remote branch 'origin/master' into gallium_draw_llvm
[mesa.git] / src / gallium / auxiliary / util / u_inlines.h
index 72a4d6d508330f80d4793141f5082f7cfeab1207..e7255e3baa8bfcdf5f31f4a0adb9110bd6fa4c31 100644 (file)
@@ -33,7 +33,7 @@
 #include "pipe/p_state.h"
 #include "pipe/p_screen.h"
 #include "util/u_debug.h"
-#include "pipe/p_atomic.h"
+#include "util/u_atomic.h"
 
 
 #ifdef __cplusplus
@@ -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);
@@ -261,24 +264,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