gallium: Add a macro for memory barriers.
authorJosé Fonseca <jfonseca@vmware.com>
Wed, 14 Jul 2010 13:00:20 +0000 (14:00 +0100)
committerJosé Fonseca <jfonseca@vmware.com>
Wed, 14 Jul 2010 13:38:02 +0000 (14:38 +0100)
src/gallium/include/pipe/p_compiler.h

index a14486a..619a62f 100644 (file)
@@ -184,6 +184,25 @@ typedef unsigned char boolean;
 
 #endif
 
+
+#if defined(__GNUC__)
+
+#define PIPE_READ_WRITE_BARRIER() __asm__("":::"memory")
+
+#elif defined(_MSC_VER)
+
+void _ReadWriteBarrier(void);
+#pragma intrinsic(_ReadWriteBarrier)
+#define PIPE_READ_WRITE_BARRIER() _ReadWriteBarrier()
+
+#else
+
+#warning "Unsupported compiler"
+#define PIPE_READ_WRITE_BARRIER() /* */
+
+#endif
+
+
 /* You should use these macros to mark if blocks where the if condition
  * is either likely to be true, or unlikely to be true.
  *