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

Unified Diff: ui/gl/gpu_timing.cc

Issue 988693005: Chromium roll (https://codereview.chromium.org/976353002) (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: fixed bad android build patch Created 5 years, 9 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
« no previous file with comments | « ui/gl/gpu_timing.h ('k') | ui/platform_window/x11/x11_window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/gl/gpu_timing.cc
diff --git a/ui/gl/gpu_timing.cc b/ui/gl/gpu_timing.cc
index 22a4a6476c8ba81ef3900cba3d6d2393c1081067..a3b697fe306b0afaaac1c48787e8049c76276163 100644
--- a/ui/gl/gpu_timing.cc
+++ b/ui/gl/gpu_timing.cc
@@ -30,6 +30,17 @@ scoped_refptr<GPUTimingClient> GPUTiming::CreateGPUTimingClient() {
return new GPUTimingClient(this);
}
+uint32_t GPUTiming::GetDisjointCount() {
+ if (timer_type_ == kTimerTypeDisjoint) {
+ GLint disjoint_value = 0;
+ glGetIntegerv(GL_GPU_DISJOINT_EXT, &disjoint_value);
+ if (disjoint_value) {
+ disjoint_counter_++;
+ }
+ }
+ return disjoint_counter_;
+}
+
GPUTimer::~GPUTimer() {
glDeleteQueriesARB(2, queries_);
}
@@ -87,6 +98,7 @@ GPUTimingClient::GPUTimingClient(GPUTiming* gpu_timing)
: gpu_timing_(gpu_timing) {
if (gpu_timing) {
timer_type_ = gpu_timing->GetTimerType();
+ disjoint_counter_ = gpu_timing_->GetDisjointCount();
}
}
@@ -111,12 +123,13 @@ const char* GPUTimingClient::GetTimerTypeName() const {
bool GPUTimingClient::CheckAndResetTimerErrors() {
if (timer_type_ == GPUTiming::kTimerTypeDisjoint) {
- GLint disjoint_value = 0;
- glGetIntegerv(GL_GPU_DISJOINT_EXT, &disjoint_value);
- return disjoint_value != 0;
- } else {
- return false;
+ DCHECK(gpu_timing_ != nullptr);
+ const uint32_t total_disjoint_count = gpu_timing_->GetDisjointCount();
+ const bool disjoint_triggered = total_disjoint_count != disjoint_counter_;
+ disjoint_counter_ = total_disjoint_count;
+ return disjoint_triggered;
}
+ return false;
}
int64 GPUTimingClient::CalculateTimerOffset() {
« no previous file with comments | « ui/gl/gpu_timing.h ('k') | ui/platform_window/x11/x11_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698