aboutsummaryrefslogtreecommitdiffstats
path: root/src/gallium/drivers/swr/rasterizer/common
diff options
context:
space:
mode:
authorTim Rowley <[email protected]>2016-05-06 14:38:25 -0600
committerTim Rowley <[email protected]>2016-05-19 16:26:44 -0500
commitda751600390b37a5ea2dd6cc07838f6a29000639 (patch)
treece3f87fc09e1a7e8f103408aecdeec0b6172782b /src/gallium/drivers/swr/rasterizer/common
parent4997169779069692c0e64df2dfb89185ae48f193 (diff)
swr: [rasterizer common] add OSX to unix portability sections
Reviewed-by: Bruce Cherniak <[email protected]>
Diffstat (limited to 'src/gallium/drivers/swr/rasterizer/common')
-rw-r--r--src/gallium/drivers/swr/rasterizer/common/os.h9
-rw-r--r--src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp2
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 8b156702ba0..b97b0051738 100644
--- a/src/gallium/drivers/swr/rasterizer/common/os.h
+++ b/src/gallium/drivers/swr/rasterizer/common/os.h
@@ -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
diff --git a/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp b/src/gallium/drivers/swr/rasterizer/common/rdtsc_buckets.cpp
index df09f6caadc..8df5deb3416 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"