[Mesa-dev] [PATCH 12/18] swr: [rasterizer common] OSX cleanups

Tim Rowley timothy.o.rowley at intel.com
Tue May 17 01:10:51 UTC 2016


---
 src/gallium/drivers/swr/rasterizer/common/os.h              | 9 ++++++++-
 src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp | 2 +-
 2 files changed, 9 insertions(+), 2 deletions(-)

diff --git a/src/gallium/drivers/swr/rasterizer/common/os.h b/src/gallium/drivers/swr/rasterizer/common/os.h
index 94bb567..51e6c5a 100644
--- a/src/gallium/drivers/swr/rasterizer/common/os.h
+++ b/src/gallium/drivers/swr/rasterizer/common/os.h
@@ -68,7 +68,7 @@ static inline void AlignedFree(void* p)
 #define _mm_popcount_sizeT _mm_popcnt_u32
 #endif
 
-#elif defined(FORCE_LINUX) || defined(__linux__) || defined(__gnu_linux__)
+#elif defined(__APPLE__) || defined(FORCE_LINUX) || defined(__linux__) || defined(__gnu_linux__)
 
 #define SWR_API
 
@@ -80,6 +80,7 @@ static inline void AlignedFree(void* p)
 #include <unistd.h>
 #include <sys/stat.h>
 #include <stdio.h>
+#include <limits.h>
 
 typedef void            VOID;
 typedef void*           LPVOID;
@@ -95,6 +96,8 @@ typedef unsigned int    DWORD;
 #undef TRUE
 #define TRUE 1
 
+#define MAX_PATH PATH_MAX
+
 #define OSALIGN(RWORD, WIDTH) RWORD __attribute__((aligned(WIDTH)))
 #define THREAD __thread
 #ifndef INLINE
@@ -194,6 +197,10 @@ void AlignedFree(void* p)
     free(p);
 }
 
+#define _countof(a) (sizeof(a)/sizeof(*(a)))
+
+#define sprintf_s sprintf
+#define strcpy_s(dst,size,src) strncpy(dst,src,size)
 #define GetCurrentProcessId getpid
 #define GetCurrentThreadId gettid
 
diff --git a/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp b/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp
index df09f6c..8df5deb 100644
--- a/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp
+++ b/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp
@@ -32,7 +32,7 @@
 
 #if defined(_WIN32)
 #define PATH_SEPARATOR "\\"
-#elif defined(__unix__)
+#elif defined(__unix__) || defined(__APPLE__)
 #define PATH_SEPARATOR "/"
 #else
 #error "Unsupported platform"
-- 
1.9.1



More information about the mesa-dev mailing list