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 | 13 |
14 class SkMatrix; | 14 class SkMatrix; |
15 | 15 |
16 //////////////////////////////////////////////////////////////////////////////// | 16 //////////////////////////////////////////////////////////////////////////////// |
17 | 17 |
18 typedef uint32_t GrGLVersion; | 18 typedef uint32_t GrGLVersion; |
19 typedef uint32_t GrGLSLVersion; | 19 typedef uint32_t GrGLSLVersion; |
20 | 20 |
21 /** | 21 /** |
22 * This list is lazily updated as required. | 22 * The Vendor and Renderer enum values are lazily updated as required. |
23 */ | 23 */ |
24 enum GrGLVendor { | 24 enum GrGLVendor { |
25 kARM_GrGLVendor, | 25 kARM_GrGLVendor, |
26 kImagination_GrGLVendor, | 26 kImagination_GrGLVendor, |
27 kIntel_GrGLVendor, | 27 kIntel_GrGLVendor, |
28 kQualcomm_GrGLVendor, | 28 kQualcomm_GrGLVendor, |
29 | 29 |
30 kOther_GrGLVendor | 30 kOther_GrGLVendor |
31 }; | 31 }; |
32 | 32 |
| 33 enum GrGLRenderer { |
| 34 kTegra3_GrGLRenderer, |
| 35 |
| 36 kOther_GrGLRenderer |
| 37 }; |
| 38 |
33 #define GR_GL_VER(major, minor) ((static_cast<int>(major) << 16) | \ | 39 #define GR_GL_VER(major, minor) ((static_cast<int>(major) << 16) | \ |
34 static_cast<int>(minor)) | 40 static_cast<int>(minor)) |
35 #define GR_GLSL_VER(major, minor) ((static_cast<int>(major) << 16) | \ | 41 #define GR_GLSL_VER(major, minor) ((static_cast<int>(major) << 16) | \ |
36 static_cast<int>(minor)) | 42 static_cast<int>(minor)) |
37 | 43 |
38 //////////////////////////////////////////////////////////////////////////////// | 44 //////////////////////////////////////////////////////////////////////////////// |
39 | 45 |
40 /** | 46 /** |
41 * Some drivers want the var-int arg to be zero-initialized on input. | 47 * Some drivers want the var-int arg to be zero-initialized on input. |
42 */ | 48 */ |
(...skipping 26 matching lines...) Expand all Loading... |
69 /** | 75 /** |
70 * Helpers for glGetString() | 76 * Helpers for glGetString() |
71 */ | 77 */ |
72 | 78 |
73 // these variants assume caller already has a string from glGetString() | 79 // these variants assume caller already has a string from glGetString() |
74 GrGLVersion GrGLGetVersionFromString(const char* versionString); | 80 GrGLVersion GrGLGetVersionFromString(const char* versionString); |
75 GrGLBinding GrGLGetBindingInUseFromString(const char* versionString); | 81 GrGLBinding GrGLGetBindingInUseFromString(const char* versionString); |
76 GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString); | 82 GrGLSLVersion GrGLGetGLSLVersionFromString(const char* versionString); |
77 bool GrGLIsMesaFromVersionString(const char* versionString); | 83 bool GrGLIsMesaFromVersionString(const char* versionString); |
78 GrGLVendor GrGLGetVendorFromString(const char* vendorString); | 84 GrGLVendor GrGLGetVendorFromString(const char* vendorString); |
| 85 GrGLRenderer GrGLGetRendererFromString(const char* rendererString); |
79 | 86 |
80 // these variants call glGetString() | 87 // these variants call glGetString() |
81 GrGLBinding GrGLGetBindingInUse(const GrGLInterface*); | 88 GrGLBinding GrGLGetBindingInUse(const GrGLInterface*); |
82 GrGLVersion GrGLGetVersion(const GrGLInterface*); | 89 GrGLVersion GrGLGetVersion(const GrGLInterface*); |
83 GrGLSLVersion GrGLGetGLSLVersion(const GrGLInterface*); | 90 GrGLSLVersion GrGLGetGLSLVersion(const GrGLInterface*); |
84 GrGLVendor GrGLGetVendor(const GrGLInterface*); | 91 GrGLVendor GrGLGetVendor(const GrGLInterface*); |
| 92 GrGLRenderer GrGLGetRenderer(const GrGLInterface*); |
85 | 93 |
86 /** | 94 /** |
87 * Helpers for glGetError() | 95 * Helpers for glGetError() |
88 */ | 96 */ |
89 | 97 |
90 void GrGLCheckErr(const GrGLInterface* gl, | 98 void GrGLCheckErr(const GrGLInterface* gl, |
91 const char* location, | 99 const char* location, |
92 const char* call); | 100 const char* call); |
93 | 101 |
94 void GrGLClearErr(const GrGLInterface* gl); | 102 void GrGLClearErr(const GrGLInterface* gl); |
(...skipping 66 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
161 do { \ | 169 do { \ |
162 GR_GL_CALLBACK_IMPL(IFACE); \ | 170 GR_GL_CALLBACK_IMPL(IFACE); \ |
163 (RET) = (IFACE)->f##X; \ | 171 (RET) = (IFACE)->f##X; \ |
164 GR_GL_LOG_CALLS_IMPL(X); \ | 172 GR_GL_LOG_CALLS_IMPL(X); \ |
165 } while (false) | 173 } while (false) |
166 | 174 |
167 // call glGetError without doing a redundant error check or logging. | 175 // call glGetError without doing a redundant error check or logging. |
168 #define GR_GL_GET_ERROR(IFACE) (IFACE)->fGetError() | 176 #define GR_GL_GET_ERROR(IFACE) (IFACE)->fGetError() |
169 | 177 |
170 #endif | 178 #endif |
OLD | NEW |