| 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/gl/init/gl_factory.h" | 5 #include "ui/gl/init/gl_factory.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/trace_event/trace_event.h" | 8 #include "base/trace_event/trace_event.h" |
| 9 #include "ui/gl/gl_context.h" | 9 #include "ui/gl/gl_context.h" |
| 10 #include "ui/gl/gl_context_egl.h" | 10 #include "ui/gl/gl_context_egl.h" |
| 11 #include "ui/gl/gl_context_osmesa.h" | 11 #include "ui/gl/gl_context_osmesa.h" |
| 12 #include "ui/gl/gl_context_stub.h" | 12 #include "ui/gl/gl_context_stub.h" |
| 13 #include "ui/gl/gl_egl_api_implementation.h" |
| 13 #include "ui/gl/gl_implementation.h" | 14 #include "ui/gl/gl_implementation.h" |
| 14 #include "ui/gl/gl_share_group.h" | 15 #include "ui/gl/gl_share_group.h" |
| 15 #include "ui/gl/gl_surface.h" | 16 #include "ui/gl/gl_surface.h" |
| 16 #include "ui/gl/gl_surface_egl.h" | 17 #include "ui/gl/gl_surface_egl.h" |
| 17 #include "ui/gl/gl_surface_osmesa.h" | 18 #include "ui/gl/gl_surface_osmesa.h" |
| 18 #include "ui/gl/gl_surface_stub.h" | 19 #include "ui/gl/gl_surface_stub.h" |
| 19 #include "ui/gl/init/gl_surface_ozone.h" | 20 #include "ui/gl/init/gl_surface_ozone.h" |
| 20 #include "ui/ozone/public/ozone_platform.h" | 21 #include "ui/ozone/public/ozone_platform.h" |
| 21 #include "ui/ozone/public/surface_factory_ozone.h" | 22 #include "ui/ozone/public/surface_factory_ozone.h" |
| 22 #include "ui/ozone/public/surface_ozone_egl.h" | 23 #include "ui/ozone/public/surface_ozone_egl.h" |
| (...skipping 61 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 84 return InitializeGLSurface(new PbufferGLSurfaceEGL(size)); | 85 return InitializeGLSurface(new PbufferGLSurfaceEGL(size)); |
| 85 } | 86 } |
| 86 default: | 87 default: |
| 87 NOTREACHED(); | 88 NOTREACHED(); |
| 88 } | 89 } |
| 89 return nullptr; | 90 return nullptr; |
| 90 } | 91 } |
| 91 | 92 |
| 92 } // namespace | 93 } // namespace |
| 93 | 94 |
| 95 std::vector<GLImplementation> GetAllowedGLImplementations() { |
| 96 std::vector<GLImplementation> impls; |
| 97 impls.push_back(kGLImplementationEGLGLES2); |
| 98 impls.push_back(kGLImplementationOSMesaGL); |
| 99 return impls; |
| 100 } |
| 101 |
| 102 bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) { |
| 103 switch (GetGLImplementation()) { |
| 104 case kGLImplementationEGLGLES2: |
| 105 return GetGLWindowSystemBindingInfoEGL(info); |
| 106 default: |
| 107 return false; |
| 108 } |
| 109 } |
| 110 |
| 94 scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group, | 111 scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group, |
| 95 GLSurface* compatible_surface, | 112 GLSurface* compatible_surface, |
| 96 GpuPreference gpu_preference) { | 113 GpuPreference gpu_preference) { |
| 97 TRACE_EVENT0("gpu", "gl::init::CreateGLContext"); | 114 TRACE_EVENT0("gpu", "gl::init::CreateGLContext"); |
| 98 switch (GetGLImplementation()) { | 115 switch (GetGLImplementation()) { |
| 99 case kGLImplementationMockGL: | 116 case kGLImplementationMockGL: |
| 100 return scoped_refptr<GLContext>(new GLContextStub(share_group)); | 117 return scoped_refptr<GLContext>(new GLContextStub(share_group)); |
| 101 case kGLImplementationOSMesaGL: | 118 case kGLImplementationOSMesaGL: |
| 102 return InitializeGLContext(new GLContextOSMesa(share_group), | 119 return InitializeGLContext(new GLContextOSMesa(share_group), |
| 103 compatible_surface, gpu_preference); | 120 compatible_surface, gpu_preference); |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 142 // TODO(kylechar): This is deprecated, remove when possible. | 159 // TODO(kylechar): This is deprecated, remove when possible. |
| 143 if (!GetSurfaceFactory()->UseNewSurfaceAPI()) | 160 if (!GetSurfaceFactory()->UseNewSurfaceAPI()) |
| 144 return CreateOffscreenGLSurfaceOld(size); | 161 return CreateOffscreenGLSurfaceOld(size); |
| 145 | 162 |
| 146 return GetSurfaceFactory()->CreateOffscreenGLSurface(GetGLImplementation(), | 163 return GetSurfaceFactory()->CreateOffscreenGLSurface(GetGLImplementation(), |
| 147 size); | 164 size); |
| 148 } | 165 } |
| 149 | 166 |
| 150 } // namespace init | 167 } // namespace init |
| 151 } // namespace gl | 168 } // namespace gl |
| OLD | NEW |