| 1 | |
| 2 | /* |
| 3 | * Copyright 2011 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. |
| 7 | */ |
| 8 | |
| 9 | |
| 10 | |
| 11 | #ifndef GrGLConfig_DEFINED |
| 12 | #define GrGLConfig_DEFINED |
| 13 | |
| 14 | #include "include/gpu/GrTypes.h" |
| 15 | |
| 16 | /** |
| 17 | * Optional GL config file. |
| 18 | */ |
| 19 | #ifdef GR_GL_CUSTOM_SETUP_HEADER |
| 20 | #include GR_GL_CUSTOM_SETUP_HEADER |
| 21 | #endif |
| 22 | |
| 23 | #if !defined(GR_GL_FUNCTION_TYPE) |
| 24 | #if defined(SK_BUILD_FOR_WIN) |
| 25 | #define GR_GL_FUNCTION_TYPE __stdcall |
| 26 | #else |
| 27 | #define GR_GL_FUNCTION_TYPE |
| 28 | #endif |
| 29 | #endif |
| 30 | |
| 31 | /** |
| 32 | * The following are optional defines that can be enabled at the compiler |
| 33 | * command line, in a IDE project, in a GrUserConfig.h file, or in a GL custom |
| 34 | * file (if one is in use). If a GR_GL_CUSTOM_SETUP_HEADER is used they can |
| 35 | * also be placed there. |
| 36 | * |
| 37 | * GR_GL_LOG_CALLS: if 1 Gr can print every GL call using SkDebugf. Defaults to |
| 38 | * 0. Logging can be enabled and disabled at runtime using a debugger via to |
| 39 | * global gLogCallsGL. The initial value of gLogCallsGL is controlled by |
| 40 | * GR_GL_LOG_CALLS_START. |
| 41 | * |
| 42 | * GR_GL_LOG_CALLS_START: controls the initial value of gLogCallsGL when |
| 43 | * GR_GL_LOG_CALLS is 1. Defaults to 0. |
| 44 | * |
| 45 | * GR_GL_CHECK_ERROR: if enabled Gr can do a glGetError() after every GL call. |
| 46 | * Defaults to 1 if SK_DEBUG is set, otherwise 0. When GR_GL_CHECK_ERROR is 1 |
| 47 | * this can be toggled in a debugger using the gCheckErrorGL global. The initial |
| 48 | * value of gCheckErrorGL is controlled by by GR_GL_CHECK_ERROR_START. |
| 49 | * |
| 50 | * GR_GL_CHECK_ERROR_START: controls the initial value of gCheckErrorGL |
| 51 | * when GR_GL_CHECK_ERROR is 1. Defaults to 1. |
| 52 | * |
| 53 | * GR_GL_CHECK_ALLOC_WITH_GET_ERROR: If set to 1 this will then glTexImage, |
| 54 | * glBufferData, glRenderbufferStorage, etc will be checked for errors. This |
| 55 | * amounts to ensuring the error is GL_NO_ERROR, calling the allocating |
| 56 | * function, and then checking that the error is still GL_NO_ERROR. When the |
| 57 | * value is 0 we will assume no error was generated without checking. |
| 58 | */ |
| 59 | |
| 60 | #if !defined(GR_GL_LOG_CALLS) |
| 61 | #ifdef SK_DEBUG |
| 62 | #define GR_GL_LOG_CALLS 1 |
| 63 | #else |
| 64 | #define GR_GL_LOG_CALLS 0 |
| 65 | #endif |
| 66 | #endif |
| 67 | |
| 68 | #if !defined(GR_GL_LOG_CALLS_START) |
| 69 | #define GR_GL_LOG_CALLS_START 0 |
| 70 | #endif |
| 71 | |
| 72 | #if !defined(GR_GL_CHECK_ERROR) |
| 73 | #ifdef SK_DEBUG |
| 74 | #define GR_GL_CHECK_ERROR 1 |
| 75 | #else |
| 76 | #define GR_GL_CHECK_ERROR 0 |
| 77 | #endif |
| 78 | #endif |
| 79 | |
| 80 | #if !defined(GR_GL_CHECK_ERROR_START) |
| 81 | #define GR_GL_CHECK_ERROR_START 1 |
| 82 | #endif |
| 83 | |
| 84 | #if !defined(GR_GL_CHECK_ALLOC_WITH_GET_ERROR) |
| 85 | #define GR_GL_CHECK_ALLOC_WITH_GET_ERROR 1 |
| 86 | #endif |
| 87 | |
| 88 | #endif |
| 89 | |