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