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

Side by Side Diff: ui/gfx/gl/gl_context_osmesa.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_osmesa.h ('k') | ui/gfx/gl/gl_context_stub.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) 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 #include <GL/osmesa.h> 5 #include <GL/osmesa.h>
6 6
7 #include "ui/gfx/gl/gl_context_osmesa.h" 7 #include "ui/gfx/gl/gl_context_osmesa.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"
11 #include "ui/gfx/gl/gl_surface_osmesa.h" 11 #include "ui/gfx/gl/gl_surface_osmesa.h"
12 12
13 namespace gfx { 13 namespace gfx {
14 14
15 GLContextOSMesa::GLContextOSMesa(GLShareGroup* share_group) 15 GLContextOSMesa::GLContextOSMesa(GLShareGroup* share_group)
16 : GLContext(share_group), 16 : GLContext(share_group),
17 context_(NULL) { 17 context_(NULL) {
18 } 18 }
19 19
20 GLContextOSMesa::~GLContextOSMesa() { 20 GLContextOSMesa::~GLContextOSMesa() {
21 Destroy(); 21 Destroy();
22 } 22 }
23 23
24 bool GLContextOSMesa::Initialize(GLSurface* compatible_surface) { 24 bool GLContextOSMesa::Initialize(
25 GLSurface* compatible_surface, GpuPreference gpu_preference) {
25 DCHECK(!context_); 26 DCHECK(!context_);
26 27
27 OSMesaContext share_handle = static_cast<OSMesaContext>( 28 OSMesaContext share_handle = static_cast<OSMesaContext>(
28 share_group() ? share_group()->GetHandle() : NULL); 29 share_group() ? share_group()->GetHandle() : NULL);
29 30
30 GLuint format = 31 GLuint format =
31 static_cast<GLSurfaceOSMesa*>(compatible_surface)->GetFormat(); 32 static_cast<GLSurfaceOSMesa*>(compatible_surface)->GetFormat();
32 DCHECK_NE(format, (unsigned)0); 33 DCHECK_NE(format, (unsigned)0);
33 context_ = OSMesaCreateContextExt(format, 34 context_ = OSMesaCreateContextExt(format,
34 0, // depth bits 35 0, // depth bits
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 void* GLContextOSMesa::GetHandle() { 112 void* GLContextOSMesa::GetHandle() {
112 return context_; 113 return context_;
113 } 114 }
114 115
115 void GLContextOSMesa::SetSwapInterval(int interval) { 116 void GLContextOSMesa::SetSwapInterval(int interval) {
116 DCHECK(IsCurrent(NULL)); 117 DCHECK(IsCurrent(NULL));
117 LOG(WARNING) << "GLContextOSMesa::SetSwapInterval is ignored."; 118 LOG(WARNING) << "GLContextOSMesa::SetSwapInterval is ignored.";
118 } 119 }
119 120
120 } // namespace gfx 121 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gfx/gl/gl_context_osmesa.h ('k') | ui/gfx/gl/gl_context_stub.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698