| 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 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 81 // Create a GL context that is compatible with the given surface. | 81 // Create a GL context that is compatible with the given surface. |
| 82 // |share_group|, if non-NULL, is a group of contexts which the | 82 // |share_group|, if non-NULL, is a group of contexts which the |
| 83 // internally created OpenGL context shares textures and other resources. | 83 // internally created OpenGL context shares textures and other resources. |
| 84 static scoped_refptr<GLContext> CreateGLContext( | 84 static scoped_refptr<GLContext> CreateGLContext( |
| 85 GLShareGroup* share_group, | 85 GLShareGroup* share_group, |
| 86 GLSurface* compatible_surface, | 86 GLSurface* compatible_surface, |
| 87 GpuPreference gpu_preference); | 87 GpuPreference gpu_preference); |
| 88 | 88 |
| 89 static bool LosesAllContextsOnContextLost(); | 89 static bool LosesAllContextsOnContextLost(); |
| 90 | 90 |
| 91 // Returns the last GLContext made current, virtual or real. |
| 91 static GLContext* GetCurrent(); | 92 static GLContext* GetCurrent(); |
| 92 | 93 |
| 94 // Returns the last real GLContext made current. |
| 95 static GLContext* GetRealCurrent(); |
| 96 |
| 93 virtual bool WasAllocatedUsingRobustnessExtension(); | 97 virtual bool WasAllocatedUsingRobustnessExtension(); |
| 94 | 98 |
| 95 // Use this context for virtualization. | 99 // Use this context for virtualization. |
| 96 void SetupForVirtualization(); | 100 void SetupForVirtualization(); |
| 97 | 101 |
| 98 // Make this context current when used for context virtualization. | 102 // Make this context current when used for context virtualization. |
| 99 bool MakeVirtuallyCurrent(GLContext* virtual_context, GLSurface* surface); | 103 bool MakeVirtuallyCurrent(GLContext* virtual_context, GLSurface* surface); |
| 100 | 104 |
| 101 // Notify this context that |virtual_context|, that was using us, is | 105 // Notify this context that |virtual_context|, that was using us, is |
| 102 // being destroyed. | 106 // being destroyed. |
| 103 void OnDestroyVirtualContext(GLContext* virtual_context); | 107 void OnDestroyVirtualContext(GLContext* virtual_context); |
| 104 | 108 |
| 105 protected: | 109 protected: |
| 106 virtual ~GLContext(); | 110 virtual ~GLContext(); |
| 107 | 111 |
| 108 // Sets the GL api to the real hardware API (vs the VirtualAPI) | 112 // Sets the GL api to the real hardware API (vs the VirtualAPI) |
| 109 static void SetRealGLApi(); | 113 static void SetRealGLApi(); |
| 110 static void SetCurrent(GLContext* context, GLSurface* surface); | 114 static void SetCurrent(GLContext* context, GLSurface* surface); |
| 111 | 115 |
| 112 // Initialize function pointers to extension functions in the GL | 116 // Initialize function pointers to extension functions in the GL |
| 113 // implementation. Should be called immediately after this context is made | 117 // implementation. Should be called immediately after this context is made |
| 114 // current. | 118 // current. |
| 115 bool InitializeExtensionBindings(); | 119 bool InitializeExtensionBindings(); |
| 116 | 120 |
| 121 virtual bool IsVirtualContext(); |
| 122 |
| 117 private: | 123 private: |
| 118 friend class base::RefCounted<GLContext>; | 124 friend class base::RefCounted<GLContext>; |
| 119 | 125 |
| 120 scoped_refptr<GLShareGroup> share_group_; | 126 scoped_refptr<GLShareGroup> share_group_; |
| 121 scoped_ptr<VirtualGLApi> virtual_gl_api_; | 127 scoped_ptr<VirtualGLApi> virtual_gl_api_; |
| 122 scoped_ptr<GLStateRestorer> state_restorer_; | 128 scoped_ptr<GLStateRestorer> state_restorer_; |
| 123 | 129 |
| 124 DISALLOW_COPY_AND_ASSIGN(GLContext); | 130 DISALLOW_COPY_AND_ASSIGN(GLContext); |
| 125 }; | 131 }; |
| 126 | 132 |
| 127 } // namespace gfx | 133 } // namespace gfx |
| 128 | 134 |
| 129 #endif // UI_GL_GL_CONTEXT_H_ | 135 #endif // UI_GL_GL_CONTEXT_H_ |
| OLD | NEW |