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 #include "ui/ozone/platform/x11/x11_surface_factory.h" | 5 #include "ui/ozone/platform/x11/x11_surface_factory.h" |
6 | 6 |
7 #include <X11/Xlib.h> | 7 #include <X11/Xlib.h> |
8 | 8 |
9 #include "third_party/khronos/EGL/egl.h" | 9 #include "third_party/khronos/EGL/egl.h" |
10 #include "ui/gfx/x/x11_types.h" | 10 #include "ui/gfx/x/x11_types.h" |
11 #include "ui/gl/egl_util.h" | 11 #include "ui/gl/egl_util.h" |
12 #include "ui/gl/gl_surface_egl.h" | 12 #include "ui/gl/gl_surface_egl.h" |
13 #include "ui/ozone/common/egl_util.h" | 13 #include "ui/ozone/common/egl_util.h" |
14 #include "ui/ozone/common/gl_ozone_egl.h" | 14 #include "ui/ozone/common/gl_ozone_egl.h" |
| 15 #include "ui/ozone/platform/x11/gl_ozone_glx.h" |
15 | 16 |
16 namespace ui { | 17 namespace ui { |
17 | 18 |
18 namespace { | 19 namespace { |
19 | 20 |
20 // GLSurface implementation for Ozone X11 EGL. | 21 // GLSurface implementation for Ozone X11 EGL. |
21 class GLSurfaceEGLOzoneX11 : public gl::NativeViewGLSurfaceEGL { | 22 class GLSurfaceEGLOzoneX11 : public gl::NativeViewGLSurfaceEGL { |
22 public: | 23 public: |
23 explicit GLSurfaceEGLOzoneX11(EGLNativeWindowType window); | 24 explicit GLSurfaceEGLOzoneX11(EGLNativeWindowType window); |
24 | 25 |
(...skipping 117 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 | 143 |
143 bool LoadGLES2Bindings() override { return LoadDefaultEGLGLES2Bindings(); } | 144 bool LoadGLES2Bindings() override { return LoadDefaultEGLGLES2Bindings(); } |
144 | 145 |
145 private: | 146 private: |
146 DISALLOW_COPY_AND_ASSIGN(GLOzoneEGLX11); | 147 DISALLOW_COPY_AND_ASSIGN(GLOzoneEGLX11); |
147 }; | 148 }; |
148 | 149 |
149 } // namespace | 150 } // namespace |
150 | 151 |
151 X11SurfaceFactory::X11SurfaceFactory() { | 152 X11SurfaceFactory::X11SurfaceFactory() { |
| 153 glx_implementation_.reset(new GLOzoneGLX()); |
152 egl_implementation_.reset(new GLOzoneEGLX11()); | 154 egl_implementation_.reset(new GLOzoneEGLX11()); |
153 } | 155 } |
154 | 156 |
155 X11SurfaceFactory::~X11SurfaceFactory() {} | 157 X11SurfaceFactory::~X11SurfaceFactory() {} |
156 | 158 |
157 std::vector<gl::GLImplementation> | 159 std::vector<gl::GLImplementation> |
158 X11SurfaceFactory::GetAllowedGLImplementations() { | 160 X11SurfaceFactory::GetAllowedGLImplementations() { |
159 std::vector<gl::GLImplementation> impls; | 161 std::vector<gl::GLImplementation> impls; |
| 162 impls.push_back(gl::kGLImplementationDesktopGL); |
160 impls.push_back(gl::kGLImplementationEGLGLES2); | 163 impls.push_back(gl::kGLImplementationEGLGLES2); |
161 impls.push_back(gl::kGLImplementationOSMesaGL); | 164 impls.push_back(gl::kGLImplementationOSMesaGL); |
162 return impls; | 165 return impls; |
163 } | 166 } |
164 | 167 |
165 GLOzone* X11SurfaceFactory::GetGLOzone(gl::GLImplementation implementation) { | 168 GLOzone* X11SurfaceFactory::GetGLOzone(gl::GLImplementation implementation) { |
166 switch (implementation) { | 169 switch (implementation) { |
| 170 case gl::kGLImplementationDesktopGL: |
| 171 return glx_implementation_.get(); |
167 case gl::kGLImplementationEGLGLES2: | 172 case gl::kGLImplementationEGLGLES2: |
168 return egl_implementation_.get(); | 173 return egl_implementation_.get(); |
169 default: | 174 default: |
170 return nullptr; | 175 return nullptr; |
171 } | 176 } |
172 } | 177 } |
173 | 178 |
174 } // namespace ui | 179 } // namespace ui |
OLD | NEW |