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 |
| 114 // Returns the GL renderer string. The context must be current. |
| 115 virtual std::string GetGLRenderer(); |
| 116 |
111 protected: | 117 protected: |
112 virtual ~GLContext(); | 118 virtual ~GLContext(); |
113 | 119 |
114 // Sets the GL api to the real hardware API (vs the VirtualAPI) | 120 // Sets the GL api to the real hardware API (vs the VirtualAPI) |
115 static void SetRealGLApi(); | 121 static void SetRealGLApi(); |
116 virtual void SetCurrent(GLSurface* surface); | 122 virtual void SetCurrent(GLSurface* surface); |
117 | 123 |
118 // Initialize function pointers to functions where the bound version depends | 124 // Initialize function pointers to functions where the bound version depends |
119 // on GL version or supported extensions. Should be called immediately after | 125 // on GL version or supported extensions. Should be called immediately after |
120 // this context is made current. | 126 // this context is made current. |
121 bool InitializeDynamicBindings(); | 127 bool InitializeDynamicBindings(); |
122 | 128 |
123 // Returns the last real (non-virtual) GLContext made current. | 129 // Returns the last real (non-virtual) GLContext made current. |
124 static GLContext* GetRealCurrent(); | 130 static GLContext* GetRealCurrent(); |
125 | 131 |
126 // Returns the GL version string. The context must be current. | |
127 virtual std::string GetGLVersion(); | |
128 | |
129 private: | 132 private: |
130 friend class base::RefCounted<GLContext>; | 133 friend class base::RefCounted<GLContext>; |
131 | 134 |
132 // For GetRealCurrent. | 135 // For GetRealCurrent. |
133 friend class VirtualGLApi; | 136 friend class VirtualGLApi; |
134 | 137 |
135 scoped_refptr<GLShareGroup> share_group_; | 138 scoped_refptr<GLShareGroup> share_group_; |
136 scoped_ptr<VirtualGLApi> virtual_gl_api_; | 139 scoped_ptr<VirtualGLApi> virtual_gl_api_; |
137 scoped_ptr<GLStateRestorer> state_restorer_; | 140 scoped_ptr<GLStateRestorer> state_restorer_; |
138 scoped_ptr<GLVersionInfo> version_info_; | 141 scoped_ptr<GLVersionInfo> version_info_; |
(...skipping 10 matching lines...) Expand all Loading... |
149 | 152 |
150 virtual void SetCurrent(GLSurface* surface) OVERRIDE; | 153 virtual void SetCurrent(GLSurface* surface) OVERRIDE; |
151 | 154 |
152 private: | 155 private: |
153 DISALLOW_COPY_AND_ASSIGN(GLContextReal); | 156 DISALLOW_COPY_AND_ASSIGN(GLContextReal); |
154 }; | 157 }; |
155 | 158 |
156 } // namespace gfx | 159 } // namespace gfx |
157 | 160 |
158 #endif // UI_GL_GL_CONTEXT_H_ | 161 #endif // UI_GL_GL_CONTEXT_H_ |
OLD | NEW |