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

Side by Side Diff: ui/gl/gl_context_cgl.cc

Issue 2497503004: Revert of Refactor context creation parameters into a struct. (Closed)
Patch Set: Created 4 years, 1 month 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/gl_context_cgl.h ('k') | ui/gl/gl_context_egl.h » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/gl_context_cgl.h" 5 #include "ui/gl/gl_context_cgl.h"
6 6
7 #include <OpenGL/CGLRenderers.h> 7 #include <OpenGL/CGLRenderers.h>
8 #include <OpenGL/CGLTypes.h> 8 #include <OpenGL/CGLTypes.h>
9 9
10 #include <memory> 10 #include <memory>
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
84 : GLContextReal(share_group), 84 : GLContextReal(share_group),
85 context_(nullptr), 85 context_(nullptr),
86 gpu_preference_(PreferIntegratedGpu), 86 gpu_preference_(PreferIntegratedGpu),
87 discrete_pixelformat_(nullptr), 87 discrete_pixelformat_(nullptr),
88 screen_(-1), 88 screen_(-1),
89 renderer_id_(-1), 89 renderer_id_(-1),
90 safe_to_force_gpu_switch_(true) { 90 safe_to_force_gpu_switch_(true) {
91 } 91 }
92 92
93 bool GLContextCGL::Initialize(GLSurface* compatible_surface, 93 bool GLContextCGL::Initialize(GLSurface* compatible_surface,
94 const GLContextAttribs& attribs) { 94 GpuPreference gpu_preference) {
95 DCHECK(compatible_surface); 95 DCHECK(compatible_surface);
96 96
97 // webgl_compatibility_context and disabling bind_generates_resource are not 97 gpu_preference = ui::GpuSwitchingManager::GetInstance()->AdjustGpuPreference(
98 // supported. 98 gpu_preference);
99 DCHECK(!attribs.webgl_compatibility_context &&
100 attribs.bind_generates_resource);
101
102 GpuPreference gpu_preference =
103 ui::GpuSwitchingManager::GetInstance()->AdjustGpuPreference(
104 attribs.gpu_preference);
105 99
106 GLContextCGL* share_context = share_group() ? 100 GLContextCGL* share_context = share_group() ?
107 static_cast<GLContextCGL*>(share_group()->GetContext()) : nullptr; 101 static_cast<GLContextCGL*>(share_group()->GetContext()) : nullptr;
108 102
109 CGLPixelFormatObj format = GetPixelFormat(); 103 CGLPixelFormatObj format = GetPixelFormat();
110 if (!format) 104 if (!format)
111 return false; 105 return false;
112 106
113 // If using the discrete gpu, create a pixel format requiring it before we 107 // If using the discrete gpu, create a pixel format requiring it before we
114 // create the context. 108 // create the context.
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 281
288 GLContextCGL::~GLContextCGL() { 282 GLContextCGL::~GLContextCGL() {
289 Destroy(); 283 Destroy();
290 } 284 }
291 285
292 GpuPreference GLContextCGL::GetGpuPreference() { 286 GpuPreference GLContextCGL::GetGpuPreference() {
293 return gpu_preference_; 287 return gpu_preference_;
294 } 288 }
295 289
296 } // namespace gl 290 } // namespace gl
OLDNEW
« no previous file with comments | « ui/gl/gl_context_cgl.h ('k') | ui/gl/gl_context_egl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698