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

Unified Diff: gpu/perftests/texture_upload_perftest.cc

Issue 937263006: Refactored GLContext to own GPUTiming which spawn GPUTimingClients. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 10 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 side-by-side diff with in-line comments
Download patch
Index: gpu/perftests/texture_upload_perftest.cc
diff --git a/gpu/perftests/texture_upload_perftest.cc b/gpu/perftests/texture_upload_perftest.cc
index 2e9ef6cea4346d217eeae515b89db88f9e0cf40f..ec14fd8f2e6d750d3f48b2c1ad01edd6f385e93e 100644
--- a/gpu/perftests/texture_upload_perftest.cc
+++ b/gpu/perftests/texture_upload_perftest.cc
@@ -9,13 +9,13 @@
#include "base/logging.h"
#include "base/memory/ref_counted.h"
#include "base/memory/scoped_ptr.h"
-#include "gpu/command_buffer/service/gpu_timing.h"
#include "gpu/perftests/measurements.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "ui/gfx/geometry/size.h"
#include "ui/gl/gl_bindings.h"
#include "ui/gl/gl_context.h"
#include "ui/gl/gl_surface.h"
+#include "ui/gl/gpu_timing.h"
#include "ui/gl/scoped_make_current.h"
namespace gpu {
@@ -121,12 +121,13 @@ class TextureUploadPerfTest : public testing::Test {
glCheckFramebufferStatusEXT(GL_FRAMEBUFFER));
glViewport(0, 0, size_.width(), size_.height());
+ gpu_timing_.Initialize(gl_context_.get());
+ gpu_timing_client_ = gpu_timing_.CreateGPUTimingClient();
- if (gpu_timing_.Initialize(gl_context_.get())) {
+ if (gpu_timing_client_->IsAvailable()) {
LOG(INFO) << "Gpu timing initialized with timer type: "
- << gpu_timing_.GetTimerTypeName();
- gpu_timing_.CheckAndResetTimerErrors();
- gpu_timing_.InvalidateTimerOffset();
+ << gpu_timing_client_->GetTimerTypeName();
+ gpu_timing_client_->InvalidateTimerOffset();
} else {
LOG(WARNING) << "Can't initialize gpu timing";
}
@@ -185,10 +186,10 @@ class TextureUploadPerfTest : public testing::Test {
DCHECK_NE(0u, framebuffer_object_);
glBindFramebufferEXT(GL_FRAMEBUFFER, framebuffer_object_);
- MeasurementTimers total_timers(&gpu_timing_);
+ MeasurementTimers total_timers(gpu_timing_client_.get());
GLuint texture_id = 0;
- MeasurementTimers tex_timers(&gpu_timing_);
+ MeasurementTimers tex_timers(gpu_timing_client_.get());
glActiveTexture(GL_TEXTURE0);
glGenTextures(1, &texture_id);
glBindTexture(GL_TEXTURE_2D, texture_id);
@@ -202,7 +203,7 @@ class TextureUploadPerfTest : public testing::Test {
CheckNoGlError();
tex_timers.Record();
- MeasurementTimers draw_timers(&gpu_timing_);
+ MeasurementTimers draw_timers(gpu_timing_client_.get());
glUseProgram(program_object_);
glUniform1i(sampler_location_, 0);
@@ -213,7 +214,7 @@ class TextureUploadPerfTest : public testing::Test {
glDrawArrays(GL_TRIANGLE_STRIP, 0, 4);
draw_timers.Record();
- MeasurementTimers finish_timers(&gpu_timing_);
+ MeasurementTimers finish_timers(gpu_timing_client_.get());
glFinish();
CheckNoGlError();
finish_timers.Record();
@@ -243,6 +244,7 @@ class TextureUploadPerfTest : public testing::Test {
scoped_refptr<gfx::GLContext> gl_context_;
scoped_refptr<gfx::GLSurface> surface_;
GPUTiming gpu_timing_;
+ scoped_refptr<GPUTimingClient> gpu_timing_client_;
GLuint color_texture_ = 0;
GLuint framebuffer_object_ = 0;

Powered by Google App Engine
This is Rietveld 408576698