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 struct GrContextOptions; |
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 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; } |
(...skipping 15 matching lines...) Expand all Loading... |
44 | 44 |
45 protected: | 45 protected: |
46 struct ConstructorArgs { | 46 struct ConstructorArgs { |
47 const GrGLInterface* fInterface; | 47 const GrGLInterface* fInterface; |
48 GrGLVersion fGLVersion; | 48 GrGLVersion fGLVersion; |
49 GrGLSLGeneration fGLSLGeneration; | 49 GrGLSLGeneration fGLSLGeneration; |
50 GrGLVendor fVendor; | 50 GrGLVendor fVendor; |
51 GrGLRenderer fRenderer; | 51 GrGLRenderer fRenderer; |
52 bool fIsMesa; | 52 bool fIsMesa; |
53 bool fIsChromium; | 53 bool fIsChromium; |
| 54 const GrContextOptions* fContextOptions; |
54 }; | 55 }; |
55 | 56 |
56 GrGLContextInfo(const ConstructorArgs& args); | 57 GrGLContextInfo(const ConstructorArgs& args); |
57 | 58 |
58 SkAutoTUnref<const GrGLInterface> fInterface; | 59 SkAutoTUnref<const GrGLInterface> fInterface; |
59 GrGLVersion fGLVersion; | 60 GrGLVersion fGLVersion; |
60 GrGLSLGeneration fGLSLGeneration; | 61 GrGLSLGeneration fGLSLGeneration; |
61 GrGLVendor fVendor; | 62 GrGLVendor fVendor; |
62 GrGLRenderer fRenderer; | 63 GrGLRenderer fRenderer; |
63 bool fIsMesa; | 64 bool fIsMesa; |
64 bool fIsChromium; | 65 bool fIsChromium; |
65 SkAutoTUnref<GrGLCaps> fGLCaps; | 66 SkAutoTUnref<GrGLCaps> fGLCaps; |
66 }; | 67 }; |
67 | 68 |
68 /** | 69 /** |
69 * Extension of GrGLContextInfo that also provides access to GrGLInterface. | 70 * Extension of GrGLContextInfo that also provides access to GrGLInterface. |
70 */ | 71 */ |
71 class GrGLContext : public GrGLContextInfo { | 72 class GrGLContext : public GrGLContextInfo { |
72 public: | 73 public: |
73 /** | 74 /** |
74 * Creates a GrGLContext from a GrGLInterface and the currently | 75 * Creates a GrGLContext from a GrGLInterface and the currently |
75 * bound OpenGL context accessible by the GrGLInterface. | 76 * bound OpenGL context accessible by the GrGLInterface. |
76 */ | 77 */ |
77 static GrGLContext* Create(const GrGLInterface* interface); | 78 static GrGLContext* Create(const GrGLInterface* interface, const GrContextOp
tions& options); |
78 | 79 |
79 const GrGLInterface* interface() const { return fInterface; } | 80 const GrGLInterface* interface() const { return fInterface; } |
80 | 81 |
81 private: | 82 private: |
82 GrGLContext(const ConstructorArgs& args) : INHERITED(args) {} | 83 GrGLContext(const ConstructorArgs& args) : INHERITED(args) {} |
83 | 84 |
84 typedef GrGLContextInfo INHERITED; | 85 typedef GrGLContextInfo INHERITED; |
85 }; | 86 }; |
86 | 87 |
87 #endif | 88 #endif |
OLD | NEW |