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

Side by Side Diff: gpu/perftests/texture_upload_perftest.cc

Issue 2480373002: Refactor context creation parameters into a struct. (Closed)
Patch Set: Created 4 years, 1 month 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
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <memory> 9 #include <memory>
10 #include <vector> 10 #include <vector>
(...skipping 172 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 // On Ozone, the backend initializes the event system using a UI 183 // On Ozone, the backend initializes the event system using a UI
184 // thread. 184 // thread.
185 base::MessageLoopForUI main_loop; 185 base::MessageLoopForUI main_loop;
186 #endif 186 #endif
187 static bool gl_initialized = gl::init::InitializeGLOneOff(); 187 static bool gl_initialized = gl::init::InitializeGLOneOff();
188 DCHECK(gl_initialized); 188 DCHECK(gl_initialized);
189 // Initialize an offscreen surface and a gl context. 189 // Initialize an offscreen surface and a gl context.
190 surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size()); 190 surface_ = gl::init::CreateOffscreenGLSurface(gfx::Size());
191 gl_context_ = 191 gl_context_ =
192 gl::init::CreateGLContext(nullptr, // share_group 192 gl::init::CreateGLContext(nullptr, // share_group
193 surface_.get(), gl::PreferIntegratedGpu); 193 surface_.get(), gl::GLContextAttribs());
194 ui::ScopedMakeCurrent smc(gl_context_.get(), surface_.get()); 194 ui::ScopedMakeCurrent smc(gl_context_.get(), surface_.get());
195 glGenTextures(1, &color_texture_); 195 glGenTextures(1, &color_texture_);
196 glBindTexture(GL_TEXTURE_2D, color_texture_); 196 glBindTexture(GL_TEXTURE_2D, color_texture_);
197 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE); 197 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_S, GL_CLAMP_TO_EDGE);
198 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE); 198 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_WRAP_T, GL_CLAMP_TO_EDGE);
199 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST); 199 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MIN_FILTER, GL_NEAREST);
200 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST); 200 glTexParameteri(GL_TEXTURE_2D, GL_TEXTURE_MAG_FILTER, GL_NEAREST);
201 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, fbo_size_.width(), 201 glTexImage2D(GL_TEXTURE_2D, 0, GL_RGBA, fbo_size_.width(),
202 fbo_size_.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr); 202 fbo_size_.height(), 0, GL_RGBA, GL_UNSIGNED_BYTE, nullptr);
203 203
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
551 gpu_timing_client_->CheckAndResetTimerErrors(); 551 gpu_timing_client_->CheckAndResetTimerErrors();
552 if (!gpu_timer_errors) { 552 if (!gpu_timer_errors) {
553 upload_and_draw_timers.GetAsMeasurement("upload_and_draw") 553 upload_and_draw_timers.GetAsMeasurement("upload_and_draw")
554 .PrintResult("renaming"); 554 .PrintResult("renaming");
555 finish_timers.GetAsMeasurement("finish").PrintResult("renaming"); 555 finish_timers.GetAsMeasurement("finish").PrintResult("renaming");
556 } 556 }
557 } 557 }
558 558
559 } // namespace 559 } // namespace
560 } // namespace gpu 560 } // namespace gpu
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698