| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2012 Google Inc. | 2 * Copyright 2012 Google Inc. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license that can be | 4 * Use of this source code is governed by a BSD-style license that can be |
| 5 * found in the LICENSE file. | 5 * found in the LICENSE file. |
| 6 */ | 6 */ |
| 7 | 7 |
| 8 #ifndef GrGLUtil_DEFINED | 8 #ifndef GrGLUtil_DEFINED |
| 9 #define GrGLUtil_DEFINED | 9 #define GrGLUtil_DEFINED |
| 10 | 10 |
| 11 #include "gl/GrGLInterface.h" | 11 #include "gl/GrGLInterface.h" |
| 12 #include "GrGLDefines.h" | 12 #include "GrGLDefines.h" |
| 13 #include "GrStencil.h" | 13 #include "GrStencil.h" |
| 14 | 14 |
| 15 class SkMatrix; | 15 class SkMatrix; |
| 16 | 16 |
| 17 //////////////////////////////////////////////////////////////////////////////// | 17 //////////////////////////////////////////////////////////////////////////////// |
| 18 | 18 |
| 19 typedef uint32_t GrGLVersion; | 19 typedef uint32_t GrGLVersion; |
| 20 typedef uint32_t GrGLSLVersion; | 20 typedef uint32_t GrGLSLVersion; |
| 21 typedef uint32_t GrGLDriverVersion; |
| 21 | 22 |
| 22 #define GR_GL_VER(major, minor) ((static_cast<int>(major) << 16) | \ | 23 #define GR_GL_VER(major, minor) ((static_cast<int>(major) << 16) | \ |
| 23 static_cast<int>(minor)) | 24 static_cast<int>(minor)) |
| 24 #define GR_GLSL_VER(major, minor) ((static_cast<int>(major) << 16) | \ | 25 #define GR_GLSL_VER(major, minor) ((static_cast<int>(major) << 16) | \ |
| 25 static_cast<int>(minor)) | 26 static_cast<int>(minor)) |
| 27 #define GR_GL_DRIVER_VER(major, minor) ((static_cast<int>(major) << 16) | \ |
| 28 static_cast<int>(minor)) |
| 26 | 29 |
| 27 #define GR_GL_INVALID_VER GR_GL_VER(0, 0) | 30 #define GR_GL_INVALID_VER GR_GL_VER(0, 0) |
| 28 #define GR_GLSL_INVALID_VER GR_GL_VER(0, 0) | 31 #define GR_GLSL_INVALID_VER GR_GLSL_VER(0, 0) |
| 32 #define GR_GL_DRIVER_UNKNOWN_VER GR_GL_DRIVER_VER(0, 0) |
| 29 | 33 |
| 30 /** | 34 /** |
| 31 * The Vendor and Renderer enum values are lazily updated as required. | 35 * The Vendor and Renderer enum values are lazily updated as required. |
| 32 */ | 36 */ |
| 33 enum GrGLVendor { | 37 enum GrGLVendor { |
| 34 kARM_GrGLVendor, | 38 kARM_GrGLVendor, |
| 35 kImagination_GrGLVendor, | 39 kImagination_GrGLVendor, |
| 36 kIntel_GrGLVendor, | 40 kIntel_GrGLVendor, |
| 37 kQualcomm_GrGLVendor, | 41 kQualcomm_GrGLVendor, |
| 38 kNVIDIA_GrGLVendor, | 42 kNVIDIA_GrGLVendor, |
| 39 | 43 |
| 40 kOther_GrGLVendor | 44 kOther_GrGLVendor |
| 41 }; | 45 }; |
| 42 | 46 |
| 43 enum GrGLRenderer { | 47 enum GrGLRenderer { |
| 44 kTegra2_GrGLRenderer, | 48 kTegra2_GrGLRenderer, |
| 45 kTegra3_GrGLRenderer, | 49 kTegra3_GrGLRenderer, |
| 46 kPowerVR54x_GrGLRenderer, | 50 kPowerVR54x_GrGLRenderer, |
| 47 kPowerVRRogue_GrGLRenderer, | 51 kPowerVRRogue_GrGLRenderer, |
| 48 kAdreno3xx_GrGLRenderer, | 52 kAdreno3xx_GrGLRenderer, |
| 49 kAdreno4xx_GrGLRenderer, | 53 kAdreno4xx_GrGLRenderer, |
| 50 kOther_GrGLRenderer | 54 kOther_GrGLRenderer |
| 51 }; | 55 }; |
| 52 | 56 |
| 57 enum GrGLDriver { |
| 58 kMesa_GrGLDriver, |
| 59 kChromium_GrGLDriver, |
| 60 kNVIDIA_GrGLDriver, |
| 61 kUnknown_GrGLDriver |
| 62 }; |
| 63 |
| 53 //////////////////////////////////////////////////////////////////////////////// | 64 //////////////////////////////////////////////////////////////////////////////// |
| 54 | 65 |
| 55 /** | 66 /** |
| 56 * Some drivers want the var-int arg to be zero-initialized on input. | 67 * Some drivers want the var-int arg to be zero-initialized on input. |
| 57 */ | 68 */ |
| 58 #define GR_GL_INIT_ZERO 0 | 69 #define GR_GL_INIT_ZERO 0 |
| 59 #define GR_GL_GetIntegerv(gl, e, p) \ | 70 #define GR_GL_GetIntegerv(gl, e, p) \ |
| 60 do { \ | 71 do { \ |
| 61 *(p) = GR_GL_INIT_ZERO; \ | 72 *(p) = GR_GL_INIT_ZERO; \ |
| 62 GR_GL_CALL(gl, GetIntegerv(e, p)); \ | 73 GR_GL_CALL(gl, GetIntegerv(e, p)); \ |
| (...skipping 28 matching lines...) Expand all Loading... |
| 91 //////////////////////////////////////////////////////////////////////////////// | 102 //////////////////////////////////////////////////////////////////////////////// |
| 92 | 103 |
| 93 /** | 104 /** |
| 94 * Helpers for glGetString() | 105 * Helpers for glGetString() |
| 95 */ | 106 */ |
| 96 | 107 |
| 97 // these variants assume caller already has a string from glGetString() | 108 // these variants assume caller already has a string from glGetString() |
| 98 GrGLVersion GrGLGetVersionFromString(const char* versionString); | 109 GrGLVersion GrGLGetVersionFromString(const char* versionString); |
| 99 GrGLStandard GrGLGetStandardInUseFromString(const char* versionString); | 110 GrGLStandard GrGLGetStandardInUseFromString(const char* versionString); |
| 100 GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString); | 111 GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString); |
| 101 bool GrGLIsMesaFromVersionString(const char* versionString); | |
| 102 GrGLVendor GrGLGetVendorFromString(const char* vendorString); | 112 GrGLVendor GrGLGetVendorFromString(const char* vendorString); |
| 103 GrGLRenderer GrGLGetRendererFromString(const char* rendererString); | 113 GrGLRenderer GrGLGetRendererFromString(const char* rendererString); |
| 104 bool GrGLIsChromiumFromRendererString(const char* rendererString); | 114 |
| 115 void GrGLGetDriverInfo(GrGLStandard standard, |
| 116 GrGLVendor vendor, |
| 117 const char* rendererString, |
| 118 const char* versionString, |
| 119 GrGLDriver* outDriver, |
| 120 GrGLDriverVersion* outVersion); |
| 105 | 121 |
| 106 // these variants call glGetString() | 122 // these variants call glGetString() |
| 107 GrGLVersion GrGLGetVersion(const GrGLInterface*); | 123 GrGLVersion GrGLGetVersion(const GrGLInterface*); |
| 108 GrGLSLVersion GrGLGetGLSLVersion(const GrGLInterface*); | 124 GrGLSLVersion GrGLGetGLSLVersion(const GrGLInterface*); |
| 109 GrGLVendor GrGLGetVendor(const GrGLInterface*); | 125 GrGLVendor GrGLGetVendor(const GrGLInterface*); |
| 110 GrGLRenderer GrGLGetRenderer(const GrGLInterface*); | 126 GrGLRenderer GrGLGetRenderer(const GrGLInterface*); |
| 111 | 127 |
| 112 | 128 |
| 113 /** | 129 /** |
| 114 * Helpers for glGetError() | 130 * Helpers for glGetError() |
| (...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 191 GR_GL_LOG_CALLS_IMPL(X); \ | 207 GR_GL_LOG_CALLS_IMPL(X); \ |
| 192 } while (false) | 208 } while (false) |
| 193 | 209 |
| 194 // call glGetError without doing a redundant error check or logging. | 210 // call glGetError without doing a redundant error check or logging. |
| 195 #define GR_GL_GET_ERROR(IFACE) (IFACE)->fFunctions.fGetError() | 211 #define GR_GL_GET_ERROR(IFACE) (IFACE)->fFunctions.fGetError() |
| 196 | 212 |
| 197 GrGLenum GrToGLStencilFunc(GrStencilFunc basicFunc); | 213 GrGLenum GrToGLStencilFunc(GrStencilFunc basicFunc); |
| 198 | 214 |
| 199 | 215 |
| 200 #endif | 216 #endif |
| OLD | NEW |