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

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

Issue 2629633003: Refactor GL bindings so there is no global GLApi or DriverGL. (Closed)
Patch Set: rebase Created 3 years, 10 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_android.cc ('k') | ui/gl/init/gl_factory_ozone.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/macros.h" 8 #include "base/macros.h"
9 #include "base/trace_event/trace_event.h" 9 #include "base/trace_event/trace_event.h"
10 #include "ui/gl/gl_bindings.h" 10 #include "ui/gl/gl_bindings.h"
(...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after
80 // a different onscreen surface with this context later. But we should 80 // a different onscreen surface with this context later. But we should
81 // always be creating the context with an offscreen surface first. 81 // always be creating the context with an offscreen surface first.
82 DCHECK(compatible_surface->IsOffscreen()); 82 DCHECK(compatible_surface->IsOffscreen());
83 return InitializeGLContext(new GLContextCGL(share_group), 83 return InitializeGLContext(new GLContextCGL(share_group),
84 compatible_surface, attribs); 84 compatible_surface, attribs);
85 case kGLImplementationOSMesaGL: 85 case kGLImplementationOSMesaGL:
86 return InitializeGLContext(new GLContextOSMesa(share_group), 86 return InitializeGLContext(new GLContextOSMesa(share_group),
87 compatible_surface, attribs); 87 compatible_surface, attribs);
88 case kGLImplementationMockGL: 88 case kGLImplementationMockGL:
89 return new GLContextStub(share_group); 89 return new GLContextStub(share_group);
90 case kGLImplementationStubGL: {
91 scoped_refptr<GLContextStub> stub_context =
92 new GLContextStub(share_group);
93 stub_context->SetUseStubApi(true);
94 return stub_context;
95 }
90 default: 96 default:
91 NOTREACHED(); 97 NOTREACHED();
92 return nullptr; 98 return nullptr;
93 } 99 }
94 } 100 }
95 101
96 scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) { 102 scoped_refptr<GLSurface> CreateViewGLSurface(gfx::AcceleratedWidget window) {
97 TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface"); 103 TRACE_EVENT0("gpu", "gl::init::CreateViewGLSurface");
98 switch (GetGLImplementation()) { 104 switch (GetGLImplementation()) {
99 case kGLImplementationDesktopGL: 105 case kGLImplementationDesktopGL:
100 case kGLImplementationDesktopGLCoreProfile: 106 case kGLImplementationDesktopGLCoreProfile:
101 case kGLImplementationAppleGL: { 107 case kGLImplementationAppleGL: {
102 NOTIMPLEMENTED() << "No onscreen support on Mac."; 108 NOTIMPLEMENTED() << "No onscreen support on Mac.";
103 return nullptr; 109 return nullptr;
104 } 110 }
105 case kGLImplementationOSMesaGL: { 111 case kGLImplementationOSMesaGL: {
106 return InitializeGLSurface(new GLSurfaceOSMesaHeadless()); 112 return InitializeGLSurface(new GLSurfaceOSMesaHeadless());
107 } 113 }
108 case kGLImplementationMockGL: 114 case kGLImplementationMockGL:
115 case kGLImplementationStubGL:
109 return new GLSurfaceStub; 116 return new GLSurfaceStub;
110 default: 117 default:
111 NOTREACHED(); 118 NOTREACHED();
112 return nullptr; 119 return nullptr;
113 } 120 }
114 } 121 }
115 122
116 scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat( 123 scoped_refptr<GLSurface> CreateOffscreenGLSurfaceWithFormat(
117 const gfx::Size& size, GLSurfaceFormat format) { 124 const gfx::Size& size, GLSurfaceFormat format) {
118 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface"); 125 TRACE_EVENT0("gpu", "gl::init::CreateOffscreenGLSurface");
119 switch (GetGLImplementation()) { 126 switch (GetGLImplementation()) {
120 case kGLImplementationOSMesaGL: 127 case kGLImplementationOSMesaGL:
121 format.SetDefaultPixelLayout(GLSurfaceFormat::PIXEL_LAYOUT_RGBA); 128 format.SetDefaultPixelLayout(GLSurfaceFormat::PIXEL_LAYOUT_RGBA);
122 return InitializeGLSurfaceWithFormat( 129 return InitializeGLSurfaceWithFormat(
123 new GLSurfaceOSMesa(format, size), format); 130 new GLSurfaceOSMesa(format, size), format);
124 case kGLImplementationDesktopGL: 131 case kGLImplementationDesktopGL:
125 case kGLImplementationDesktopGLCoreProfile: 132 case kGLImplementationDesktopGLCoreProfile:
126 case kGLImplementationAppleGL: 133 case kGLImplementationAppleGL:
127 return InitializeGLSurfaceWithFormat( 134 return InitializeGLSurfaceWithFormat(
128 new NoOpGLSurface(size), format); 135 new NoOpGLSurface(size), format);
129 case kGLImplementationMockGL: 136 case kGLImplementationMockGL:
137 case kGLImplementationStubGL:
130 return new GLSurfaceStub; 138 return new GLSurfaceStub;
131 default: 139 default:
132 NOTREACHED(); 140 NOTREACHED();
133 return nullptr; 141 return nullptr;
134 } 142 }
135 } 143 }
136 144
137 } // namespace init 145 } // namespace init
138 } // namespace gl 146 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/init/gl_factory_android.cc ('k') | ui/gl/init/gl_factory_ozone.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698