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

Side by Side Diff: ui/gfx/gl/gl_context_wgl.cc

Issue 8233027: Support dynamic switching between integrated and discrete GPUs on Mac OS X. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 9 years, 2 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 | Annotate | Revision Log
« no previous file with comments | « ui/gfx/gl/gl_context_wgl.h ('k') | ui/gfx/gl/gl_context_win.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 // This file implements the GLContextWGL and PbufferGLContext classes. 5 // This file implements the GLContextWGL and PbufferGLContext classes.
6 6
7 #include "ui/gfx/gl/gl_context_wgl.h" 7 #include "ui/gfx/gl/gl_context_wgl.h"
8 8
9 #include "base/logging.h" 9 #include "base/logging.h"
10 #include "ui/gfx/gl/gl_bindings.h" 10 #include "ui/gfx/gl/gl_bindings.h"
(...skipping 19 matching lines...) Expand all
30 const char* extensions = wglGetExtensionsStringARB( 30 const char* extensions = wglGetExtensionsStringARB(
31 GLSurfaceWGL::GetDisplay()); 31 GLSurfaceWGL::GetDisplay());
32 if (extensions) { 32 if (extensions) {
33 return GLContext::GetExtensions() + " " + extensions; 33 return GLContext::GetExtensions() + " " + extensions;
34 } 34 }
35 } 35 }
36 36
37 return GLContext::GetExtensions(); 37 return GLContext::GetExtensions();
38 } 38 }
39 39
40 bool GLContextWGL::Initialize(GLSurface* compatible_surface) { 40 bool GLContextWGL::Initialize(
41 GLSurface* compatible_surface, GpuPreference gpu_preference) {
41 GLSurfaceWGL* surface_wgl = static_cast<GLSurfaceWGL*>(compatible_surface); 42 GLSurfaceWGL* surface_wgl = static_cast<GLSurfaceWGL*>(compatible_surface);
42 43
43 // TODO(apatrick): When contexts and surfaces are separated, we won't be 44 // TODO(apatrick): When contexts and surfaces are separated, we won't be
44 // able to use surface_ here. Either use a display device context or a 45 // able to use surface_ here. Either use a display device context or a
45 // surface that the context is compatible with not necessarily limited to 46 // surface that the context is compatible with not necessarily limited to
46 // rendering to. 47 // rendering to.
47 context_ = wglCreateContext(static_cast<HDC>(surface_wgl->GetHandle())); 48 context_ = wglCreateContext(static_cast<HDC>(surface_wgl->GetHandle()));
48 if (!context_) { 49 if (!context_) {
49 LOG(ERROR) << "Failed to create GL context."; 50 LOG(ERROR) << "Failed to create GL context.";
50 Destroy(); 51 Destroy();
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 if (HasExtension("WGL_EXT_swap_control") && wglSwapIntervalEXT) { 125 if (HasExtension("WGL_EXT_swap_control") && wglSwapIntervalEXT) {
125 wglSwapIntervalEXT(interval); 126 wglSwapIntervalEXT(interval);
126 } else { 127 } else {
127 LOG(WARNING) << 128 LOG(WARNING) <<
128 "Could not disable vsync: driver does not " 129 "Could not disable vsync: driver does not "
129 "support WGL_EXT_swap_control"; 130 "support WGL_EXT_swap_control";
130 } 131 }
131 } 132 }
132 133
133 } // namespace gfx 134 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/gl/gl_context_wgl.h ('k') | ui/gfx/gl/gl_context_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698