OLD | NEW |
1 | 1 |
2 /* | 2 /* |
3 * Copyright 2010 Google Inc. | 3 * Copyright 2010 Google Inc. |
4 * | 4 * |
5 * Use of this source code is governed by a BSD-style license that can be | 5 * Use of this source code is governed by a BSD-style license that can be |
6 * found in the LICENSE file. | 6 * found in the LICENSE file. |
7 */ | 7 */ |
8 | 8 |
9 | 9 |
10 | 10 |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 #undef GR_QNX_BUILD | 78 #undef GR_QNX_BUILD |
79 #define GR_QNX_BUILD 1 | 79 #define GR_QNX_BUILD 1 |
80 // #error "QNX" | 80 // #error "QNX" |
81 #else | 81 #else |
82 #undef GR_LINUX_BUILD | 82 #undef GR_LINUX_BUILD |
83 #define GR_LINUX_BUILD 1 | 83 #define GR_LINUX_BUILD 1 |
84 // #error "LINUX" | 84 // #error "LINUX" |
85 #endif | 85 #endif |
86 #endif | 86 #endif |
87 | 87 |
88 // we need both GR_DEBUG and GR_RELEASE to be defined as 0 or 1 | 88 #if !defined(SK_DEBUG) && !defined(GR_RELEASE) |
89 // | 89 #ifdef NDEBUG |
90 #ifndef GR_DEBUG | 90 #define GR_RELEASE 1 |
91 #ifdef GR_RELEASE | |
92 #define GR_DEBUG !GR_RELEASE | |
93 #else | |
94 #ifdef NDEBUG | |
95 #define GR_DEBUG 0 | |
96 #else | |
97 #define GR_DEBUG 1 | |
98 #endif | |
99 #endif | 91 #endif |
100 #endif | 92 #endif |
101 | 93 |
102 #ifndef GR_RELEASE | 94 #if defined(SK_DEBUG) && defined(GR_RELEASE) |
103 #define GR_RELEASE !GR_DEBUG | 95 #error "cannot define both SK_DEBUG and GR_RELEASE" |
104 #endif | |
105 | |
106 #if GR_DEBUG == GR_RELEASE | |
107 #error "GR_DEBUG and GR_RELEASE must not be the same" | |
108 #endif | 96 #endif |
109 | 97 |
110 /////////////////////////////////////////////////////////////////////////////// | 98 /////////////////////////////////////////////////////////////////////////////// |
111 /////////////////////////////////////////////////////////////////////////////// | 99 /////////////////////////////////////////////////////////////////////////////// |
112 | 100 |
113 #if GR_WIN32_BUILD | 101 #if GR_WIN32_BUILD |
114 // VC8 doesn't support stdint.h, so we define those types here. | 102 // VC8 doesn't support stdint.h, so we define those types here. |
115 typedef signed char int8_t; | 103 typedef signed char int8_t; |
116 typedef unsigned char uint8_t; | 104 typedef unsigned char uint8_t; |
117 typedef short int16_t; | 105 typedef short int16_t; |
(...skipping 17 matching lines...) Expand all Loading... |
135 #include <stdint.h> | 123 #include <stdint.h> |
136 #endif | 124 #endif |
137 | 125 |
138 /* | 126 /* |
139 * The "user config" file can be empty, and everything should work. It is | 127 * The "user config" file can be empty, and everything should work. It is |
140 * meant to store a given platform/client's overrides of our guess-work. | 128 * meant to store a given platform/client's overrides of our guess-work. |
141 * | 129 * |
142 * A alternate user config file can be specified by defining | 130 * A alternate user config file can be specified by defining |
143 * GR_USER_CONFIG_FILE. It should be defined relative to GrConfig.h | 131 * GR_USER_CONFIG_FILE. It should be defined relative to GrConfig.h |
144 * | 132 * |
145 * e.g. it can specify GR_DEBUG/GR_RELEASE as it please, change the BUILD | 133 * e.g. it can change the BUILD target or supply its own defines for anything |
146 * target, or supply its own defines for anything else (e.g. GR_DEFAULT_TEXTURE
_CACHE_MB_LIMIT) | 134 * else (e.g. GR_DEFAULT_TEXTURE_CACHE_MB_LIMIT) |
147 */ | 135 */ |
148 #if !defined(GR_USER_CONFIG_FILE) | 136 #if !defined(GR_USER_CONFIG_FILE) |
149 #include "GrUserConfig.h" | 137 #include "GrUserConfig.h" |
150 #else | 138 #else |
151 #include GR_USER_CONFIG_FILE | 139 #include GR_USER_CONFIG_FILE |
152 #endif | 140 #endif |
153 | 141 |
154 | 142 |
155 /////////////////////////////////////////////////////////////////////////////// | 143 /////////////////////////////////////////////////////////////////////////////// |
156 /////////////////////////////////////////////////////////////////////////////// | 144 /////////////////////////////////////////////////////////////////////////////// |
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
235 // sign extend for 64bit architectures to be sure this is | 223 // sign extend for 64bit architectures to be sure this is |
236 // in the high address range | 224 // in the high address range |
237 #define GR_ALWAYSBREAK SkNO_RETURN_HINT(); *((int*)(int64_t)(int32_t)0xb
eefcafe) = 0; | 225 #define GR_ALWAYSBREAK SkNO_RETURN_HINT(); *((int*)(int64_t)(int32_t)0xb
eefcafe) = 0; |
238 #endif | 226 #endif |
239 #endif | 227 #endif |
240 | 228 |
241 /** | 229 /** |
242 * GR_DEBUGBREAK is an unconditional break in debug builds. | 230 * GR_DEBUGBREAK is an unconditional break in debug builds. |
243 */ | 231 */ |
244 #if !defined(GR_DEBUGBREAK) | 232 #if !defined(GR_DEBUGBREAK) |
245 #if GR_DEBUG | 233 #ifdef SK_DEBUG |
246 #define GR_DEBUGBREAK GR_ALWAYSBREAK | 234 #define GR_DEBUGBREAK GR_ALWAYSBREAK |
247 #else | 235 #else |
248 #define GR_DEBUGBREAK | 236 #define GR_DEBUGBREAK |
249 #endif | 237 #endif |
250 #endif | 238 #endif |
251 | 239 |
252 /** | 240 /** |
253 * GR_ALWAYSASSERT is an assertion in all builds. | 241 * GR_ALWAYSASSERT is an assertion in all builds. |
254 */ | 242 */ |
255 #if !defined(GR_ALWAYSASSERT) | 243 #if !defined(GR_ALWAYSASSERT) |
256 #define GR_ALWAYSASSERT(COND) \ | 244 #define GR_ALWAYSASSERT(COND) \ |
257 do { \ | 245 do { \ |
258 if (!(COND)) { \ | 246 if (!(COND)) { \ |
259 GrPrintf("%s %s failed\n", GR_FILE_AND_LINE_STR, #COND); \ | 247 GrPrintf("%s %s failed\n", GR_FILE_AND_LINE_STR, #COND); \ |
260 GR_ALWAYSBREAK; \ | 248 GR_ALWAYSBREAK; \ |
261 } \ | 249 } \ |
262 } while (false) | 250 } while (false) |
263 #endif | 251 #endif |
264 | 252 |
265 /** | 253 /** |
266 * GR_DEBUGASSERT is an assertion in debug builds only. | 254 * GR_DEBUGASSERT is an assertion in debug builds only. |
267 */ | 255 */ |
268 #if !defined(GR_DEBUGASSERT) | 256 #if !defined(GR_DEBUGASSERT) |
269 #if GR_DEBUG | 257 #ifdef SK_DEBUG |
270 #define GR_DEBUGASSERT(COND) GR_ALWAYSASSERT(COND) | 258 #define GR_DEBUGASSERT(COND) GR_ALWAYSASSERT(COND) |
271 #else | 259 #else |
272 #define GR_DEBUGASSERT(COND) | 260 #define GR_DEBUGASSERT(COND) |
273 #endif | 261 #endif |
274 #endif | 262 #endif |
275 | 263 |
276 /** | 264 /** |
277 * Prettier forms of the above macros. | 265 * Prettier forms of the above macros. |
278 */ | 266 */ |
279 #define GrAlwaysAssert(COND) GR_ALWAYSASSERT(COND) | 267 #define GrAlwaysAssert(COND) GR_ALWAYSASSERT(COND) |
280 | 268 |
281 /** | 269 /** |
282 * Crash from unrecoverable condition, optionally with a message. The debug vari
ants only | 270 * Crash from unrecoverable condition, optionally with a message. The debug vari
ants only |
283 * crash in a debug build. The message versions print the message regardless of
release vs debug. | 271 * crash in a debug build. The message versions print the message regardless of
release vs debug. |
284 */ | 272 */ |
285 inline void GrCrash() { GrAlwaysAssert(false); } | 273 inline void GrCrash() { GrAlwaysAssert(false); } |
286 inline void GrCrash(const char* msg) { GrPrintf(msg); GrAlwaysAssert(false); } | 274 inline void GrCrash(const char* msg) { GrPrintf(msg); GrAlwaysAssert(false); } |
287 inline void GrDebugCrash() { SkASSERT(false); } | 275 inline void GrDebugCrash() { SkASSERT(false); } |
288 inline void GrDebugCrash(const char* msg) { GrPrintf(msg); SkASSERT(false); } | 276 inline void GrDebugCrash(const char* msg) { GrPrintf(msg); SkASSERT(false); } |
289 | 277 |
290 /** | 278 /** |
291 * GR_DEBUGCODE compiles the code X in debug builds only | 279 * GR_DEBUGCODE compiles the code X in debug builds only |
292 */ | 280 */ |
293 #if !defined(GR_DEBUGCODE) | 281 #if !defined(GR_DEBUGCODE) |
294 #if GR_DEBUG | 282 #ifdef SK_DEBUG |
295 #define GR_DEBUGCODE(X) X | 283 #define GR_DEBUGCODE(X) X |
296 #else | 284 #else |
297 #define GR_DEBUGCODE(X) | 285 #define GR_DEBUGCODE(X) |
298 #endif | 286 #endif |
299 #endif | 287 #endif |
300 | 288 |
301 /** | 289 /** |
302 * GR_STATIC_ASSERT is a compile time assertion. Depending on the platform | 290 * GR_STATIC_ASSERT is a compile time assertion. Depending on the platform |
303 * it may print the message in the compiler log. Obviously, the condition must | 291 * it may print the message in the compiler log. Obviously, the condition must |
304 * be evaluatable at compile time. | 292 * be evaluatable at compile time. |
(...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
377 #endif | 365 #endif |
378 #if GR_LINUX_BUILD | 366 #if GR_LINUX_BUILD |
379 // #pragma message GR_WARN("GR_LINUX_BUILD") | 367 // #pragma message GR_WARN("GR_LINUX_BUILD") |
380 #endif | 368 #endif |
381 #if GR_QNX_BUILD | 369 #if GR_QNX_BUILD |
382 // #pragma message GR_WARN("GR_QNX_BUILD") | 370 // #pragma message GR_WARN("GR_QNX_BUILD") |
383 #endif | 371 #endif |
384 #endif | 372 #endif |
385 | 373 |
386 #endif | 374 #endif |
OLD | NEW |