Chromium Code Reviews| 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 "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "third_party/khronos/EGL/egl.h" | 10 #include "third_party/khronos/EGL/egl.h" |
| (...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface( | 136 scoped_refptr<gl::GLSurface> CreateOffscreenGLSurface( |
| 137 const gfx::Size& size) override { | 137 const gfx::Size& size) override { |
| 138 return gl::InitializeGLSurface(new gl::PbufferGLSurfaceEGL(size)); | 138 return gl::InitializeGLSurface(new gl::PbufferGLSurfaceEGL(size)); |
| 139 } | 139 } |
| 140 | 140 |
| 141 protected: | 141 protected: |
| 142 intptr_t GetNativeDisplay() override { | 142 intptr_t GetNativeDisplay() override { |
| 143 return reinterpret_cast<intptr_t>(gfx::GetXDisplay()); | 143 return reinterpret_cast<intptr_t>(gfx::GetXDisplay()); |
| 144 } | 144 } |
| 145 | 145 |
| 146 bool LoadGLES2Bindings() override { return LoadDefaultEGLGLES2Bindings(); } | 146 bool LoadGLES2Bindings(gl::GLImplementation implementation) override { |
| 147 return LoadDefaultEGLGLES2Bindings(implementation); | |
| 148 } | |
| 147 | 149 |
| 148 private: | 150 private: |
| 149 DISALLOW_COPY_AND_ASSIGN(GLOzoneEGLX11); | 151 DISALLOW_COPY_AND_ASSIGN(GLOzoneEGLX11); |
| 150 }; | 152 }; |
| 151 | 153 |
| 152 } // namespace | 154 } // namespace |
| 153 | 155 |
| 154 X11SurfaceFactory::X11SurfaceFactory() | 156 X11SurfaceFactory::X11SurfaceFactory() |
| 155 : glx_implementation_(base::MakeUnique<GLOzoneGLX>()), | 157 : glx_implementation_(base::MakeUnique<GLOzoneGLX>()), |
| 156 egl_implementation_(base::MakeUnique<GLOzoneEGLX11>()), | 158 egl_implementation_(base::MakeUnique<GLOzoneEGLX11>()), |
| 157 osmesa_implementation_(base::MakeUnique<GLOzoneOSMesa>()) {} | 159 osmesa_implementation_(base::MakeUnique<GLOzoneOSMesa>()) {} |
| 158 | 160 |
| 159 X11SurfaceFactory::~X11SurfaceFactory() {} | 161 X11SurfaceFactory::~X11SurfaceFactory() {} |
| 160 | 162 |
| 161 std::vector<gl::GLImplementation> | 163 std::vector<gl::GLImplementation> |
| 162 X11SurfaceFactory::GetAllowedGLImplementations() { | 164 X11SurfaceFactory::GetAllowedGLImplementations() { |
| 163 // DesktopGL (GLX) should be the first option when crbug.com/646982 is fixed. | 165 // DesktopGL (GLX) should be the first option when crbug.com/646982 is fixed. |
| 164 return std::vector<gl::GLImplementation>{gl::kGLImplementationEGLGLES2, | 166 return std::vector<gl::GLImplementation>{ |
| 165 gl::kGLImplementationDesktopGL, | 167 gl::kGLImplementationEGLGLES2, gl::kGLImplementationDesktopGL, |
| 166 gl::kGLImplementationOSMesaGL}; | 168 gl::kGLImplementationOSMesaGL, gl::kGLImplementationSwiftShaderGL}; |
| 167 } | 169 } |
| 168 | 170 |
| 169 GLOzone* X11SurfaceFactory::GetGLOzone(gl::GLImplementation implementation) { | 171 GLOzone* X11SurfaceFactory::GetGLOzone(gl::GLImplementation implementation) { |
| 170 switch (implementation) { | 172 switch (implementation) { |
| 171 case gl::kGLImplementationDesktopGL: | 173 case gl::kGLImplementationDesktopGL: |
| 172 return glx_implementation_.get(); | 174 return glx_implementation_.get(); |
| 173 case gl::kGLImplementationEGLGLES2: | 175 case gl::kGLImplementationEGLGLES2: |
| 176 case gl::kGLImplementationSwiftShaderGL: | |
|
rjkroege
2017/06/12 17:23:40
it ought to be that the swiftshader oxygen build s
sadrul
2017/06/12 19:37:00
Yep.
tonikitoo
2017/06/12 19:39:00
Ok with me. Maybe add a comment in the code for th
| |
| 174 return egl_implementation_.get(); | 177 return egl_implementation_.get(); |
| 175 case gl::kGLImplementationOSMesaGL: | 178 case gl::kGLImplementationOSMesaGL: |
| 176 return osmesa_implementation_.get(); | 179 return osmesa_implementation_.get(); |
| 177 default: | 180 default: |
| 178 return nullptr; | 181 return nullptr; |
| 179 } | 182 } |
| 180 } | 183 } |
| 181 | 184 |
| 182 } // namespace ui | 185 } // namespace ui |
| OLD | NEW |