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> |
| 9 |
8 #include "base/compiler_specific.h" | 10 #include "base/compiler_specific.h" |
9 #include "ui/gl/gl_bindings.h" | 11 #include "ui/gl/gl_bindings.h" |
10 #include "ui/gl/gl_export.h" | 12 #include "ui/gl/gl_export.h" |
11 | 13 |
| 14 namespace base { |
| 15 class CommandLine; |
| 16 } |
12 namespace gpu { | 17 namespace gpu { |
13 namespace gles2 { | 18 namespace gles2 { |
14 class GLES2Decoder; | 19 class GLES2Decoder; |
15 } | 20 } |
16 } | 21 } |
17 namespace gfx { | 22 namespace gfx { |
18 | 23 |
19 class GLContext; | 24 class GLContext; |
20 class GLSurface; | 25 class GLSurface; |
21 struct GLVersionInfo; | 26 struct GLVersionInfo; |
22 | 27 |
23 void InitializeStaticGLBindingsGL(); | 28 void InitializeStaticGLBindingsGL(); |
24 void InitializeDynamicGLBindingsGL(GLContext* context); | 29 void InitializeDynamicGLBindingsGL(GLContext* context); |
25 void InitializeDebugGLBindingsGL(); | 30 void InitializeDebugGLBindingsGL(); |
26 void InitializeNullDrawGLBindingsGL(); | 31 void InitializeNullDrawGLBindingsGL(); |
27 // TODO(danakj): Remove this when all test suites are using null-draw. | 32 // TODO(danakj): Remove this when all test suites are using null-draw. |
28 bool HasInitializedNullDrawGLBindingsGL(); | 33 bool HasInitializedNullDrawGLBindingsGL(); |
29 bool SetNullDrawGLBindingsEnabledGL(bool enabled); | 34 bool SetNullDrawGLBindingsEnabledGL(bool enabled); |
30 void ClearGLBindingsGL(); | 35 void ClearGLBindingsGL(); |
31 void SetGLToRealGLApi(); | 36 void SetGLToRealGLApi(); |
32 void SetGLApi(GLApi* api); | 37 void SetGLApi(GLApi* api); |
33 void SetGLApiToNoContext(); | 38 void SetGLApiToNoContext(); |
34 const GLVersionInfo* GetGLVersionInfo(); | 39 const GLVersionInfo* GetGLVersionInfo(); |
35 | 40 |
36 class GLApiBase : public GLApi { | 41 class GL_EXPORT GLApiBase : public GLApi { |
37 public: | 42 public: |
38 // Include the auto-generated part of this class. We split this because | 43 // Include the auto-generated part of this class. We split this because |
39 // it means we can easily edit the non-auto generated parts right here in | 44 // it means we can easily edit the non-auto generated parts right here in |
40 // this file instead of having to edit some template or the code generator. | 45 // this file instead of having to edit some template or the code generator. |
41 #include "gl_bindings_api_autogen_gl.h" | 46 #include "gl_bindings_api_autogen_gl.h" |
42 | 47 |
43 protected: | 48 protected: |
44 GLApiBase(); | 49 GLApiBase(); |
45 ~GLApiBase() override; | 50 ~GLApiBase() override; |
46 void InitializeBase(DriverGL* driver); | 51 void InitializeBase(DriverGL* driver); |
47 | 52 |
48 DriverGL* driver_; | 53 DriverGL* driver_; |
49 }; | 54 }; |
50 | 55 |
51 // Implemenents the GL API by calling directly into the driver. | 56 // Implemenents the GL API by calling directly into the driver. |
52 class RealGLApi : public GLApiBase { | 57 class GL_EXPORT RealGLApi : public GLApiBase { |
53 public: | 58 public: |
54 RealGLApi(); | 59 RealGLApi(); |
55 ~RealGLApi() override; | 60 ~RealGLApi() override; |
56 void Initialize(DriverGL* driver); | 61 void Initialize(DriverGL* driver); |
| 62 void InitializeWithCommandLine(DriverGL* driver, |
| 63 base::CommandLine* command_line); |
| 64 |
| 65 void glGetIntegervFn(GLenum pname, GLint* params) override; |
| 66 const GLubyte* glGetStringFn(GLenum name) override; |
| 67 const GLubyte* glGetStringiFn(GLenum name, GLuint index) override; |
57 | 68 |
58 private: | 69 private: |
59 void glFinishFn() override; | 70 void glFinishFn() override; |
60 void glFlushFn() override; | 71 void glFlushFn() override; |
| 72 |
| 73 // Filtered GL_EXTENSIONS we return to glGetString(i) calls. |
| 74 std::vector<std::string> filtered_exts_; |
| 75 std::string filtered_exts_str_; |
61 }; | 76 }; |
62 | 77 |
63 // Inserts a TRACE for every GL call. | 78 // Inserts a TRACE for every GL call. |
64 class TraceGLApi : public GLApi { | 79 class TraceGLApi : public GLApi { |
65 public: | 80 public: |
66 TraceGLApi(GLApi* gl_api) : gl_api_(gl_api) { } | 81 TraceGLApi(GLApi* gl_api) : gl_api_(gl_api) { } |
67 ~TraceGLApi() override; | 82 ~TraceGLApi() override; |
68 | 83 |
69 // Include the auto-generated part of this class. We split this because | 84 // Include the auto-generated part of this class. We split this because |
70 // it means we can easily edit the non-auto generated parts right here in | 85 // it means we can easily edit the non-auto generated parts right here in |
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 ScopedSetGLToRealGLApi(); | 137 ScopedSetGLToRealGLApi(); |
123 ~ScopedSetGLToRealGLApi(); | 138 ~ScopedSetGLToRealGLApi(); |
124 | 139 |
125 private: | 140 private: |
126 GLApi* old_gl_api_; | 141 GLApi* old_gl_api_; |
127 }; | 142 }; |
128 | 143 |
129 } // namespace gfx | 144 } // namespace gfx |
130 | 145 |
131 #endif // UI_GL_GL_GL_API_IMPLEMENTATION_H_ | 146 #endif // UI_GL_GL_GL_API_IMPLEMENTATION_H_ |
OLD | NEW |