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 // Initializes GL bindings. | 23 // Initialize GL bindings. |
24 GL_INIT_EXPORT bool InitializeGLOneOff(); | 24 GL_INIT_EXPORT bool InitializeGLOneOff(); |
25 | 25 |
26 // Initializes GL bindings using the provided parameters. This might be required | 26 // Initialize 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 // Clears GL bindings and resets GL implementation. | 33 // Create a GL context that is compatible with the given surface. |share_group|, |
34 GL_INIT_EXPORT void ClearGLBindings(); | 34 // if non-NULL, is a group of contexts which the internally created OpenGL |
35 | 35 // context shares textures and other resources. |
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. | |
39 GL_INIT_EXPORT scoped_refptr<GLContext> CreateGLContext( | 36 GL_INIT_EXPORT scoped_refptr<GLContext> CreateGLContext( |
40 GLShareGroup* share_group, | 37 GLShareGroup* share_group, |
41 GLSurface* compatible_surface, | 38 GLSurface* compatible_surface, |
42 GpuPreference gpu_preference); | 39 GpuPreference gpu_preference); |
43 | 40 |
44 // Creates a GL surface that renders directly to a view. | 41 // Create a GL surface that renders directly to a view. |
45 GL_INIT_EXPORT scoped_refptr<GLSurface> CreateViewGLSurface( | 42 GL_INIT_EXPORT scoped_refptr<GLSurface> CreateViewGLSurface( |
46 gfx::AcceleratedWidget window); | 43 gfx::AcceleratedWidget window); |
47 | 44 |
48 #if defined(USE_OZONE) | 45 #if defined(USE_OZONE) |
49 // Creates a GL surface that renders directly into a window with surfaceless | 46 // Create a GL surface that renders directly into a window with surfaceless |
50 // semantics - there is no default framebuffer and the primary surface must | 47 // semantics - there is no default framebuffer and the primary surface must |
51 // 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 |
52 // enabled it will return a null pointer. | 49 // enabled it will return a null pointer. |
53 GL_INIT_EXPORT scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface( | 50 GL_INIT_EXPORT scoped_refptr<GLSurface> CreateSurfacelessViewGLSurface( |
54 gfx::AcceleratedWidget window); | 51 gfx::AcceleratedWidget window); |
55 #endif // defined(USE_OZONE) | 52 #endif // defined(USE_OZONE) |
56 | 53 |
57 // Creates a GL surface used for offscreen rendering. | 54 // Create a GL surface used for offscreen rendering. |
58 GL_INIT_EXPORT scoped_refptr<GLSurface> CreateOffscreenGLSurface( | 55 GL_INIT_EXPORT scoped_refptr<GLSurface> CreateOffscreenGLSurface( |
59 const gfx::Size& size); | 56 const gfx::Size& size); |
60 | 57 |
61 } // namespace init | 58 } // namespace init |
62 } // namespace gl | 59 } // namespace gl |
63 | 60 |
64 #endif // UI_GL_INIT_GL_FACTORY_H_ | 61 #endif // UI_GL_INIT_GL_FACTORY_H_ |
OLD | NEW |