epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 1 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 2 | /* |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 3 | * Copyright 2010 Google Inc. |
| 4 | * |
| 5 | * Use of this source code is governed by a BSD-style license that can be |
| 6 | * found in the LICENSE file. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 7 | */ |
| 8 | |
| 9 | |
epoger@google.com | ec3ed6a | 2011-07-28 14:26:00 +0000 | [diff] [blame] | 10 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 11 | #ifndef GrConfig_DEFINED |
| 12 | #define GrConfig_DEFINED |
| 13 | |
| 14 | /////////////////////////////////////////////////////////////////////////////// |
| 15 | // preconfig section: |
| 16 | // |
| 17 | // All the work before including GrUserConfig.h should center around guessing |
| 18 | // what platform we're on, and defining low-level symbols based on that. |
| 19 | // |
| 20 | // A build environment may have already defined symbols, so we first check |
| 21 | // for that |
| 22 | // |
| 23 | |
| 24 | // hack to ensure we know what sort of Apple platform we're on |
| 25 | #if defined(__APPLE_CPP__) || defined(__APPLE_CC__) |
| 26 | #include <TargetConditionals.h> |
| 27 | #endif |
| 28 | |
| 29 | /** |
| 30 | * Gr defines are set to 0 or 1, rather than being undefined or defined |
| 31 | */ |
| 32 | |
| 33 | #if !defined(GR_ANDROID_BUILD) |
| 34 | #define GR_ANDROID_BUILD 0 |
| 35 | #endif |
| 36 | #if !defined(GR_IOS_BUILD) |
| 37 | #define GR_IOS_BUILD 0 |
| 38 | #endif |
| 39 | #if !defined(GR_LINUX_BUILD) |
| 40 | #define GR_LINUX_BUILD 0 |
| 41 | #endif |
| 42 | #if !defined(GR_MAC_BUILD) |
| 43 | #define GR_MAC_BUILD 0 |
| 44 | #endif |
| 45 | #if !defined(GR_WIN32_BUILD) |
| 46 | #define GR_WIN32_BUILD 0 |
| 47 | #endif |
| 48 | #if !defined(GR_QNX_BUILD) |
| 49 | #define GR_QNX_BUILD 0 |
| 50 | #endif |
| 51 | |
| 52 | /** |
| 53 | * If no build target has been defined, attempt to infer. |
| 54 | */ |
| 55 | #if !GR_ANDROID_BUILD && !GR_IOS_BUILD && !GR_LINUX_BUILD && !GR_MAC_BUILD && !GR_WIN32_BUILD && !GR_QNX_BUILD |
| 56 | #if defined(_WIN32) |
| 57 | #undef GR_WIN32_BUILD |
| 58 | #define GR_WIN32_BUILD 1 |
| 59 | // #error "WIN" |
| 60 | #elif TARGET_OS_IPHONE || TARGET_IPHONE_SIMULATOR |
| 61 | #undef GR_IOS_BUILD |
| 62 | #define GR_IOS_BUILD 1 |
| 63 | // #error "IOS" |
djsollen@google.com | 56c6977 | 2011-11-08 19:00:26 +0000 | [diff] [blame] | 64 | #elif defined(SK_BUILD_FOR_ANDROID) |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 65 | #undef GR_ANDROID_BUILD |
| 66 | #define GR_ANDROID_BUILD 1 |
| 67 | // #error "ANDROID" |
| 68 | #elif TARGET_OS_MAC |
| 69 | #undef GR_MAC_BUILD |
| 70 | #define GR_MAC_BUILD 1 |
| 71 | // #error "MAC" |
| 72 | #elif TARGET_OS_QNX || defined(__QNXNTO__) |
| 73 | #undef GR_QNX_BUILD |
| 74 | #define GR_QNX_BUILD 1 |
| 75 | // #error "QNX" |
| 76 | #else |
| 77 | #undef GR_LINUX_BUILD |
| 78 | #define GR_LINUX_BUILD 1 |
| 79 | // #error "LINUX" |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 80 | #endif |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 81 | #endif |
| 82 | |
reed@google.com | c921843 | 2011-01-25 19:05:12 +0000 | [diff] [blame] | 83 | // we need both GR_DEBUG and GR_RELEASE to be defined as 0 or 1 |
| 84 | // |
| 85 | #ifndef GR_DEBUG |
| 86 | #ifdef GR_RELEASE |
| 87 | #define GR_DEBUG !GR_RELEASE |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 88 | #else |
reed@google.com | c921843 | 2011-01-25 19:05:12 +0000 | [diff] [blame] | 89 | #ifdef NDEBUG |
| 90 | #define GR_DEBUG 0 |
| 91 | #else |
| 92 | #define GR_DEBUG 1 |
| 93 | #endif |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 94 | #endif |
reed@google.com | c921843 | 2011-01-25 19:05:12 +0000 | [diff] [blame] | 95 | #endif |
| 96 | |
| 97 | #ifndef GR_RELEASE |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 98 | #define GR_RELEASE !GR_DEBUG |
| 99 | #endif |
| 100 | |
reed@google.com | c921843 | 2011-01-25 19:05:12 +0000 | [diff] [blame] | 101 | #if GR_DEBUG == GR_RELEASE |
reed@google.com | 8752ad7 | 2011-01-26 04:55:57 +0000 | [diff] [blame] | 102 | #error "GR_DEBUG and GR_RELEASE must not be the same" |
reed@google.com | c921843 | 2011-01-25 19:05:12 +0000 | [diff] [blame] | 103 | #endif |
| 104 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 105 | /////////////////////////////////////////////////////////////////////////////// |
| 106 | /////////////////////////////////////////////////////////////////////////////// |
| 107 | |
senorblanco@chromium.org | 9d18b78 | 2011-03-28 20:47:09 +0000 | [diff] [blame] | 108 | #if GR_WIN32_BUILD |
| 109 | // VC8 doesn't support stdint.h, so we define those types here. |
| 110 | typedef signed char int8_t; |
| 111 | typedef unsigned char uint8_t; |
| 112 | typedef short int16_t; |
| 113 | typedef unsigned short uint16_t; |
| 114 | typedef int int32_t; |
| 115 | typedef unsigned uint32_t; |
bsalomon@google.com | 4be283f | 2011-04-19 21:15:09 +0000 | [diff] [blame] | 116 | typedef __int64 int64_t; |
| 117 | typedef unsigned __int64 uint64_t; |
senorblanco@chromium.org | 9d18b78 | 2011-03-28 20:47:09 +0000 | [diff] [blame] | 118 | #else |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 119 | /* |
bsalomon@google.com | 9182610 | 2011-03-21 19:51:57 +0000 | [diff] [blame] | 120 | * Include stdint.h with defines that trigger declaration of C99 limit/const |
| 121 | * macros here before anyone else has a chance to include stdint.h without |
| 122 | * these. |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 123 | */ |
| 124 | #define __STDC_LIMIT_MACROS |
| 125 | #define __STDC_CONSTANT_MACROS |
| 126 | #include <stdint.h> |
senorblanco@chromium.org | 9d18b78 | 2011-03-28 20:47:09 +0000 | [diff] [blame] | 127 | #endif |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 128 | |
| 129 | /* |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 130 | * The "user config" file can be empty, and everything should work. It is |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 131 | * meant to store a given platform/client's overrides of our guess-work. |
| 132 | * |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 133 | * A alternate user config file can be specified by defining |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 134 | * GR_USER_CONFIG_FILE. It should be defined relative to GrConfig.h |
| 135 | * |
| 136 | * e.g. it can specify GR_DEBUG/GR_RELEASE as it please, change the BUILD |
| 137 | * target, or supply its own defines for anything else (e.g. GR_SCALAR) |
| 138 | */ |
| 139 | #if !defined(GR_USER_CONFIG_FILE) |
| 140 | #include "GrUserConfig.h" |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 141 | #else |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 142 | #include GR_USER_CONFIG_FILE |
| 143 | #endif |
| 144 | |
| 145 | |
| 146 | /////////////////////////////////////////////////////////////////////////////// |
| 147 | /////////////////////////////////////////////////////////////////////////////// |
| 148 | // postconfig section: |
| 149 | // |
bsalomon@google.com | 9182610 | 2011-03-21 19:51:57 +0000 | [diff] [blame] | 150 | |
| 151 | // GR_IMPLEMENTATION should be define to 1 when building Gr and 0 when including |
| 152 | // it in another dependent build. The Gr makefile/ide-project should define this |
| 153 | // to 1. |
| 154 | #if !defined(GR_IMPLEMENTATION) |
| 155 | #define GR_IMPLEMENTATION 0 |
| 156 | #endif |
| 157 | |
| 158 | // If Gr is built as a shared library then GR_DLL should be defined to 1 (both |
| 159 | // when building Gr and when including its headers in dependent builds). Only |
| 160 | // currently supported minimally for Chrome's Win32 Multi-DLL build (TODO: |
| 161 | // correctly exort all of the public API correctly and support shared lib on |
| 162 | // other platforms). |
| 163 | #if !defined(GR_DLL) |
| 164 | #define GR_DLL 0 |
| 165 | #endif |
| 166 | |
bsalomon@google.com | 48ba56d | 2011-04-26 17:59:32 +0000 | [diff] [blame] | 167 | #if GR_DLL |
| 168 | #if GR_WIN32_BUILD |
| 169 | #if GR_IMPLEMENTATION |
| 170 | #define GR_API __declspec(dllexport) |
| 171 | #else |
| 172 | #define GR_API __declspec(dllimport) |
| 173 | #endif |
bsalomon@google.com | 9182610 | 2011-03-21 19:51:57 +0000 | [diff] [blame] | 174 | #else |
bsalomon@google.com | 48ba56d | 2011-04-26 17:59:32 +0000 | [diff] [blame] | 175 | #define GR_API __attribute__((visibility("default"))) |
bsalomon@google.com | 9182610 | 2011-03-21 19:51:57 +0000 | [diff] [blame] | 176 | #endif |
| 177 | #else |
| 178 | #define GR_API |
| 179 | #endif |
| 180 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 181 | // By now we must have a GR_..._BUILD symbol set to 1, and a decision about |
| 182 | // debug -vs- release |
| 183 | // |
| 184 | |
bungeman@google.com | f85abda | 2012-03-22 17:56:29 +0000 | [diff] [blame] | 185 | #define GrPrintf SkDebugf |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 186 | |
| 187 | /** |
| 188 | * GR_STRING makes a string of X where X is expanded before conversion to a string |
| 189 | * if X itself contains macros. |
| 190 | */ |
| 191 | #define GR_STRING(X) GR_STRING_IMPL(X) |
| 192 | #define GR_STRING_IMPL(X) #X |
| 193 | |
| 194 | /** |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 195 | * GR_CONCAT concatenates X and Y where each is expanded before |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 196 | * contanenation if either contains macros. |
| 197 | */ |
| 198 | #define GR_CONCAT(X,Y) GR_CONCAT_IMPL(X,Y) |
| 199 | #define GR_CONCAT_IMPL(X,Y) X##Y |
| 200 | |
| 201 | /** |
| 202 | * Creates a string of the form "<filename>(<linenumber>) : " |
| 203 | */ |
| 204 | #define GR_FILE_AND_LINE_STR __FILE__ "(" GR_STRING(__LINE__) ") : " |
| 205 | |
| 206 | /** |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 207 | * Compilers have different ways of issuing warnings. This macro |
| 208 | * attempts to abstract them, but may need to be specialized for your |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 209 | * particular compiler. |
| 210 | * To insert compiler warnings use "#pragma message GR_WARN(<string>)" |
| 211 | */ |
reed@google.com | c921843 | 2011-01-25 19:05:12 +0000 | [diff] [blame] | 212 | #if defined(_MSC_VER) && _MSC_VER |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 213 | #define GR_WARN(MSG) (GR_FILE_AND_LINE_STR "WARNING: " MSG) |
| 214 | #else//__GNUC__ - may need other defines for different compilers |
| 215 | #define GR_WARN(MSG) ("WARNING: " MSG) |
| 216 | #endif |
| 217 | |
| 218 | /** |
| 219 | * GR_ALWAYSBREAK is an unconditional break in all builds. |
| 220 | */ |
| 221 | #if !defined(GR_ALWAYSBREAK) |
| 222 | #if GR_WIN32_BUILD |
bsalomon@google.com | 0442380 | 2011-11-23 21:25:35 +0000 | [diff] [blame] | 223 | #define GR_ALWAYSBREAK SkNO_RETURN_HINT(); __debugbreak() |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 224 | #else |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 225 | // TODO: do other platforms really not have continuable breakpoints? |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 226 | // sign extend for 64bit architectures to be sure this is |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 227 | // in the high address range |
bsalomon@google.com | 0442380 | 2011-11-23 21:25:35 +0000 | [diff] [blame] | 228 | #define GR_ALWAYSBREAK SkNO_RETURN_HINT(); *((int*)(int64_t)(int32_t)0xbeefcafe) = 0; |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 229 | #endif |
| 230 | #endif |
| 231 | |
| 232 | /** |
| 233 | * GR_DEBUGBREAK is an unconditional break in debug builds. |
| 234 | */ |
| 235 | #if !defined(GR_DEBUGBREAK) |
| 236 | #if GR_DEBUG |
| 237 | #define GR_DEBUGBREAK GR_ALWAYSBREAK |
| 238 | #else |
| 239 | #define GR_DEBUGBREAK |
| 240 | #endif |
| 241 | #endif |
| 242 | |
| 243 | /** |
| 244 | * GR_ALWAYSASSERT is an assertion in all builds. |
| 245 | */ |
| 246 | #if !defined(GR_ALWAYSASSERT) |
| 247 | #define GR_ALWAYSASSERT(COND) \ |
| 248 | do { \ |
| 249 | if (!(COND)) { \ |
| 250 | GrPrintf("%s %s failed\n", GR_FILE_AND_LINE_STR, #COND); \ |
| 251 | GR_ALWAYSBREAK; \ |
| 252 | } \ |
| 253 | } while (false) |
| 254 | #endif |
| 255 | |
| 256 | /** |
| 257 | * GR_DEBUGASSERT is an assertion in debug builds only. |
| 258 | */ |
| 259 | #if !defined(GR_DEBUGASSERT) |
| 260 | #if GR_DEBUG |
| 261 | #define GR_DEBUGASSERT(COND) GR_ALWAYSASSERT(COND) |
| 262 | #else |
| 263 | #define GR_DEBUGASSERT(COND) |
| 264 | #endif |
| 265 | #endif |
| 266 | |
| 267 | /** |
| 268 | * Prettier forms of the above macros. |
| 269 | */ |
| 270 | #define GrAssert(COND) GR_DEBUGASSERT(COND) |
| 271 | #define GrAlwaysAssert(COND) GR_ALWAYSASSERT(COND) |
| 272 | |
| 273 | /** |
bsalomon@google.com | 6f7fbc9 | 2011-02-01 19:12:40 +0000 | [diff] [blame] | 274 | * Crash from unrecoverable condition, optionally with a message. |
| 275 | */ |
| 276 | inline void GrCrash() { GrAlwaysAssert(false); } |
| 277 | inline void GrCrash(const char* msg) { GrPrintf(msg); GrAlwaysAssert(false); } |
| 278 | |
| 279 | /** |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 280 | * GR_DEBUGCODE compiles the code X in debug builds only |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 281 | */ |
| 282 | #if !defined(GR_DEBUGCODE) |
| 283 | #if GR_DEBUG |
| 284 | #define GR_DEBUGCODE(X) X |
| 285 | #else |
| 286 | #define GR_DEBUGCODE(X) |
| 287 | #endif |
| 288 | #endif |
| 289 | |
| 290 | /** |
| 291 | * GR_STATIC_ASSERT is a compile time assertion. Depending on the platform |
| 292 | * it may print the message in the compiler log. Obviously, the condition must |
| 293 | * be evaluatable at compile time. |
| 294 | */ |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 295 | // VS 2010 and GCC compiled with c++0x or gnu++0x support the new |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 296 | // static_assert. |
| 297 | #if !defined(GR_STATIC_ASSERT) |
reed@google.com | c921843 | 2011-01-25 19:05:12 +0000 | [diff] [blame] | 298 | #if (defined(_MSC_VER) && _MSC_VER >= 1600) || (defined(__GXX_EXPERIMENTAL_CXX0X__) && __GXX_EXPERIMENTAL_CXX0X__) |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 299 | #define GR_STATIC_ASSERT(CONDITION) static_assert(CONDITION, "bug") |
| 300 | #else |
| 301 | template <bool> class GR_STATIC_ASSERT_FAILURE; |
| 302 | template <> class GR_STATIC_ASSERT_FAILURE<true> {}; |
| 303 | #define GR_STATIC_ASSERT(CONDITION) \ |
| 304 | enum {GR_CONCAT(X,__LINE__) = \ |
| 305 | sizeof(GR_STATIC_ASSERT_FAILURE<CONDITION>)} |
| 306 | #endif |
| 307 | #endif |
| 308 | |
| 309 | #if !defined(GR_SCALAR_IS_FLOAT) |
| 310 | #define GR_SCALAR_IS_FLOAT 0 |
| 311 | #endif |
| 312 | #if !defined(GR_SCALAR_IS_FIXED) |
| 313 | #define GR_SCALAR_IS_FIXED 0 |
| 314 | #endif |
| 315 | |
| 316 | #if !defined(GR_TEXT_SCALAR_TYPE_IS_USHORT) |
| 317 | #define GR_TEXT_SCALAR_TYPE_IS_USHORT 0 |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 318 | #endif |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 319 | #if !defined(GR_TEXT_SCALAR_TYPE_IS_FLOAT) |
| 320 | #define GR_TEXT_SCALAR_TYPE_IS_FLOAT 0 |
| 321 | #endif |
| 322 | #if !defined(GR_TEXT_SCALAR_TYPE_IS_FIXED) |
| 323 | #define GR_TEXT_SCALAR_TYPE_IS_FIXED 0 |
| 324 | #endif |
| 325 | |
| 326 | #ifndef GR_DUMP_TEXTURE_UPLOAD |
| 327 | #define GR_DUMP_TEXTURE_UPLOAD 0 |
| 328 | #endif |
| 329 | |
| 330 | /** |
bsalomon@google.com | d16983b | 2011-02-02 22:42:20 +0000 | [diff] [blame] | 331 | * GR_STATIC_RECT_VB controls whether rects are drawn by issuing a vertex |
| 332 | * for each corner or using a static vb that is positioned by modifying the |
| 333 | * view / texture matrix. |
| 334 | */ |
bsalomon@google.com | 4333323 | 2011-02-02 19:24:54 +0000 | [diff] [blame] | 335 | #if !defined(GR_STATIC_RECT_VB) |
| 336 | #define GR_STATIC_RECT_VB 0 |
| 337 | #endif |
| 338 | |
bsalomon@google.com | d16983b | 2011-02-02 22:42:20 +0000 | [diff] [blame] | 339 | /** |
bsalomon@google.com | 1d4edd3 | 2012-08-16 18:36:06 +0000 | [diff] [blame] | 340 | * GR_DISABLE_DRAW_BUFFERING prevents GrContext from queueing draws in a |
| 341 | * GrInOrderDrawBuffer. |
| 342 | */ |
| 343 | #if !defined(GR_DISABLE_DRAW_BUFFERING) |
| 344 | #define GR_DISABLE_DRAW_BUFFERING 0 |
| 345 | #endif |
| 346 | |
| 347 | /** |
bsalomon@google.com | d16983b | 2011-02-02 22:42:20 +0000 | [diff] [blame] | 348 | * GR_AGGRESSIVE_SHADER_OPTS controls how aggressively shaders are optimized |
| 349 | * for special cases. On systems where program changes are expensive this |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 350 | * may not be advantageous. Consecutive draws may no longer use the same |
bsalomon@google.com | d16983b | 2011-02-02 22:42:20 +0000 | [diff] [blame] | 351 | * program. |
| 352 | */ |
| 353 | #if !defined(GR_AGGRESSIVE_SHADER_OPTS) |
senorblanco@chromium.org | 60014ca | 2011-11-09 16:05:58 +0000 | [diff] [blame] | 354 | #define GR_AGGRESSIVE_SHADER_OPTS 1 |
bsalomon@google.com | d16983b | 2011-02-02 22:42:20 +0000 | [diff] [blame] | 355 | #endif |
| 356 | |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 357 | /** |
| 358 | * GR_GEOM_BUFFER_LOCK_THRESHOLD gives a threshold (in bytes) for when Gr should |
bsalomon@google.com | 96e96df | 2011-10-10 14:49:29 +0000 | [diff] [blame] | 359 | * lock a GrGeometryBuffer to update its contents. It will use lock() if the |
| 360 | * size of the updated region is greater than the threshold. Otherwise it will |
| 361 | * use updateData(). |
bsalomon@google.com | 1c13c96 | 2011-02-14 16:51:21 +0000 | [diff] [blame] | 362 | */ |
| 363 | #if !defined(GR_GEOM_BUFFER_LOCK_THRESHOLD) |
| 364 | #define GR_GEOM_BUFFER_LOCK_THRESHOLD (1 << 15) |
| 365 | #endif |
| 366 | |
reed@google.com | ac10a2d | 2010-12-22 21:39:39 +0000 | [diff] [blame] | 367 | /////////////////////////////////////////////////////////////////////////////// |
| 368 | // tail section: |
| 369 | // |
| 370 | // Now we just assert if we are missing some required define, or if we detect |
| 371 | // and inconsistent combination of defines |
| 372 | // |
| 373 | |
| 374 | |
| 375 | /** |
| 376 | * Only one build target macro should be 1 and the rest should be 0. |
| 377 | */ |
| 378 | #define GR_BUILD_SUM (GR_WIN32_BUILD + GR_MAC_BUILD + GR_IOS_BUILD + GR_ANDROID_BUILD + GR_LINUX_BUILD + GR_QNX_BUILD) |
| 379 | #if 0 == GR_BUILD_SUM |
| 380 | #error "Missing a GR_BUILD define" |
| 381 | #elif 1 != GR_BUILD_SUM |
| 382 | #error "More than one GR_BUILD defined" |
| 383 | #endif |
| 384 | |
| 385 | |
| 386 | #if !GR_SCALAR_IS_FLOAT && !GR_SCALAR_IS_FIXED |
| 387 | #undef GR_SCALAR_IS_FLOAT |
| 388 | #define GR_SCALAR_IS_FLOAT 1 |
| 389 | #pragma message GR_WARN("Scalar type not defined, defaulting to float") |
| 390 | #endif |
| 391 | |
| 392 | #if !GR_TEXT_SCALAR_IS_FLOAT && \ |
| 393 | !GR_TEXT_SCALAR_IS_FIXED && \ |
| 394 | !GR_TEXT_SCALAR_IS_USHORT |
| 395 | #undef GR_TEXT_SCALAR_IS_FLOAT |
| 396 | #define GR_TEXT_SCALAR_IS_FLOAT 1 |
| 397 | #pragma message GR_WARN("Text scalar type not defined, defaulting to float") |
| 398 | #endif |
| 399 | |
| 400 | #if 0 |
| 401 | #if GR_WIN32_BUILD |
| 402 | // #pragma message GR_WARN("GR_WIN32_BUILD") |
| 403 | #endif |
| 404 | #if GR_MAC_BUILD |
| 405 | // #pragma message GR_WARN("GR_MAC_BUILD") |
| 406 | #endif |
| 407 | #if GR_IOS_BUILD |
| 408 | // #pragma message GR_WARN("GR_IOS_BUILD") |
| 409 | #endif |
| 410 | #if GR_ANDROID_BUILD |
| 411 | // #pragma message GR_WARN("GR_ANDROID_BUILD") |
| 412 | #endif |
| 413 | #if GR_LINUX_BUILD |
| 414 | // #pragma message GR_WARN("GR_LINUX_BUILD") |
| 415 | #endif |
| 416 | #if GR_QNX_BUILD |
| 417 | // #pragma message GR_WARN("GR_QNX_BUILD") |
| 418 | #endif |
| 419 | #endif |
| 420 | |
| 421 | #endif |
| 422 | |