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 #define GR_GL_VER(major, minor) ((static_cast<int>(major) << 16) | \ |
| 22 static_cast<int>(minor)) |
| 23 #define GR_GLSL_VER(major, minor) ((static_cast<int>(major) << 16) | \ |
| 24 static_cast<int>(minor)) |
| 25 |
| 26 #define GR_GL_INVALID_VER GR_GL_VER(0, 0) |
| 27 #define GR_GLSL_INVALID_VER GR_GL_VER(0, 0) |
| 28 |
21 /** | 29 /** |
22 * The Vendor and Renderer enum values are lazily updated as required. | 30 * The Vendor and Renderer enum values are lazily updated as required. |
23 */ | 31 */ |
24 enum GrGLVendor { | 32 enum GrGLVendor { |
25 kARM_GrGLVendor, | 33 kARM_GrGLVendor, |
26 kImagination_GrGLVendor, | 34 kImagination_GrGLVendor, |
27 kIntel_GrGLVendor, | 35 kIntel_GrGLVendor, |
28 kQualcomm_GrGLVendor, | 36 kQualcomm_GrGLVendor, |
29 | 37 |
30 kOther_GrGLVendor | 38 kOther_GrGLVendor |
31 }; | 39 }; |
32 | 40 |
33 enum GrGLRenderer { | 41 enum GrGLRenderer { |
34 kTegra2_GrGLRenderer, | 42 kTegra2_GrGLRenderer, |
35 kTegra3_GrGLRenderer, | 43 kTegra3_GrGLRenderer, |
36 | 44 |
37 kOther_GrGLRenderer | 45 kOther_GrGLRenderer |
38 }; | 46 }; |
39 | 47 |
40 #define GR_GL_VER(major, minor) ((static_cast<int>(major) << 16) | \ | |
41 static_cast<int>(minor)) | |
42 #define GR_GLSL_VER(major, minor) ((static_cast<int>(major) << 16) | \ | |
43 static_cast<int>(minor)) | |
44 | |
45 //////////////////////////////////////////////////////////////////////////////// | 48 //////////////////////////////////////////////////////////////////////////////// |
46 | 49 |
47 /** | 50 /** |
48 * Some drivers want the var-int arg to be zero-initialized on input. | 51 * Some drivers want the var-int arg to be zero-initialized on input. |
49 */ | 52 */ |
50 #define GR_GL_INIT_ZERO 0 | 53 #define GR_GL_INIT_ZERO 0 |
51 #define GR_GL_GetIntegerv(gl, e, p) \ | 54 #define GR_GL_GetIntegerv(gl, e, p) \ |
52 do { \ | 55 do { \ |
53 *(p) = GR_GL_INIT_ZERO; \ | 56 *(p) = GR_GL_INIT_ZERO; \ |
54 GR_GL_CALL(gl, GetIntegerv(e, p)); \ | 57 GR_GL_CALL(gl, GetIntegerv(e, p)); \ |
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
171 do { \ | 174 do { \ |
172 GR_GL_CALLBACK_IMPL(IFACE); \ | 175 GR_GL_CALLBACK_IMPL(IFACE); \ |
173 (RET) = (IFACE)->fFunctions.f##X; \ | 176 (RET) = (IFACE)->fFunctions.f##X; \ |
174 GR_GL_LOG_CALLS_IMPL(X); \ | 177 GR_GL_LOG_CALLS_IMPL(X); \ |
175 } while (false) | 178 } while (false) |
176 | 179 |
177 // call glGetError without doing a redundant error check or logging. | 180 // call glGetError without doing a redundant error check or logging. |
178 #define GR_GL_GET_ERROR(IFACE) (IFACE)->fFunctions.fGetError() | 181 #define GR_GL_GET_ERROR(IFACE) (IFACE)->fFunctions.fGetError() |
179 | 182 |
180 #endif | 183 #endif |
OLD | NEW |