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/trace_event/trace_event.h" | 7 #include "base/trace_event/trace_event.h" |
8 #include "ui/gl/gl_context.h" | 8 #include "ui/gl/gl_context.h" |
9 #include "ui/gl/gl_context_egl.h" | 9 #include "ui/gl/gl_context_egl.h" |
10 #include "ui/gl/gl_context_glx.h" | 10 #include "ui/gl/gl_context_glx.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_egl_api_implementation.h" |
14 #include "ui/gl/gl_glx_api_implementation.h" | 14 #include "ui/gl/gl_glx_api_implementation.h" |
15 #include "ui/gl/gl_implementation.h" | 15 #include "ui/gl/gl_implementation.h" |
16 #include "ui/gl/gl_share_group.h" | 16 #include "ui/gl/gl_share_group.h" |
17 #include "ui/gl/gl_surface.h" | 17 #include "ui/gl/gl_surface.h" |
18 #include "ui/gl/gl_surface_egl.h" | 18 #include "ui/gl/gl_surface_egl.h" |
19 #include "ui/gl/gl_surface_egl_x11.h" | 19 #include "ui/gl/gl_surface_egl_x11.h" |
20 #include "ui/gl/gl_surface_glx.h" | 20 #include "ui/gl/gl_surface_glx.h" |
| 21 #include "ui/gl/gl_surface_glx_x11.h" |
21 #include "ui/gl/gl_surface_osmesa.h" | 22 #include "ui/gl/gl_surface_osmesa.h" |
22 #include "ui/gl/gl_surface_osmesa_x11.h" | 23 #include "ui/gl/gl_surface_osmesa_x11.h" |
23 #include "ui/gl/gl_surface_stub.h" | 24 #include "ui/gl/gl_surface_stub.h" |
24 | 25 |
25 namespace gl { | 26 namespace gl { |
26 namespace init { | 27 namespace init { |
27 | 28 |
28 std::vector<GLImplementation> GetAllowedGLImplementations() { | 29 std::vector<GLImplementation> GetAllowedGLImplementations() { |
29 std::vector<GLImplementation> impls; | 30 std::vector<GLImplementation> impls; |
30 impls.push_back(kGLImplementationDesktopGL); | 31 impls.push_back(kGLImplementationDesktopGL); |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 return nullptr; | 66 return nullptr; |
66 } | 67 } |
67 } | 68 } |
68 | 69 |
69 scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) { | 70 scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) { |
70 TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface"); | 71 TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface"); |
71 switch (GetGLImplementation()) { | 72 switch (GetGLImplementation()) { |
72 case kGLImplementationOSMesaGL: | 73 case kGLImplementationOSMesaGL: |
73 return InitializeGLSurface(new GLSurfaceOSMesaX11(window)); | 74 return InitializeGLSurface(new GLSurfaceOSMesaX11(window)); |
74 case kGLImplementationDesktopGL: | 75 case kGLImplementationDesktopGL: |
75 return InitializeGLSurface(new NativeViewGLSurfaceGLX(window)); | 76 return InitializeGLSurface(new GLSurfaceGLXX11(window)); |
76 case kGLImplementationEGLGLES2: | 77 case kGLImplementationEGLGLES2: |
77 DCHECK(window != gfx::kNullAcceleratedWidget); | 78 DCHECK(window != gfx::kNullAcceleratedWidget); |
78 return InitializeGLSurface(new NativeViewGLSurfaceEGLX11(window)); | 79 return InitializeGLSurface(new NativeViewGLSurfaceEGLX11(window)); |
79 case kGLImplementationMockGL: | 80 case kGLImplementationMockGL: |
80 return new GLSurfaceStub; | 81 return new GLSurfaceStub; |
81 default: | 82 default: |
82 NOTREACHED(); | 83 NOTREACHED(); |
83 return nullptr; | 84 return nullptr; |
84 } | 85 } |
85 } | 86 } |
(...skipping 11 matching lines...) Expand all Loading... |
97 case kGLImplementationMockGL: | 98 case kGLImplementationMockGL: |
98 return new GLSurfaceStub; | 99 return new GLSurfaceStub; |
99 default: | 100 default: |
100 NOTREACHED(); | 101 NOTREACHED(); |
101 return nullptr; | 102 return nullptr; |
102 } | 103 } |
103 } | 104 } |
104 | 105 |
105 } // namespace init | 106 } // namespace init |
106 } // namespace gl | 107 } // namespace gl |
OLD | NEW |