| 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_context_wgl.h" | 13 #include "ui/gl/gl_context_wgl.h" |
| 14 #include "ui/gl/gl_egl_api_implementation.h" |
| 14 #include "ui/gl/gl_implementation.h" | 15 #include "ui/gl/gl_implementation.h" |
| 15 #include "ui/gl/gl_share_group.h" | 16 #include "ui/gl/gl_share_group.h" |
| 16 #include "ui/gl/gl_surface.h" | 17 #include "ui/gl/gl_surface.h" |
| 17 #include "ui/gl/gl_surface_egl.h" | 18 #include "ui/gl/gl_surface_egl.h" |
| 18 #include "ui/gl/gl_surface_osmesa.h" | 19 #include "ui/gl/gl_surface_osmesa.h" |
| 19 #include "ui/gl/gl_surface_osmesa_win.h" | 20 #include "ui/gl/gl_surface_osmesa_win.h" |
| 20 #include "ui/gl/gl_surface_stub.h" | 21 #include "ui/gl/gl_surface_stub.h" |
| 21 #include "ui/gl/gl_surface_wgl.h" | 22 #include "ui/gl/gl_surface_wgl.h" |
| 23 #include "ui/gl/gl_wgl_api_implementation.h" |
| 22 #include "ui/gl/vsync_provider_win.h" | 24 #include "ui/gl/vsync_provider_win.h" |
| 23 | 25 |
| 24 namespace gl { | 26 namespace gl { |
| 25 namespace init { | 27 namespace init { |
| 26 | 28 |
| 29 std::vector<GLImplementation> GetAllowedGLImplementations() { |
| 30 std::vector<GLImplementation> impls; |
| 31 impls.push_back(kGLImplementationEGLGLES2); |
| 32 impls.push_back(kGLImplementationDesktopGL); |
| 33 impls.push_back(kGLImplementationOSMesaGL); |
| 34 return impls; |
| 35 } |
| 36 |
| 37 bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) { |
| 38 switch (GetGLImplementation()) { |
| 39 case kGLImplementationDesktopGL: |
| 40 return GetGLWindowSystemBindingInfoWGL(info); |
| 41 case kGLImplementationEGLGLES2: |
| 42 return GetGLWindowSystemBindingInfoEGL(info); |
| 43 default: |
| 44 return false; |
| 45 } |
| 46 } |
| 47 |
| 27 scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group, | 48 scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group, |
| 28 GLSurface* compatible_surface, | 49 GLSurface* compatible_surface, |
| 29 GpuPreference gpu_preference) { | 50 GpuPreference gpu_preference) { |
| 30 TRACE_EVENT0("gpu", "gl::init::CreateGLContext"); | 51 TRACE_EVENT0("gpu", "gl::init::CreateGLContext"); |
| 31 switch (GetGLImplementation()) { | 52 switch (GetGLImplementation()) { |
| 32 case kGLImplementationOSMesaGL: | 53 case kGLImplementationOSMesaGL: |
| 33 return InitializeGLContext(new GLContextOSMesa(share_group), | 54 return InitializeGLContext(new GLContextOSMesa(share_group), |
| 34 compatible_surface, gpu_preference); | 55 compatible_surface, gpu_preference); |
| 35 case kGLImplementationEGLGLES2: | 56 case kGLImplementationEGLGLES2: |
| 36 return InitializeGLContext(new GLContextEGL(share_group), | 57 return InitializeGLContext(new GLContextEGL(share_group), |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 85 case kGLImplementationMockGL: | 106 case kGLImplementationMockGL: |
| 86 return new GLSurfaceStub; | 107 return new GLSurfaceStub; |
| 87 default: | 108 default: |
| 88 NOTREACHED(); | 109 NOTREACHED(); |
| 89 return nullptr; | 110 return nullptr; |
| 90 } | 111 } |
| 91 } | 112 } |
| 92 | 113 |
| 93 } // namespace init | 114 } // namespace init |
| 94 } // namespace gl | 115 } // namespace gl |
| OLD | NEW |