[Android] Enable the autofill dialog flag.
[chromium-blink-merge.git] / ui / gl / gl_gl_api_implementation.h
blobd925b939909c8bd1a51058f31c2a8de1b4390beb
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
3 // found in the LICENSE file.
5 #ifndef UI_GL_GL_API_IMPLEMENTATION_H_
6 #define UI_GL_GL_API_IMPLEMENTATION_H_
8 #include "base/compiler_specific.h"
9 #include "ui/gl/gl_bindings.h"
10 #include "ui/gl/gl_export.h"
12 namespace gpu {
13 namespace gles2 {
14 class GLES2Decoder;
17 namespace gfx {
19 class GLContext;
20 class GLSurface;
22 void InitializeGLBindingsGL();
23 void InitializeGLExtensionBindingsGL(GLContext* context);
24 void InitializeDebugGLBindingsGL();
25 void ClearGLBindingsGL();
26 void SetGLToRealGLApi();
27 void SetGLApi(GLApi* api);
29 class GL_EXPORT GLApiBase : public GLApi {
30 public:
31 // Include the auto-generated part of this class. We split this because
32 // it means we can easily edit the non-auto generated parts right here in
33 // this file instead of having to edit some template or the code generator.
34 #include "gl_bindings_api_autogen_gl.h"
36 protected:
37 GLApiBase();
38 virtual ~GLApiBase();
39 void InitializeBase(DriverGL* driver);
41 DriverGL* driver_;
44 // Implemenents the GL API by calling directly into the driver.
45 class GL_EXPORT RealGLApi : public GLApiBase {
46 public:
47 RealGLApi();
48 virtual ~RealGLApi();
49 void Initialize(DriverGL* driver);
52 // Inserts a TRACE for every GL call.
53 class GL_EXPORT TraceGLApi : public GLApi {
54 public:
55 TraceGLApi(GLApi* gl_api) : gl_api_(gl_api) { }
56 virtual ~TraceGLApi();
58 // Include the auto-generated part of this class. We split this because
59 // it means we can easily edit the non-auto generated parts right here in
60 // this file instead of having to edit some template or the code generator.
61 #include "gl_bindings_api_autogen_gl.h"
63 private:
64 GLApi* gl_api_;
67 // Implementents the GL API using co-operative state restoring.
68 // Assumes there is only one real GL context and that multiple virtual contexts
69 // are implemented above it. Restores the needed state from the current context.
70 class GL_EXPORT VirtualGLApi : public GLApiBase {
71 public:
72 VirtualGLApi();
73 virtual ~VirtualGLApi();
74 void Initialize(DriverGL* driver, GLContext* real_context);
76 // Sets the current virutal context.
77 bool MakeCurrent(GLContext* virtual_context, GLSurface* surface);
79 void OnReleaseVirtuallyCurrent(GLContext* virtual_context);
81 // Overridden functions from GLApiBase
82 virtual const GLubyte* glGetStringFn(GLenum name) OVERRIDE;
84 private:
85 // The real context we're running on.
86 GLContext* real_context_;
88 // The current virtual context.
89 GLContext* current_context_;
91 // The supported extensions being advertised for this virtual context.
92 std::string extensions_;
95 } // namespace gfx
97 #endif // UI_GL_GL_API_IMPLEMENTATION_H_