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

Side by Side Diff: media/tools/shader_bench/shader_bench.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
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 <deque> 5 #include <deque>
6 #include <ostream> 6 #include <ostream>
7 #include <stdio.h> 7 #include <stdio.h>
8 #include <stdlib.h> 8 #include <stdlib.h>
9 9
10 #include "base/at_exit.h" 10 #include "base/at_exit.h"
(...skipping 115 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Process files. 126 // Process files.
127 std::deque<scoped_refptr<media::VideoFrame> > frames; 127 std::deque<scoped_refptr<media::VideoFrame> > frames;
128 GetFrames(file_name, width, height, num_frames, frames); 128 GetFrames(file_name, width, height, num_frames, frames);
129 129
130 // Initialize window and graphics context. 130 // Initialize window and graphics context.
131 base::AtExitManager at_exit_manager; 131 base::AtExitManager at_exit_manager;
132 gfx::GLSurface::InitializeOneOff(); 132 gfx::GLSurface::InitializeOneOff();
133 scoped_ptr<media::Window> window(new media::Window(width, height)); 133 scoped_ptr<media::Window> window(new media::Window(width, height));
134 gfx::GLSurface* surface = 134 gfx::GLSurface* surface =
135 gfx::GLSurface::CreateViewGLSurface(false, window->PluginWindow()); 135 gfx::GLSurface::CreateViewGLSurface(false, window->PluginWindow());
136 gfx::GLContext* context = gfx::GLContext::CreateGLContext(NULL, surface); 136 gfx::GLContext* context = gfx::GLContext::CreateGLContext(
137 NULL,
138 surface,
139 gfx::PreferDiscreteGpu);
137 context->MakeCurrent(surface); 140 context->MakeCurrent(surface);
138 // This sets D3DPRESENT_INTERVAL_IMMEDIATE on Windows. 141 // This sets D3DPRESENT_INTERVAL_IMMEDIATE on Windows.
139 context->SetSwapInterval(0); 142 context->SetSwapInterval(0);
140 143
141 // Initialize and name GPU painters. 144 // Initialize and name GPU painters.
142 static const int kNumPainters = 3; 145 static const int kNumPainters = 3;
143 static const struct { 146 static const struct {
144 const char* name; 147 const char* name;
145 GPUPainter* painter; 148 GPUPainter* painter;
146 } painters[] = { 149 } painters[] = {
147 { "CPU CSC + GPU Render", new CPUColorPainter() }, 150 { "CPU CSC + GPU Render", new CPUColorPainter() },
148 { "GPU CSC/Render", new GPUColorWithLuminancePainter() }, 151 { "GPU CSC/Render", new GPUColorWithLuminancePainter() },
149 { "GPU CSC/Render (experimental)", new GPUColorRGBALumHackPainter() }, 152 { "GPU CSC/Render (experimental)", new GPUColorRGBALumHackPainter() },
150 }; 153 };
151 154
152 // Run GPU painter tests. 155 // Run GPU painter tests.
153 for (int i = 0; i < kNumPainters; i++) { 156 for (int i = 0; i < kNumPainters; i++) {
154 scoped_ptr<GPUPainter> painter(painters[i].painter); 157 scoped_ptr<GPUPainter> painter(painters[i].painter);
155 painter->LoadFrames(&frames); 158 painter->LoadFrames(&frames);
156 painter->SetGLContext(surface, context); 159 painter->SetGLContext(surface, context);
157 painter->Initialize(width, height); 160 painter->Initialize(width, height);
158 printf("Running %s tests...", painters[i].name); 161 printf("Running %s tests...", painters[i].name);
159 RunTest(window.get(), painter.get()); 162 RunTest(window.get(), painter.get());
160 } 163 }
161 164
162 return 0; 165 return 0;
163 } 166 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698