summaryrefslogtreecommitdiff
path: root/src/gallium/include
diff options
context:
space:
mode:
authorJosé Fonseca <jfonseca@vmware.com>2010-07-14 14:00:20 +0100
committerJosé Fonseca <jfonseca@vmware.com>2010-07-14 14:38:02 +0100
commitc6c62164c369eefe1cac06190a87050977c376c1 (patch)
treef27ec8138aa7a2266d7a22a80b8b0d2f11a9557a /src/gallium/include
parent5e2437a232b566702194bf379911d2680d24b642 (diff)
gallium: Add a macro for memory barriers.
Diffstat (limited to 'src/gallium/include')
-rw-r--r--src/gallium/include/pipe/p_compiler.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/src/gallium/include/pipe/p_compiler.h b/src/gallium/include/pipe/p_compiler.h
index a14486a5fb5..619a62f8f14 100644
--- a/src/gallium/include/pipe/p_compiler.h
+++ b/src/gallium/include/pipe/p_compiler.h
@@ -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.
*