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_API_IMPLEMENTATION_H_ | 5 #ifndef UI_GL_GL_API_IMPLEMENTATION_H_ |
6 #define UI_GL_GL_API_IMPLEMENTATION_H_ | 6 #define UI_GL_GL_API_IMPLEMENTATION_H_ |
7 | 7 |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "ui/gl/gl_bindings.h" | 9 #include "ui/gl/gl_bindings.h" |
10 #include "ui/gl/gl_export.h" | 10 #include "ui/gl/gl_export.h" |
11 | 11 |
| 12 namespace gpu { |
| 13 namespace gles2 { |
| 14 class GLES2Decoder; |
| 15 } |
| 16 } |
12 namespace gfx { | 17 namespace gfx { |
13 | 18 |
14 class GLContext; | 19 class GLContext; |
| 20 class GLSurface; |
15 | 21 |
16 void InitializeGLBindingsGL(); | 22 void InitializeGLBindingsGL(); |
17 void InitializeGLExtensionBindingsGL(GLContext* context); | 23 void InitializeGLExtensionBindingsGL(GLContext* context); |
18 void InitializeDebugGLBindingsGL(); | 24 void InitializeDebugGLBindingsGL(); |
19 void ClearGLBindingsGL(); | 25 void ClearGLBindingsGL(); |
| 26 void SetGLToRealGLApi(); |
| 27 void SetGLApi(GLApi* api); |
20 | 28 |
| 29 // Implemenents the GL API by calling directly into the driver. |
21 class GL_EXPORT RealGLApi : public GLApi { | 30 class GL_EXPORT RealGLApi : public GLApi { |
22 public: | 31 public: |
23 RealGLApi(); | 32 RealGLApi(); |
| 33 virtual ~RealGLApi(); |
24 void Initialize(DriverGL* driver); | 34 void Initialize(DriverGL* driver); |
25 | 35 |
26 // Include the auto-generated part of this class. We split this because | 36 // Include the auto-generated part of this class. We split this because |
27 // it means we can easily edit the non-auto generated parts right here in | 37 // it means we can easily edit the non-auto generated parts right here in |
28 // this file instead of having to edit some template or the code generator. | 38 // this file instead of having to edit some template or the code generator. |
29 #include "gl_bindings_api_autogen_gl.h" | 39 #include "gl_bindings_api_autogen_gl.h" |
30 | 40 |
31 private: | 41 private: |
32 DriverGL* driver_; | 42 DriverGL* driver_; |
33 }; | 43 }; |
34 | 44 |
| 45 // Implementents the GL API using co-operative state restoring. |
| 46 // Assumes there is only one real GL context and that multiple virtual contexts |
| 47 // are implemented above it. Restores the needed state from the current context. |
| 48 class GL_EXPORT VirtualGLApi : public GLApi { |
| 49 public: |
| 50 VirtualGLApi(); |
| 51 virtual ~VirtualGLApi(); |
| 52 void Initialize(DriverGL* driver, GLContext* real_context); |
| 53 |
| 54 // Include the auto-generated part of this class. We split this because |
| 55 // it means we can easily edit the non-auto generated parts right here in |
| 56 // this file instead of having to edit some template or the code generator. |
| 57 #include "gl_bindings_api_autogen_gl.h" |
| 58 |
| 59 // Sets the current virutal context. |
| 60 bool MakeCurrent(GLContext* virtual_context, GLSurface* surface); |
| 61 |
| 62 private: |
| 63 DriverGL* driver_; |
| 64 |
| 65 // The real context we're running on. |
| 66 GLContext* real_context_; |
| 67 |
| 68 // The current virtual context. |
| 69 GLContext* current_context_; |
| 70 |
| 71 // The current surface. |
| 72 GLSurface* current_surface_; |
| 73 }; |
| 74 |
35 } // namespace gfx | 75 } // namespace gfx |
36 | 76 |
37 #endif // UI_GL_GL_API_IMPLEMENTATION_H_ | 77 #endif // UI_GL_GL_API_IMPLEMENTATION_H_ |
38 | 78 |
39 | 79 |
40 | 80 |
OLD | NEW |