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

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: Merged with latest 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 5f156580370eecba7b488d37d013df0e56dacbdb..c7eb5f11bec213eb83a00a620a1163125e7d1b41 100644
--- a/gpu/perftests/texture_upload_perftest.cc
+++ b/gpu/perftests/texture_upload_perftest.cc
@@ -9,7 +9,6 @@
#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 "testing/perf/perf_test.h"
@@ -17,6 +16,7 @@
#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 {
@@ -122,12 +122,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";
}
@@ -186,10 +187,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);
@@ -203,7 +204,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);
@@ -214,7 +215,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();
@@ -234,7 +235,8 @@ class TextureUploadPerfTest : public testing::Test {
std::vector<Measurement> measurements;
bool gpu_timer_errors =
- gpu_timing_.IsAvailable() && gpu_timing_.CheckAndResetTimerErrors();
+ gpu_timing_client_->IsAvailable() &&
+ gpu_timing_client_->CheckAndResetTimerErrors();
if (!gpu_timer_errors) {
measurements.push_back(total_timers.GetAsMeasurement("total"));
measurements.push_back(tex_timers.GetAsMeasurement("teximage2d"));
@@ -248,6 +250,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