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_GL_API_IMPLEMENTATION_H_ | 5 #ifndef UI_GL_GL_GL_API_IMPLEMENTATION_H_ |
6 #define UI_GL_GL_GL_API_IMPLEMENTATION_H_ | 6 #define UI_GL_GL_GL_API_IMPLEMENTATION_H_ |
7 | 7 |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 void InitializeWithCommandLine(DriverGL* driver, | 63 void InitializeWithCommandLine(DriverGL* driver, |
64 base::CommandLine* command_line); | 64 base::CommandLine* command_line); |
65 | 65 |
66 void glGetIntegervFn(GLenum pname, GLint* params) override; | 66 void glGetIntegervFn(GLenum pname, GLint* params) override; |
67 const GLubyte* glGetStringFn(GLenum name) override; | 67 const GLubyte* glGetStringFn(GLenum name) override; |
68 const GLubyte* glGetStringiFn(GLenum name, GLuint index) override; | 68 const GLubyte* glGetStringiFn(GLenum name, GLuint index) override; |
69 | 69 |
70 void InitializeFilteredExtensions(); | 70 void InitializeFilteredExtensions(); |
71 | 71 |
72 private: | 72 private: |
73 void glFinishFn() override; | |
74 void glFlushFn() override; | |
75 | |
76 // Filtered GL_EXTENSIONS we return to glGetString(i) calls. | 73 // Filtered GL_EXTENSIONS we return to glGetString(i) calls. |
77 std::vector<std::string> disabled_exts_; | 74 std::vector<std::string> disabled_exts_; |
78 std::vector<std::string> filtered_exts_; | 75 std::vector<std::string> filtered_exts_; |
79 std::string filtered_exts_str_; | 76 std::string filtered_exts_str_; |
80 | 77 |
81 #if DCHECK_IS_ON() | 78 #if DCHECK_IS_ON() |
82 bool filtered_exts_initialized_; | 79 bool filtered_exts_initialized_; |
83 #endif | 80 #endif |
84 }; | 81 }; |
85 | 82 |
(...skipping 17 matching lines...) Expand all Loading... |
103 public: | 100 public: |
104 NoContextGLApi(); | 101 NoContextGLApi(); |
105 ~NoContextGLApi() override; | 102 ~NoContextGLApi() override; |
106 | 103 |
107 // Include the auto-generated part of this class. We split this because | 104 // Include the auto-generated part of this class. We split this because |
108 // it means we can easily edit the non-auto generated parts right here in | 105 // it means we can easily edit the non-auto generated parts right here in |
109 // this file instead of having to edit some template or the code generator. | 106 // this file instead of having to edit some template or the code generator. |
110 #include "gl_bindings_api_autogen_gl.h" | 107 #include "gl_bindings_api_autogen_gl.h" |
111 }; | 108 }; |
112 | 109 |
113 // Implementents the GL API using co-operative state restoring. | |
114 // Assumes there is only one real GL context and that multiple virtual contexts | |
115 // are implemented above it. Restores the needed state from the current context. | |
116 class VirtualGLApi : public GLApiBase { | |
117 public: | |
118 VirtualGLApi(); | |
119 ~VirtualGLApi() override; | |
120 void Initialize(DriverGL* driver, GLContext* real_context); | |
121 | |
122 // Sets the current virutal context. | |
123 bool MakeCurrent(GLContext* virtual_context, GLSurface* surface); | |
124 | |
125 void OnReleaseVirtuallyCurrent(GLContext* virtual_context); | |
126 | |
127 private: | |
128 // Overridden functions from GLApiBase | |
129 void glGetIntegervFn(GLenum pname, GLint* params) override; | |
130 const GLubyte* glGetStringFn(GLenum name) override; | |
131 const GLubyte* glGetStringiFn(GLenum name, GLuint index) override; | |
132 void glFinishFn() override; | |
133 void glFlushFn() override; | |
134 | |
135 // The real context we're running on. | |
136 GLContext* real_context_; | |
137 | |
138 // The current virtual context. | |
139 GLContext* current_context_; | |
140 | |
141 // The supported extensions being advertised for this virtual context. | |
142 std::string extensions_; | |
143 std::vector<std::string> extensions_vec_; | |
144 }; | |
145 | |
146 } // namespace gl | 110 } // namespace gl |
147 | 111 |
148 #endif // UI_GL_GL_GL_API_IMPLEMENTATION_H_ | 112 #endif // UI_GL_GL_GL_API_IMPLEMENTATION_H_ |
OLD | NEW |