OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2013 Google Inc. | 2 * Copyright 2013 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 | 8 |
9 #ifndef GrGLContext_DEFINED | 9 #ifndef GrGLContext_DEFINED |
10 #define GrGLContext_DEFINED | 10 #define GrGLContext_DEFINED |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 bool initialize(const GrGLInterface* interface); | 43 bool initialize(const GrGLInterface* interface); |
44 bool isInitialized() const; | 44 bool isInitialized() const; |
45 | 45 |
46 GrGLBinding binding() const { return fBindingInUse; } | 46 GrGLBinding binding() const { return fBindingInUse; } |
47 GrGLVersion version() const { return fGLVersion; } | 47 GrGLVersion version() const { return fGLVersion; } |
48 GrGLSLGeneration glslGeneration() const { return fGLSLGeneration; } | 48 GrGLSLGeneration glslGeneration() const { return fGLSLGeneration; } |
49 GrGLVendor vendor() const { return fVendor; } | 49 GrGLVendor vendor() const { return fVendor; } |
50 GrGLRenderer renderer() const { return fRenderer; } | 50 GrGLRenderer renderer() const { return fRenderer; } |
51 /** Is this a mesa-based driver. Does not mean it is the osmesa software ras
terizer. */ | 51 /** Is this a mesa-based driver. Does not mean it is the osmesa software ras
terizer. */ |
52 bool isMesa() const { return fIsMesa; } | 52 bool isMesa() const { return fIsMesa; } |
| 53 /** Are we running inside Chromium (using the command buffer)? We make some
different tradeoffs |
| 54 about what errors to check for because queries are synchronous. We shoul
d probably expose |
| 55 this as an option for clients other than Chromium. */ |
| 56 bool isChromium() const { return fIsChromium; } |
53 const GrGLCaps* caps() const { return fGLCaps.get(); } | 57 const GrGLCaps* caps() const { return fGLCaps.get(); } |
54 GrGLCaps* caps() { return fGLCaps; } | 58 GrGLCaps* caps() { return fGLCaps; } |
55 const GrGLExtensions& extensions() const { return fExtensions; } | 59 const GrGLExtensions& extensions() const { return fExtensions; } |
56 | 60 |
57 /** | 61 /** |
58 * Shortcut for extensions().has(ext); | 62 * Shortcut for extensions().has(ext); |
59 */ | 63 */ |
60 bool hasExtension(const char* ext) const { | 64 bool hasExtension(const char* ext) const { |
61 if (!this->isInitialized()) { | 65 if (!this->isInitialized()) { |
62 return false; | 66 return false; |
63 } | 67 } |
64 return fExtensions.has(ext); | 68 return fExtensions.has(ext); |
65 } | 69 } |
66 | 70 |
67 /** | 71 /** |
68 * Reset the information | 72 * Reset the information |
69 */ | 73 */ |
70 void reset(); | 74 void reset(); |
71 | 75 |
72 private: | 76 private: |
73 | 77 |
74 GrGLBinding fBindingInUse; | 78 GrGLBinding fBindingInUse; |
75 GrGLVersion fGLVersion; | 79 GrGLVersion fGLVersion; |
76 GrGLSLGeneration fGLSLGeneration; | 80 GrGLSLGeneration fGLSLGeneration; |
77 GrGLVendor fVendor; | 81 GrGLVendor fVendor; |
78 GrGLRenderer fRenderer; | 82 GrGLRenderer fRenderer; |
79 GrGLExtensions fExtensions; | 83 GrGLExtensions fExtensions; |
80 bool fIsMesa; | 84 bool fIsMesa; |
| 85 bool fIsChromium; |
81 SkAutoTUnref<GrGLCaps> fGLCaps; | 86 SkAutoTUnref<GrGLCaps> fGLCaps; |
82 }; | 87 }; |
83 | 88 |
84 /** | 89 /** |
85 * Encapsulates the GrGLInterface used to make GL calls plus information | 90 * Encapsulates the GrGLInterface used to make GL calls plus information |
86 * about the context (via GrGLContextInfo). | 91 * about the context (via GrGLContextInfo). |
87 */ | 92 */ |
88 class GrGLContext { | 93 class GrGLContext { |
89 public: | 94 public: |
90 /** | 95 /** |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 GrGLContextInfo& info() { return fInfo; } | 127 GrGLContextInfo& info() { return fInfo; } |
123 | 128 |
124 private: | 129 private: |
125 void reset(); | 130 void reset(); |
126 | 131 |
127 const GrGLInterface* fInterface; | 132 const GrGLInterface* fInterface; |
128 GrGLContextInfo fInfo; | 133 GrGLContextInfo fInfo; |
129 }; | 134 }; |
130 | 135 |
131 #endif | 136 #endif |
OLD | NEW |