X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=dpsoftrast.c;h=86d4f7b5cbc7d8a5da85e155a23124358cff7e9e;hb=ffa2dfcb8f656bce0555cb4c2e08a4bc9315c4e9;hp=609f444e70bc0a26816d09581e2c6d8bc6231da9;hpb=f802623d71de8ef53d27ed30969c36583216097d;p=xonotic%2Fdarkplaces.git diff --git a/dpsoftrast.c b/dpsoftrast.c index 609f444e..86d4f7b5 100644 --- a/dpsoftrast.c +++ b/dpsoftrast.c @@ -27,6 +27,20 @@ typedef qboolean bool; #define ATOMIC_INCREMENT(counter) (OSAtomicIncrement32Barrier(&(counter))) #define ATOMIC_DECREMENT(counter) (OSAtomicDecrement32Barrier(&(counter))) #define ATOMIC_ADD(counter, val) ((void)OSAtomicAdd32Barrier((val), &(counter))) + #elif defined(__GNUC__) && defined(WIN32) + #define ALIGN(var) var __attribute__((__aligned__(16))) + #define ATOMIC(var) var __attribute__((__aligned__(32))) + #define MEMORY_BARRIER (_mm_sfence()) + //(__sync_synchronize()) + #define ATOMIC_COUNTER volatile LONG + // this LONG * cast serves to fix an issue with broken mingw + // packages on Ubuntu; these only declare the function to take + // a LONG *, causing a compile error here. This seems to be + // error- and warn-free on platforms that DO declare + // InterlockedIncrement correctly, like mingw on Windows. + #define ATOMIC_INCREMENT(counter) (InterlockedIncrement((LONG *) &(counter))) + #define ATOMIC_DECREMENT(counter) (InterlockedDecrement((LONG *) &(counter))) + #define ATOMIC_ADD(counter, val) ((void)InterlockedExchangeAdd((LONG *) &(counter), (val))) #elif defined(__GNUC__) #define ALIGN(var) var __attribute__((__aligned__(16))) #define ATOMIC(var) var __attribute__((__aligned__(32))) @@ -73,7 +87,7 @@ typedef qboolean bool; #ifdef SSE_POSSIBLE #include -#if defined(__GNUC__) && (__GNUC < 4 || __GNUC_MINOR__ < 6) +#if defined(__GNUC__) && (__GNUC < 4 || __GNUC_MINOR__ < 6) && !defined(__clang__) #define _mm_cvtss_f32(val) (__builtin_ia32_vec_ext_v4sf ((__v4sf)(val), 0)) #endif