swr: [rasterizer common] add OSX to unix portability sections
authorTim Rowley <timothy.o.rowley@intel.com>
Fri, 6 May 2016 20:38:25 +0000 (14:38 -0600)
committerTim Rowley <timothy.o.rowley@intel.com>
Thu, 19 May 2016 21:26:44 +0000 (16:26 -0500)
Reviewed-by: Bruce Cherniak <bruce.cherniak@intel.com>
src/gallium/drivers/swr/rasterizer/common/os.h
src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp

index 8b156702ba0b00a534c70b0486fa892ce4cccdc3..b97b00517388ec0339a79ceae18a107fd6642f57 100644 (file)
@@ -69,7 +69,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
 
@@ -81,6 +81,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;
@@ -96,6 +97,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
@@ -187,6 +190,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
 
index df09f6caadcd8a2ce48959807e83ce7bbb3a5f98..8df5deb3416a2d2cabceccf7437aa28c3bfceb6b 100644 (file)
@@ -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"