OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef UI_GL_GL_CONTEXT_H_ | 5 #ifndef UI_GL_GL_CONTEXT_H_ |
6 #define UI_GL_GL_CONTEXT_H_ | 6 #define UI_GL_GL_CONTEXT_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "base/basictypes.h" | 10 #include "base/basictypes.h" |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
101 // Use this context for virtualization. | 101 // Use this context for virtualization. |
102 void SetupForVirtualization(); | 102 void SetupForVirtualization(); |
103 | 103 |
104 // Make this context current when used for context virtualization. | 104 // Make this context current when used for context virtualization. |
105 bool MakeVirtuallyCurrent(GLContext* virtual_context, GLSurface* surface); | 105 bool MakeVirtuallyCurrent(GLContext* virtual_context, GLSurface* surface); |
106 | 106 |
107 // Notify this context that |virtual_context|, that was using us, is | 107 // Notify this context that |virtual_context|, that was using us, is |
108 // being released or destroyed. | 108 // being released or destroyed. |
109 void OnReleaseVirtuallyCurrent(GLContext* virtual_context); | 109 void OnReleaseVirtuallyCurrent(GLContext* virtual_context); |
110 | 110 |
| 111 // Returns the GL version string. The context must be current. |
| 112 virtual std::string GetGLVersion(); |
| 113 |
111 protected: | 114 protected: |
112 virtual ~GLContext(); | 115 virtual ~GLContext(); |
113 | 116 |
114 // Sets the GL api to the real hardware API (vs the VirtualAPI) | 117 // Sets the GL api to the real hardware API (vs the VirtualAPI) |
115 static void SetRealGLApi(); | 118 static void SetRealGLApi(); |
116 virtual void SetCurrent(GLSurface* surface); | 119 virtual void SetCurrent(GLSurface* surface); |
117 | 120 |
118 // Initialize function pointers to functions where the bound version depends | 121 // Initialize function pointers to functions where the bound version depends |
119 // on GL version or supported extensions. Should be called immediately after | 122 // on GL version or supported extensions. Should be called immediately after |
120 // this context is made current. | 123 // this context is made current. |
121 bool InitializeDynamicBindings(); | 124 bool InitializeDynamicBindings(); |
122 | 125 |
123 // Returns the last real (non-virtual) GLContext made current. | 126 // Returns the last real (non-virtual) GLContext made current. |
124 static GLContext* GetRealCurrent(); | 127 static GLContext* GetRealCurrent(); |
125 | 128 |
126 // Returns the GL version string. The context must be current. | |
127 virtual std::string GetGLVersion(); | |
128 | |
129 private: | 129 private: |
130 friend class base::RefCounted<GLContext>; | 130 friend class base::RefCounted<GLContext>; |
131 | 131 |
132 // For GetRealCurrent. | 132 // For GetRealCurrent. |
133 friend class VirtualGLApi; | 133 friend class VirtualGLApi; |
134 | 134 |
135 scoped_refptr<GLShareGroup> share_group_; | 135 scoped_refptr<GLShareGroup> share_group_; |
136 scoped_ptr<VirtualGLApi> virtual_gl_api_; | 136 scoped_ptr<VirtualGLApi> virtual_gl_api_; |
137 scoped_ptr<GLStateRestorer> state_restorer_; | 137 scoped_ptr<GLStateRestorer> state_restorer_; |
138 scoped_ptr<GLVersionInfo> version_info_; | 138 scoped_ptr<GLVersionInfo> version_info_; |
(...skipping 10 matching lines...) Expand all Loading... |
149 | 149 |
150 virtual void SetCurrent(GLSurface* surface) OVERRIDE; | 150 virtual void SetCurrent(GLSurface* surface) OVERRIDE; |
151 | 151 |
152 private: | 152 private: |
153 DISALLOW_COPY_AND_ASSIGN(GLContextReal); | 153 DISALLOW_COPY_AND_ASSIGN(GLContextReal); |
154 }; | 154 }; |
155 | 155 |
156 } // namespace gfx | 156 } // namespace gfx |
157 | 157 |
158 #endif // UI_GL_GL_CONTEXT_H_ | 158 #endif // UI_GL_GL_CONTEXT_H_ |
OLD | NEW |