OLD | NEW |
(Empty) | |
| 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 |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #ifndef UI_OZONE_PUBLIC_GL_OZONE_H_ |
| 6 #define UI_OZONE_PUBLIC_GL_OZONE_H_ |
| 7 |
| 8 #include "base/macros.h" |
| 9 #include "base/memory/ref_counted.h" |
| 10 #include "ui/gfx/geometry/size.h" |
| 11 #include "ui/gfx/native_widget_types.h" |
| 12 #include "ui/gl/gl_implementation.h" |
| 13 #include "ui/gl/gpu_preference.h" |
| 14 #include "ui/ozone/ozone_base_export.h" |
| 15 |
| 16 namespace gl { |
| 17 class GLContext; |
| 18 class GLShareGroup; |
| 19 class GLSurface; |
| 20 } |
| 21 |
| 22 namespace ui { |
| 23 |
| 24 // Interface that has all of the required methods for an Ozone platform to |
| 25 // implement a GL implementation. Functions in gl_factory.h and gl_initializer.h |
| 26 // will delegate to functions in this interface. |
| 27 class OZONE_BASE_EXPORT GLOzone { |
| 28 public: |
| 29 virtual ~GLOzone() {} |
| 30 |
| 31 // Initializes static GL bindings and sets GL implementation. |
| 32 virtual bool InitializeStaticGLBindings( |
| 33 gl::GLImplementation implementation) = 0; |
| 34 |
| 35 // Performs any one off initialization for GL implementation. |
| 36 virtual bool InitializeGLOneOffPlatform() = 0; |
| 37 |
| 38 // Initializes static debug GL bindings. |
| 39 virtual void InitializeDebugGLBindings() = 0; |
| 40 |
| 41 // Clears static GL bindings. |
| 42 virtual void ClearGLBindings() = 0; |
| 43 |
| 44 // Returns information about the GL window system binding implementation (eg. |
| 45 // EGL, GLX, WGL). Returns true if the information was retrieved successfully. |
| 46 virtual bool GetGLWindowSystemBindingInfo( |
| 47 gl::GLWindowSystemBindingInfo* info) = 0; |
| 48 |
| 49 // Creates a GL context that is compatible with the given surface. |
| 50 // |share_group|, if not null, is a group of contexts which the internally |
| 51 // created OpenGL context shares textures and other resources. |
| 52 virtual scoped_refptr<gl::GLContext> CreateGLContext( |
| 53 gl::GLShareGroup* share_group, |
| 54 gl::GLSurface* compatible_surface, |
| 55 gl::GpuPreference gpu_preference) = 0; |
| 56 |
| 57 // Creates a GL surface that renders directly to a view. |
| 58 virtual scoped_refptr<gl::GLSurface> CreateViewGLSurface( |
| 59 gfx::AcceleratedWidget window) = 0; |
| 60 |
| 61 // Creates a GL surface that renders directly into a window with surfaceless |
| 62 // semantics. The surface is not backed by any buffers and is used for |
| 63 // overlay-only displays. This will return null if surfaceless mode is |
| 64 // unsupported. |
| 65 virtual scoped_refptr<gl::GLSurface> CreateSurfacelessViewGLSurface( |
| 66 gfx::AcceleratedWidget window) = 0; |
| 67 |
| 68 // Creates a GL surface used for offscreen rendering. |
| 69 virtual scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface( |
| 70 const gfx::Size& size) = 0; |
| 71 }; |
| 72 |
| 73 } // namespace ui |
| 74 |
| 75 #endif // UI_OZONE_PUBLIC_GL_OZONE_H_ |
OLD | NEW |