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 10 matching lines...) Expand all Loading... |
21 * Encapsulates information about an OpenGL context including the OpenGL | 21 * Encapsulates information about an OpenGL context including the OpenGL |
22 * version, the GrGLStandard type of the context, and GLSL version. | 22 * version, the GrGLStandard type of the context, and GLSL version. |
23 */ | 23 */ |
24 class GrGLContextInfo : public SkNoncopyable { | 24 class GrGLContextInfo : public SkNoncopyable { |
25 public: | 25 public: |
26 GrGLStandard standard() const { return fInterface->fStandard; } | 26 GrGLStandard standard() const { return fInterface->fStandard; } |
27 GrGLVersion version() const { return fGLVersion; } | 27 GrGLVersion version() const { return fGLVersion; } |
28 GrGLSLGeneration glslGeneration() const { return fGLSLGeneration; } | 28 GrGLSLGeneration glslGeneration() const { return fGLSLGeneration; } |
29 GrGLVendor vendor() const { return fVendor; } | 29 GrGLVendor vendor() const { return fVendor; } |
30 GrGLRenderer renderer() const { return fRenderer; } | 30 GrGLRenderer renderer() const { return fRenderer; } |
31 /** Is this a mesa-based driver. Does not mean it is the osmesa software ras
terizer. */ | 31 /** What driver is running our GL implementation? This is not necessarily re
lated to the vendor. |
32 bool isMesa() const { return fIsMesa; } | 32 (e.g. Intel GPU being driven by Mesa) */ |
33 /** Are we running inside Chromium (using the command buffer)? We make some
different tradeoffs | 33 GrGLDriver driver() const { return fDriver; } |
34 about what errors to check for because queries are synchronous. We shoul
d probably expose | 34 GrGLDriverVersion driverVersion() const { return fDriverVersion; } |
35 this as an option for clients other than Chromium. */ | |
36 bool isChromium() const { return fIsChromium; } | |
37 const GrGLCaps* caps() const { return fGLCaps.get(); } | 35 const GrGLCaps* caps() const { return fGLCaps.get(); } |
38 GrGLCaps* caps() { return fGLCaps; } | 36 GrGLCaps* caps() { return fGLCaps; } |
39 bool hasExtension(const char* ext) const { | 37 bool hasExtension(const char* ext) const { |
40 return fInterface->hasExtension(ext); | 38 return fInterface->hasExtension(ext); |
41 } | 39 } |
42 | 40 |
43 const GrGLExtensions& extensions() const { return fInterface->fExtensions; } | 41 const GrGLExtensions& extensions() const { return fInterface->fExtensions; } |
44 | 42 |
45 protected: | 43 protected: |
46 struct ConstructorArgs { | 44 struct ConstructorArgs { |
47 const GrGLInterface* fInterface; | 45 const GrGLInterface* fInterface; |
48 GrGLVersion fGLVersion; | 46 GrGLVersion fGLVersion; |
49 GrGLSLGeneration fGLSLGeneration; | 47 GrGLSLGeneration fGLSLGeneration; |
50 GrGLVendor fVendor; | 48 GrGLVendor fVendor; |
51 GrGLRenderer fRenderer; | 49 GrGLRenderer fRenderer; |
52 bool fIsMesa; | 50 GrGLDriver fDriver; |
53 bool fIsChromium; | 51 GrGLDriverVersion fDriverVersion; |
54 const GrContextOptions* fContextOptions; | 52 const GrContextOptions* fContextOptions; |
55 }; | 53 }; |
56 | 54 |
57 GrGLContextInfo(const ConstructorArgs& args); | 55 GrGLContextInfo(const ConstructorArgs& args); |
58 | 56 |
59 SkAutoTUnref<const GrGLInterface> fInterface; | 57 SkAutoTUnref<const GrGLInterface> fInterface; |
60 GrGLVersion fGLVersion; | 58 GrGLVersion fGLVersion; |
61 GrGLSLGeneration fGLSLGeneration; | 59 GrGLSLGeneration fGLSLGeneration; |
62 GrGLVendor fVendor; | 60 GrGLVendor fVendor; |
63 GrGLRenderer fRenderer; | 61 GrGLRenderer fRenderer; |
64 bool fIsMesa; | 62 GrGLDriver fDriver; |
65 bool fIsChromium; | 63 GrGLDriverVersion fDriverVersion; |
66 SkAutoTUnref<GrGLCaps> fGLCaps; | 64 SkAutoTUnref<GrGLCaps> fGLCaps; |
67 }; | 65 }; |
68 | 66 |
69 /** | 67 /** |
70 * Extension of GrGLContextInfo that also provides access to GrGLInterface. | 68 * Extension of GrGLContextInfo that also provides access to GrGLInterface. |
71 */ | 69 */ |
72 class GrGLContext : public GrGLContextInfo { | 70 class GrGLContext : public GrGLContextInfo { |
73 public: | 71 public: |
74 /** | 72 /** |
75 * Creates a GrGLContext from a GrGLInterface and the currently | 73 * Creates a GrGLContext from a GrGLInterface and the currently |
76 * bound OpenGL context accessible by the GrGLInterface. | 74 * bound OpenGL context accessible by the GrGLInterface. |
77 */ | 75 */ |
78 static GrGLContext* Create(const GrGLInterface* interface, const GrContextOp
tions& options); | 76 static GrGLContext* Create(const GrGLInterface* interface, const GrContextOp
tions& options); |
79 | 77 |
80 const GrGLInterface* interface() const { return fInterface; } | 78 const GrGLInterface* interface() const { return fInterface; } |
81 | 79 |
82 private: | 80 private: |
83 GrGLContext(const ConstructorArgs& args) : INHERITED(args) {} | 81 GrGLContext(const ConstructorArgs& args) : INHERITED(args) {} |
84 | 82 |
85 typedef GrGLContextInfo INHERITED; | 83 typedef GrGLContextInfo INHERITED; |
86 }; | 84 }; |
87 | 85 |
88 #endif | 86 #endif |
OLD | NEW |