Chromium Code Reviews| 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 #undef UI_GFX_GL_GL_BINDINGS_API_AUTOGEN_GL_H_ | |
|
apatrick_chromium
2012/11/05 20:50:44
If gl_bindings_api_autogen.h is intended to be use
greggman
2012/11/06 02:56:37
Done.
| |
| 58 #include "gl_bindings_api_autogen_gl.h" | |
| 59 | |
| 60 // Sets the current virutal context. | |
| 61 bool MakeCurrent(GLContext* virtual_context, GLSurface* surface); | |
| 62 | |
| 63 private: | |
| 64 DriverGL* driver_; | |
| 65 | |
| 66 // The real context we're running on. | |
| 67 GLContext* real_context_; | |
| 68 | |
| 69 // The current virtual context. | |
| 70 GLContext* current_context_; | |
| 71 | |
| 72 // The current surface. | |
| 73 GLSurface* current_surface_; | |
| 74 }; | |
| 75 | |
| 35 } // namespace gfx | 76 } // namespace gfx |
| 36 | 77 |
| 37 #endif // UI_GL_GL_API_IMPLEMENTATION_H_ | 78 #endif // UI_GL_GL_API_IMPLEMENTATION_H_ |
| 38 | 79 |
| 39 | 80 |
| 40 | 81 |
| OLD | NEW |