Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(762)

Side by Side Diff: ui/gl/init/gl_factory_android.cc

Issue 2189233003: Move last of platform dependent init from //ui/gl to //ui/gl/init. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix return values. Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ui/gl/init/gl_factory.cc ('k') | ui/gl/init/gl_factory_mac.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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_bindings.h" 9 #include "ui/gl/gl_bindings.h"
10 #include "ui/gl/gl_context.h" 10 #include "ui/gl/gl_context.h"
11 #include "ui/gl/gl_context_egl.h" 11 #include "ui/gl/gl_context_egl.h"
12 #include "ui/gl/gl_context_osmesa.h" 12 #include "ui/gl/gl_context_osmesa.h"
13 #include "ui/gl/gl_context_stub.h" 13 #include "ui/gl/gl_context_stub.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_stub.h" 20 #include "ui/gl/gl_surface_stub.h"
20 21
21 namespace gl { 22 namespace gl {
22 namespace init { 23 namespace init {
23 24
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 std::string GLNonOwnedContext::GetExtensions() { 68 std::string GLNonOwnedContext::GetExtensions() {
68 const char* extensions = eglQueryString(display_, EGL_EXTENSIONS); 69 const char* extensions = eglQueryString(display_, EGL_EXTENSIONS);
69 if (!extensions) 70 if (!extensions)
70 return GLContext::GetExtensions(); 71 return GLContext::GetExtensions();
71 72
72 return GLContext::GetExtensions() + " " + extensions; 73 return GLContext::GetExtensions() + " " + extensions;
73 } 74 }
74 75
75 } // namespace 76 } // namespace
76 77
78 std::vector<GLImplementation> GetAllowedGLImplementations() {
79 std::vector<GLImplementation> impls;
80 impls.push_back(kGLImplementationEGLGLES2);
81 impls.push_back(kGLImplementationOSMesaGL);
82 return impls;
83 }
84
85 bool GetGLWindowSystemBindingInfo(GLWindowSystemBindingInfo* info) {
86 switch (GetGLImplementation()) {
87 case kGLImplementationEGLGLES2:
88 return GetGLWindowSystemBindingInfoEGL(info);
89 default:
90 return false;
91 }
92 }
93
77 scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group, 94 scoped_refptr<GLContext> CreateGLContext(GLShareGroup* share_group,
78 GLSurface* compatible_surface, 95 GLSurface* compatible_surface,
79 GpuPreference gpu_preference) { 96 GpuPreference gpu_preference) {
80 TRACE_EVENT0("gpu", "gl::init::CreateGLContext"); 97 TRACE_EVENT0("gpu", "gl::init::CreateGLContext");
81 switch (GetGLImplementation()) { 98 switch (GetGLImplementation()) {
82 case kGLImplementationMockGL: 99 case kGLImplementationMockGL:
83 return scoped_refptr<GLContext>(new GLContextStub(share_group)); 100 return scoped_refptr<GLContext>(new GLContextStub(share_group));
84 case kGLImplementationOSMesaGL: 101 case kGLImplementationOSMesaGL:
85 return InitializeGLContext(new GLContextOSMesa(share_group), 102 return InitializeGLContext(new GLContextOSMesa(share_group),
86 compatible_surface, gpu_preference); 103 compatible_surface, gpu_preference);
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after
133 case kGLImplementationMockGL: 150 case kGLImplementationMockGL:
134 return new GLSurfaceStub; 151 return new GLSurfaceStub;
135 default: 152 default:
136 NOTREACHED(); 153 NOTREACHED();
137 return nullptr; 154 return nullptr;
138 } 155 }
139 } 156 }
140 157
141 } // namespace init 158 } // namespace init
142 } // namespace gl 159 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/init/gl_factory.cc ('k') | ui/gl/init/gl_factory_mac.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698