Lines 21-26
Link Here
|
21 |
#if defined(__APPLE__) |
21 |
#if defined(__APPLE__) |
22 |
#include <libkern/OSAtomic.h> |
22 |
#include <libkern/OSAtomic.h> |
23 |
#define ALIGN(var) var __attribute__((__aligned__(16))) |
23 |
#define ALIGN(var) var __attribute__((__aligned__(16))) |
|
|
24 |
#define ALIGN_STRUCT(def) struct __attribute__((__aligned__(16))) def |
24 |
#define ATOMIC(var) var __attribute__((__aligned__(4))) |
25 |
#define ATOMIC(var) var __attribute__((__aligned__(4))) |
25 |
#define MEMORY_BARRIER (_mm_sfence()) |
26 |
#define MEMORY_BARRIER (_mm_sfence()) |
26 |
#define ATOMIC_COUNTER volatile int32_t |
27 |
#define ATOMIC_COUNTER volatile int32_t |
Lines 29-34
Link Here
|
29 |
#define ATOMIC_ADD(counter, val) ((void)OSAtomicAdd32Barrier((val), &(counter))) |
30 |
#define ATOMIC_ADD(counter, val) ((void)OSAtomicAdd32Barrier((val), &(counter))) |
30 |
#elif defined(__GNUC__) && defined(WIN32) |
31 |
#elif defined(__GNUC__) && defined(WIN32) |
31 |
#define ALIGN(var) var __attribute__((__aligned__(16))) |
32 |
#define ALIGN(var) var __attribute__((__aligned__(16))) |
|
|
33 |
#define ALIGN_STRUCT(def) struct __attribute__((__aligned__(16))) def |
32 |
#define ATOMIC(var) var __attribute__((__aligned__(4))) |
34 |
#define ATOMIC(var) var __attribute__((__aligned__(4))) |
33 |
#define MEMORY_BARRIER (_mm_sfence()) |
35 |
#define MEMORY_BARRIER (_mm_sfence()) |
34 |
//(__sync_synchronize()) |
36 |
//(__sync_synchronize()) |
Lines 43-48
Link Here
|
43 |
#define ATOMIC_ADD(counter, val) ((void)InterlockedExchangeAdd((LONG *) &(counter), (val))) |
45 |
#define ATOMIC_ADD(counter, val) ((void)InterlockedExchangeAdd((LONG *) &(counter), (val))) |
44 |
#elif defined(__GNUC__) |
46 |
#elif defined(__GNUC__) |
45 |
#define ALIGN(var) var __attribute__((__aligned__(16))) |
47 |
#define ALIGN(var) var __attribute__((__aligned__(16))) |
|
|
48 |
#define ALIGN_STRUCT(def) struct __attribute__((__aligned__(16))) def |
46 |
#define ATOMIC(var) var __attribute__((__aligned__(4))) |
49 |
#define ATOMIC(var) var __attribute__((__aligned__(4))) |
47 |
#define MEMORY_BARRIER (_mm_sfence()) |
50 |
#define MEMORY_BARRIER (_mm_sfence()) |
48 |
//(__sync_synchronize()) |
51 |
//(__sync_synchronize()) |
Lines 52-57
Link Here
|
52 |
#define ATOMIC_ADD(counter, val) ((void)__sync_fetch_and_add(&(counter), (val))) |
55 |
#define ATOMIC_ADD(counter, val) ((void)__sync_fetch_and_add(&(counter), (val))) |
53 |
#elif defined(_MSC_VER) |
56 |
#elif defined(_MSC_VER) |
54 |
#define ALIGN(var) __declspec(align(16)) var |
57 |
#define ALIGN(var) __declspec(align(16)) var |
|
|
58 |
#define ALIGN_STRUCT(def) ALIGN(struct def) |
55 |
#define ATOMIC(var) __declspec(align(4)) var |
59 |
#define ATOMIC(var) __declspec(align(4)) var |
56 |
#define MEMORY_BARRIER (_mm_sfence()) |
60 |
#define MEMORY_BARRIER (_mm_sfence()) |
57 |
//(MemoryBarrier()) |
61 |
//(MemoryBarrier()) |
Lines 65-70
Link Here
|
65 |
#ifndef ALIGN |
69 |
#ifndef ALIGN |
66 |
#define ALIGN(var) var |
70 |
#define ALIGN(var) var |
67 |
#endif |
71 |
#endif |
|
|
72 |
#ifndef ALIGN_STRUCT |
73 |
#define ALIGN_STRUCT(def) def |
74 |
#endif |
68 |
#ifndef ATOMIC |
75 |
#ifndef ATOMIC |
69 |
#define ATOMIC(var) var |
76 |
#define ATOMIC(var) var |
70 |
#endif |
77 |
#endif |
Lines 163-169
Link Here
|
163 |
#define DPSOFTRAST_DRAW_MAXCOMMANDPOOL 2097152 |
170 |
#define DPSOFTRAST_DRAW_MAXCOMMANDPOOL 2097152 |
164 |
#define DPSOFTRAST_DRAW_MAXCOMMANDSIZE 16384 |
171 |
#define DPSOFTRAST_DRAW_MAXCOMMANDSIZE 16384 |
165 |
|
172 |
|
166 |
typedef ALIGN(struct DPSOFTRAST_State_Command_Pool_s |
173 |
typedef ALIGN_STRUCT(DPSOFTRAST_State_Command_Pool_s |
167 |
{ |
174 |
{ |
168 |
int freecommand; |
175 |
int freecommand; |
169 |
int usedcommands; |
176 |
int usedcommands; |
Lines 171-177
Link Here
|
171 |
} |
178 |
} |
172 |
DPSOFTRAST_State_Command_Pool); |
179 |
DPSOFTRAST_State_Command_Pool); |
173 |
|
180 |
|
174 |
typedef ALIGN(struct DPSOFTRAST_State_Triangle_s |
181 |
typedef ALIGN_STRUCT(DPSOFTRAST_State_Triangle_s |
175 |
{ |
182 |
{ |
176 |
unsigned char mip[DPSOFTRAST_MAXTEXTUREUNITS]; // texcoord to screen space density values (for picking mipmap of textures) |
183 |
unsigned char mip[DPSOFTRAST_MAXTEXTUREUNITS]; // texcoord to screen space density values (for picking mipmap of textures) |
177 |
float w[3]; |
184 |
float w[3]; |
Lines 198-204
Link Here
|
198 |
|
205 |
|
199 |
#define DPSOFTRAST_DRAW_MAXSUBSPAN 16 |
206 |
#define DPSOFTRAST_DRAW_MAXSUBSPAN 16 |
200 |
|
207 |
|
201 |
typedef ALIGN(struct DPSOFTRAST_State_Span_s |
208 |
typedef ALIGN_STRUCT(DPSOFTRAST_State_Span_s |
202 |
{ |
209 |
{ |
203 |
int triangle; // triangle this span was generated by |
210 |
int triangle; // triangle this span was generated by |
204 |
int x; // framebuffer x coord |
211 |
int x; // framebuffer x coord |
Lines 236-242
Link Here
|
236 |
} |
243 |
} |
237 |
DPSOFTRAST_BLENDMODE; |
244 |
DPSOFTRAST_BLENDMODE; |
238 |
|
245 |
|
239 |
typedef ALIGN(struct DPSOFTRAST_State_Thread_s |
246 |
typedef ALIGN_STRUCT(DPSOFTRAST_State_Thread_s |
240 |
{ |
247 |
{ |
241 |
void *thread; |
248 |
void *thread; |
242 |
int index; |
249 |
int index; |
Lines 302-308
Link Here
|
302 |
} |
309 |
} |
303 |
DPSOFTRAST_State_Thread); |
310 |
DPSOFTRAST_State_Thread); |
304 |
|
311 |
|
305 |
typedef ALIGN(struct DPSOFTRAST_State_s |
312 |
typedef ALIGN_STRUCT(DPSOFTRAST_State_s |
306 |
{ |
313 |
{ |
307 |
int fb_width; |
314 |
int fb_width; |
308 |
int fb_height; |
315 |
int fb_height; |