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 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 GrGLVendor vendor() const { return fVendor; } | 51 GrGLVendor vendor() const { return fVendor; } |
52 GrGLRenderer renderer() const { return fRenderer; } | 52 GrGLRenderer renderer() const { return fRenderer; } |
53 /** Is this a mesa-based driver. Does not mean it is the osmesa software ras
terizer. */ | 53 /** Is this a mesa-based driver. Does not mean it is the osmesa software ras
terizer. */ |
54 bool isMesa() const { return fIsMesa; } | 54 bool isMesa() const { return fIsMesa; } |
55 /** Are we running inside Chromium (using the command buffer)? We make some
different tradeoffs | 55 /** Are we running inside Chromium (using the command buffer)? We make some
different tradeoffs |
56 about what errors to check for because queries are synchronous. We shoul
d probably expose | 56 about what errors to check for because queries are synchronous. We shoul
d probably expose |
57 this as an option for clients other than Chromium. */ | 57 this as an option for clients other than Chromium. */ |
58 bool isChromium() const { return fIsChromium; } | 58 bool isChromium() const { return fIsChromium; } |
59 const GrGLCaps* caps() const { return fGLCaps.get(); } | 59 const GrGLCaps* caps() const { return fGLCaps.get(); } |
60 GrGLCaps* caps() { return fGLCaps; } | 60 GrGLCaps* caps() { return fGLCaps; } |
61 const GrGLExtensions& extensions() const { return fExtensions; } | |
62 | |
63 /** | |
64 * Shortcut for extensions().has(ext) | |
65 */ | |
66 bool hasExtension(const char* ext) const { | 61 bool hasExtension(const char* ext) const { |
67 if (!this->isInitialized()) { | 62 if (!this->isInitialized()) { |
68 return false; | 63 return false; |
69 } | 64 } |
70 return fExtensions.has(ext); | 65 return fInterface->hasExtension(ext); |
71 } | 66 } |
72 | 67 |
73 /** | 68 /** |
74 * Reset the information | 69 * Reset the information |
75 */ | 70 */ |
76 void reset(); | 71 void reset(); |
77 | 72 |
78 protected: | 73 protected: |
79 SkAutoTUnref<const GrGLInterface> fInterface; | 74 SkAutoTUnref<const GrGLInterface> fInterface; |
80 GrGLVersion fGLVersion; | 75 GrGLVersion fGLVersion; |
81 GrGLSLGeneration fGLSLGeneration; | 76 GrGLSLGeneration fGLSLGeneration; |
82 GrGLVendor fVendor; | 77 GrGLVendor fVendor; |
83 GrGLRenderer fRenderer; | 78 GrGLRenderer fRenderer; |
84 GrGLExtensions fExtensions; | |
85 bool fIsMesa; | 79 bool fIsMesa; |
86 bool fIsChromium; | 80 bool fIsChromium; |
87 SkAutoTUnref<GrGLCaps> fGLCaps; | 81 SkAutoTUnref<GrGLCaps> fGLCaps; |
88 }; | 82 }; |
89 | 83 |
90 /** | 84 /** |
91 * Extension of GrGLContextInfo that also provides access to GrGLInterface. | 85 * Extension of GrGLContextInfo that also provides access to GrGLInterface. |
92 */ | 86 */ |
93 class GrGLContext : public GrGLContextInfo { | 87 class GrGLContext : public GrGLContextInfo { |
94 public: | 88 public: |
(...skipping 12 matching lines...) Expand all Loading... |
107 return *this; | 101 return *this; |
108 } | 102 } |
109 | 103 |
110 const GrGLInterface* interface() const { return fInterface.get(); } | 104 const GrGLInterface* interface() const { return fInterface.get(); } |
111 | 105 |
112 private: | 106 private: |
113 typedef GrGLContextInfo INHERITED; | 107 typedef GrGLContextInfo INHERITED; |
114 }; | 108 }; |
115 | 109 |
116 #endif | 110 #endif |
OLD | NEW |