| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/accelerated_widget_mac/io_surface_context.h" | 5 #include "ui/accelerated_widget_mac/io_surface_context.h" |
| 6 | 6 |
| 7 #include <OpenGL/gl.h> | 7 #include <OpenGL/gl.h> |
| 8 #include <OpenGL/OpenGL.h> | 8 #include <OpenGL/OpenGL.h> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 17 matching lines...) Expand all Loading... |
| 28 return found->second; | 28 return found->second; |
| 29 } | 29 } |
| 30 | 30 |
| 31 base::ScopedTypeRef<CGLContextObj> cgl_context; | 31 base::ScopedTypeRef<CGLContextObj> cgl_context; |
| 32 CGLError error = kCGLNoError; | 32 CGLError error = kCGLNoError; |
| 33 | 33 |
| 34 // Create the pixel format object for the context. | 34 // Create the pixel format object for the context. |
| 35 std::vector<CGLPixelFormatAttribute> attribs; | 35 std::vector<CGLPixelFormatAttribute> attribs; |
| 36 attribs.push_back(kCGLPFADepthSize); | 36 attribs.push_back(kCGLPFADepthSize); |
| 37 attribs.push_back(static_cast<CGLPixelFormatAttribute>(0)); | 37 attribs.push_back(static_cast<CGLPixelFormatAttribute>(0)); |
| 38 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) { | 38 if (ui::GpuSwitchingManager::GetInstance()->SupportsDualGpus()) |
| 39 attribs.push_back(kCGLPFAAllowOfflineRenderers); | 39 attribs.push_back(kCGLPFAAllowOfflineRenderers); |
| 40 attribs.push_back(static_cast<CGLPixelFormatAttribute>(1)); | |
| 41 } | |
| 42 attribs.push_back(static_cast<CGLPixelFormatAttribute>(0)); | 40 attribs.push_back(static_cast<CGLPixelFormatAttribute>(0)); |
| 43 GLint number_virtual_screens = 0; | 41 GLint number_virtual_screens = 0; |
| 44 base::ScopedTypeRef<CGLPixelFormatObj> pixel_format; | 42 base::ScopedTypeRef<CGLPixelFormatObj> pixel_format; |
| 45 error = CGLChoosePixelFormat(&attribs.front(), | 43 error = CGLChoosePixelFormat(&attribs.front(), |
| 46 pixel_format.InitializeInto(), | 44 pixel_format.InitializeInto(), |
| 47 &number_virtual_screens); | 45 &number_virtual_screens); |
| 48 if (error != kCGLNoError) { | 46 if (error != kCGLNoError) { |
| 49 LOG(ERROR) << "Failed to create pixel format object."; | 47 LOG(ERROR) << "Failed to create pixel format object."; |
| 50 return NULL; | 48 return NULL; |
| 51 } | 49 } |
| (...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 111 IOSurfaceContext::TypeMap* | 109 IOSurfaceContext::TypeMap* |
| 112 IOSurfaceContext::type_map() { | 110 IOSurfaceContext::type_map() { |
| 113 return type_map_.Pointer(); | 111 return type_map_.Pointer(); |
| 114 } | 112 } |
| 115 | 113 |
| 116 // static | 114 // static |
| 117 base::LazyInstance<IOSurfaceContext::TypeMap> | 115 base::LazyInstance<IOSurfaceContext::TypeMap> |
| 118 IOSurfaceContext::type_map_; | 116 IOSurfaceContext::type_map_; |
| 119 | 117 |
| 120 } // namespace ui | 118 } // namespace ui |
| OLD | NEW |