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 "base/memory/ref_counted.h" | 8 #include "base/memory/ref_counted.h" |
9 #include "ui/gfx/geometry/size.h" | 9 #include "ui/gfx/geometry/size.h" |
10 #include "ui/gfx/native_widget_types.h" | 10 #include "ui/gfx/native_widget_types.h" |
| 11 #include "ui/gl/gl_implementation.h" |
11 #include "ui/gl/gpu_preference.h" | 12 #include "ui/gl/gpu_preference.h" |
12 #include "ui/gl/init/gl_init_export.h" | 13 #include "ui/gl/init/gl_init_export.h" |
13 | 14 |
14 namespace gl { | 15 namespace gl { |
15 | 16 |
16 class GLContext; | 17 class GLContext; |
17 class GLShareGroup; | 18 class GLShareGroup; |
18 class GLSurface; | 19 class GLSurface; |
19 | 20 |
20 namespace init { | 21 namespace init { |
21 | 22 |
22 // Initialize GL bindings. | 23 // Initialize GL bindings. |
23 GL_INIT_EXPORT bool InitializeGLOneOff(); | 24 GL_INIT_EXPORT bool InitializeGLOneOff(); |
24 | 25 |
| 26 // Initialize GL bindings using the provided parameters. This might be required |
| 27 // for use in tests, otherwise use InitializeGLOneOff() instead. |
| 28 GL_INIT_EXPORT bool InitializeGLOneOffImplementation(GLImplementation impl, |
| 29 bool fallback_to_osmesa, |
| 30 bool gpu_service_logging, |
| 31 bool disable_gl_drawing); |
| 32 |
25 // Create a GL context that is compatible with the given surface. |share_group|, | 33 // Create a GL context that is compatible with the given surface. |share_group|, |
26 // if non-NULL, is a group of contexts which the internally created OpenGL | 34 // if non-NULL, is a group of contexts which the internally created OpenGL |
27 // context shares textures and other resources. | 35 // context shares textures and other resources. |
28 GL_INIT_EXPORT scoped_refptr<GLContext> CreateGLContext( | 36 GL_INIT_EXPORT scoped_refptr<GLContext> CreateGLContext( |
29 GLShareGroup* share_group, | 37 GLShareGroup* share_group, |
30 GLSurface* compatible_surface, | 38 GLSurface* compatible_surface, |
31 GpuPreference gpu_preference); | 39 GpuPreference gpu_preference); |
32 | 40 |
33 // Create a GL surface that renders directly to a view. | 41 // Create a GL surface that renders directly to a view. |
34 GL_INIT_EXPORT scoped_refptr<GLSurface> CreateViewGLSurface( | 42 GL_INIT_EXPORT scoped_refptr<GLSurface> CreateViewGLSurface( |
35 gfx::AcceleratedWidget window); | 43 gfx::AcceleratedWidget window); |
36 | 44 |
37 #if defined(USE_OZONE) | 45 #if defined(USE_OZONE) |
38 // Create a GL surface that renders directly into a window with surfaceless | 46 // Create a GL surface that renders directly into a window with surfaceless |
39 // semantics - there is no default framebuffer and the primary surface must | 47 // semantics - there is no default framebuffer and the primary surface must |
40 // be presented as an overlay. If surfaceless mode is not supported or | 48 // be presented as an overlay. If surfaceless mode is not supported or |
41 // enabled it will return a null pointer. | 49 // enabled it will return a null pointer. |
42 GL_INIT_EXPORT scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface( | 50 GL_INIT_EXPORT scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface( |
43 gfx::AcceleratedWidget window); | 51 gfx::AcceleratedWidget window); |
44 #endif // defined(USE_OZONE) | 52 #endif // defined(USE_OZONE) |
45 | 53 |
46 // Create a GL surface used for offscreen rendering. | 54 // Create a GL surface used for offscreen rendering. |
47 GL_INIT_EXPORT scoped_refptr<GLSurface> CreateOffscreenGLSurface( | 55 GL_INIT_EXPORT scoped_refptr<GLSurface> CreateOffscreenGLSurface( |
48 const gfx::Size& size); | 56 const gfx::Size& size); |
49 | 57 |
50 } // namespace init | 58 } // namespace init |
51 } // namespace gl | 59 } // namespace gl |
52 | 60 |
53 #endif // UI_GL_INIT_GL_FACTORY_H_ | 61 #endif // UI_GL_INIT_GL_FACTORY_H_ |
OLD | NEW |