OLD | NEW |
1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_INIT_GL_FACTORY_H_ | 5 #ifndef UI_GL_INIT_GL_FACTORY_H_ |
6 #define UI_GL_INIT_GL_FACTORY_H_ | 6 #define UI_GL_INIT_GL_FACTORY_H_ |
7 | 7 |
| 8 #include <vector> |
| 9 |
8 #include "base/memory/ref_counted.h" | 10 #include "base/memory/ref_counted.h" |
9 #include "ui/gfx/geometry/size.h" | 11 #include "ui/gfx/geometry/size.h" |
10 #include "ui/gfx/native_widget_types.h" | 12 #include "ui/gfx/native_widget_types.h" |
11 #include "ui/gl/gl_implementation.h" | 13 #include "ui/gl/gl_implementation.h" |
12 #include "ui/gl/gpu_preference.h" | 14 #include "ui/gl/gpu_preference.h" |
13 #include "ui/gl/init/gl_init_export.h" | 15 #include "ui/gl/init/gl_init_export.h" |
14 | 16 |
15 namespace gl { | 17 namespace gl { |
16 | 18 |
17 class GLContext; | 19 class GLContext; |
18 class GLShareGroup; | 20 class GLShareGroup; |
19 class GLSurface; | 21 class GLSurface; |
20 | 22 |
21 namespace init { | 23 namespace init { |
22 | 24 |
| 25 // Returns a list of allowed GL implementations. The default implementation will |
| 26 // be the first item. |
| 27 GL_INIT_EXPORT std::vector<GLImplementation> GetAllowedGLImplementations(); |
| 28 |
23 // Initializes GL bindings. | 29 // Initializes GL bindings. |
24 GL_INIT_EXPORT bool InitializeGLOneOff(); | 30 GL_INIT_EXPORT bool InitializeGLOneOff(); |
25 | 31 |
26 // Initializes GL bindings using the provided parameters. This might be required | 32 // Initializes GL bindings using the provided parameters. This might be required |
27 // for use in tests, otherwise use InitializeGLOneOff() instead. | 33 // for use in tests, otherwise use InitializeGLOneOff() instead. |
28 GL_INIT_EXPORT bool InitializeGLOneOffImplementation(GLImplementation impl, | 34 GL_INIT_EXPORT bool InitializeGLOneOffImplementation(GLImplementation impl, |
29 bool fallback_to_osmesa, | 35 bool fallback_to_osmesa, |
30 bool gpu_service_logging, | 36 bool gpu_service_logging, |
31 bool disable_gl_drawing); | 37 bool disable_gl_drawing); |
32 | 38 |
33 // Clears GL bindings and resets GL implementation. | 39 // Clears GL bindings and resets GL implementation. |
34 GL_INIT_EXPORT void ClearGLBindings(); | 40 GL_INIT_EXPORT void ClearGLBindings(); |
35 | 41 |
| 42 // Return information about the GL window system binding implementation (e.g., |
| 43 // EGL, GLX, WGL). Returns true if the information was retrieved successfully. |
| 44 GL_INIT_EXPORT bool GetGLWindowSystemBindingInfo( |
| 45 GLWindowSystemBindingInfo* info); |
| 46 |
36 // Creates a GL context that is compatible with the given surface. | 47 // Creates a GL context that is compatible with the given surface. |
37 // |share_group|, if non-NULL, is a group of contexts which the internally | 48 // |share_group|, if non-NULL, is a group of contexts which the internally |
38 // created OpenGL context shares textures and other resources. | 49 // created OpenGL context shares textures and other resources. |
39 GL_INIT_EXPORT scoped_refptr<GLContext> CreateGLContext( | 50 GL_INIT_EXPORT scoped_refptr<GLContext> CreateGLContext( |
40 GLShareGroup* share_group, | 51 GLShareGroup* share_group, |
41 GLSurface* compatible_surface, | 52 GLSurface* compatible_surface, |
42 GpuPreference gpu_preference); | 53 GpuPreference gpu_preference); |
43 | 54 |
44 // Creates a GL surface that renders directly to a view. | 55 // Creates a GL surface that renders directly to a view. |
45 GL_INIT_EXPORT scoped_refptr<GLSurface> CreateViewGLSurface( | 56 GL_INIT_EXPORT scoped_refptr<GLSurface> CreateViewGLSurface( |
46 gfx::AcceleratedWidget window); | 57 gfx::AcceleratedWidget window); |
47 | 58 |
48 #if defined(USE_OZONE) | 59 #if defined(USE_OZONE) |
49 // Creates a GL surface that renders directly into a window with surfaceless | 60 // Creates a GL surface that renders directly into a window with surfaceless |
50 // semantics - there is no default framebuffer and the primary surface must | 61 // semantics - there is no default framebuffer and the primary surface must |
51 // be presented as an overlay. If surfaceless mode is not supported or | 62 // be presented as an overlay. If surfaceless mode is not supported or |
52 // enabled it will return a null pointer. | 63 // enabled it will return a null pointer. |
53 GL_INIT_EXPORT scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface( | 64 GL_INIT_EXPORT scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface( |
54 gfx::AcceleratedWidget window); | 65 gfx::AcceleratedWidget window); |
55 #endif // defined(USE_OZONE) | 66 #endif // defined(USE_OZONE) |
56 | 67 |
57 // Creates a GL surface used for offscreen rendering. | 68 // Creates a GL surface used for offscreen rendering. |
58 GL_INIT_EXPORT scoped_refptr<GLSurface> CreateOffscreenGLSurface( | 69 GL_INIT_EXPORT scoped_refptr<GLSurface> CreateOffscreenGLSurface( |
59 const gfx::Size& size); | 70 const gfx::Size& size); |
60 | 71 |
61 } // namespace init | 72 } // namespace init |
62 } // namespace gl | 73 } // namespace gl |
63 | 74 |
64 #endif // UI_GL_INIT_GL_FACTORY_H_ | 75 #endif // UI_GL_INIT_GL_FACTORY_H_ |
OLD | NEW |