| 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 |
| 11 | 11 |
| 12 #include "gl/GrGLExtensions.h" | 12 #include "gl/GrGLExtensions.h" |
| 13 #include "gl/GrGLInterface.h" | 13 #include "gl/GrGLInterface.h" |
| 14 #include "GrGLCaps.h" | 14 #include "GrGLCaps.h" |
| 15 #include "GrGLSL.h" | 15 #include "GrGLSL.h" |
| 16 #include "GrGLUtil.h" | 16 #include "GrGLUtil.h" |
| 17 | 17 |
| 18 #include "SkString.h" | 18 #include "SkString.h" |
| 19 | 19 |
| 20 /** | 20 /** |
| 21 * Encapsulates information about an OpenGL context including the OpenGL | 21 * Encapsulates information about an OpenGL context including the OpenGL |
| 22 * version, the GrGLBinding type of the context, and GLSL version. | 22 * version, the GrGLStandard type of the context, and GLSL version. |
| 23 */ | 23 */ |
| 24 class GrGLContextInfo { | 24 class GrGLContextInfo { |
| 25 public: | 25 public: |
| 26 /** | 26 /** |
| 27 * Default constructor | 27 * Default constructor |
| 28 */ | 28 */ |
| 29 GrGLContextInfo() { | 29 GrGLContextInfo() { |
| 30 fGLCaps.reset(SkNEW(GrGLCaps)); | 30 fGLCaps.reset(SkNEW(GrGLCaps)); |
| 31 this->reset(); | 31 this->reset(); |
| 32 } | 32 } |
| 33 | 33 |
| 34 /** | 34 /** |
| 35 * Copies a GrGLContextInfo | 35 * Copies a GrGLContextInfo |
| 36 */ | 36 */ |
| 37 GrGLContextInfo& operator= (const GrGLContextInfo& ctxInfo); | 37 GrGLContextInfo& operator= (const GrGLContextInfo& ctxInfo); |
| 38 | 38 |
| 39 /** | 39 /** |
| 40 * Initializes a GrGLContextInfo from a GrGLInterface and the currently | 40 * Initializes a GrGLContextInfo from a GrGLInterface and the currently |
| 41 * bound OpenGL context accessible by the GrGLInterface. | 41 * bound OpenGL context accessible by the GrGLInterface. |
| 42 */ | 42 */ |
| 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 GrGLStandard standard() const { return fStandard; } |
| 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 | 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 | 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. */ | 55 this as an option for clients other than Chromium. */ |
| 56 bool isChromium() const { return fIsChromium; } | 56 bool isChromium() const { return fIsChromium; } |
| (...skipping 11 matching lines...) Expand all Loading... |
| 68 return fExtensions.has(ext); | 68 return fExtensions.has(ext); |
| 69 } | 69 } |
| 70 | 70 |
| 71 /** | 71 /** |
| 72 * Reset the information | 72 * Reset the information |
| 73 */ | 73 */ |
| 74 void reset(); | 74 void reset(); |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 | 77 |
| 78 GrGLBinding fBindingInUse; | 78 GrGLStandard fStandard; |
| 79 GrGLVersion fGLVersion; | 79 GrGLVersion fGLVersion; |
| 80 GrGLSLGeneration fGLSLGeneration; | 80 GrGLSLGeneration fGLSLGeneration; |
| 81 GrGLVendor fVendor; | 81 GrGLVendor fVendor; |
| 82 GrGLRenderer fRenderer; | 82 GrGLRenderer fRenderer; |
| 83 GrGLExtensions fExtensions; | 83 GrGLExtensions fExtensions; |
| 84 bool fIsMesa; | 84 bool fIsMesa; |
| 85 bool fIsChromium; | 85 bool fIsChromium; |
| 86 SkAutoTUnref<GrGLCaps> fGLCaps; | 86 SkAutoTUnref<GrGLCaps> fGLCaps; |
| 87 }; | 87 }; |
| 88 | 88 |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 127 GrGLContextInfo& info() { return fInfo; } | 127 GrGLContextInfo& info() { return fInfo; } |
| 128 | 128 |
| 129 private: | 129 private: |
| 130 void reset(); | 130 void reset(); |
| 131 | 131 |
| 132 const GrGLInterface* fInterface; | 132 const GrGLInterface* fInterface; |
| 133 GrGLContextInfo fInfo; | 133 GrGLContextInfo fInfo; |
| 134 }; | 134 }; |
| 135 | 135 |
| 136 #endif | 136 #endif |
| OLD | NEW |