OLD | NEW |
---|---|
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 Loading... | |
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 GpuPreference gpu_preference) { | 94 const GLContextAttribs& attribs) { |
piman
2016/11/07 21:01:01
Here and other context types: I think we should fa
Geoff Lang
2016/11/07 21:36:21
Done, I used a DCHECK but can change it to a failu
| |
95 DCHECK(compatible_surface); | 95 DCHECK(compatible_surface); |
96 | 96 |
97 gpu_preference = ui::GpuSwitchingManager::GetInstance()->AdjustGpuPreference( | 97 GpuPreference gpu_preference = |
98 gpu_preference); | 98 ui::GpuSwitchingManager::GetInstance()->AdjustGpuPreference( |
99 attribs.gpu_preference); | |
99 | 100 |
100 GLContextCGL* share_context = share_group() ? | 101 GLContextCGL* share_context = share_group() ? |
101 static_cast<GLContextCGL*>(share_group()->GetContext()) : nullptr; | 102 static_cast<GLContextCGL*>(share_group()->GetContext()) : nullptr; |
102 | 103 |
103 CGLPixelFormatObj format = GetPixelFormat(); | 104 CGLPixelFormatObj format = GetPixelFormat(); |
104 if (!format) | 105 if (!format) |
105 return false; | 106 return false; |
106 | 107 |
107 // If using the discrete gpu, create a pixel format requiring it before we | 108 // If using the discrete gpu, create a pixel format requiring it before we |
108 // create the context. | 109 // create the context. |
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
281 | 282 |
282 GLContextCGL::~GLContextCGL() { | 283 GLContextCGL::~GLContextCGL() { |
283 Destroy(); | 284 Destroy(); |
284 } | 285 } |
285 | 286 |
286 GpuPreference GLContextCGL::GetGpuPreference() { | 287 GpuPreference GLContextCGL::GetGpuPreference() { |
287 return gpu_preference_; | 288 return gpu_preference_; |
288 } | 289 } |
289 | 290 |
290 } // namespace gl | 291 } // namespace gl |
OLD | NEW |