Index: ui/gl/gpu_timing.cc |
diff --git a/ui/gl/gpu_timing.cc b/ui/gl/gpu_timing.cc |
index 45908c985188f56baaac43086cc62e9c01929248..73b12a7f12fdb6d57ceaac4a0b636eee7e469b52 100644 |
--- a/ui/gl/gpu_timing.cc |
+++ b/ui/gl/gpu_timing.cc |
@@ -27,6 +27,7 @@ class GPUTimingImpl : public GPUTiming { |
void ForceTimeElapsedQuery() { force_time_elapsed_query_ = true; } |
bool IsForceTimeElapsedQuery() { return force_time_elapsed_query_; } |
+ bool ShouldForceTimeElapsedQuery(); |
GPUTiming::TimerType GetTimerType() const { return timer_type_; } |
@@ -317,13 +318,33 @@ GPUTimingImpl::GPUTimingImpl(GLContextReal* context) { |
timer_type_ = GPUTiming::kTimerTypeARB; |
} else if (context->HasExtension("GL_EXT_timer_query")) { |
timer_type_ = GPUTiming::kTimerTypeEXT; |
- force_time_elapsed_query_ = true; |
} |
+ force_time_elapsed_query_ = ShouldForceTimeElapsedQuery(); |
} |
GPUTimingImpl::~GPUTimingImpl() { |
} |
+bool GPUTimingImpl::ShouldForceTimeElapsedQuery() { |
+ if (timer_type_ == GPUTiming::kTimerTypeInvalid) { |
+ return false; |
+ } else if (timer_type_ == GPUTiming::kTimerTypeEXT) { |
+ // GL_EXT_timer_query does not support timestamps |
+ return true; |
+ } else { |
+ // Certain drivers such as Mac drivers and ANGLE's D3D11 backend do not |
Geoff Lang
2016/02/11 16:37:02
nit: assert that type is GPUTiming::kTimerTypeDisj
|
+ // support timestamps even though queries for them are valid. This is |
+ // indicated by returning 0 when for GL_TIMESTAMP in GL_QUERY_COUNTER_BITS |
+ GLint timestamp_bits; |
+ glGetQueryiv(GL_TIMESTAMP, GL_QUERY_COUNTER_BITS, ×tamp_bits); |
+ if (timestamp_bits == 0) { |
Geoff Lang
2016/02/11 16:37:02
nit: return timestamp_bits == 0;
|
+ return true; |
+ } else { |
+ return false; |
+ } |
+ } |
+} |
+ |
uint32_t GPUTimingImpl::GetDisjointCount() { |
if (timer_type_ == GPUTiming::kTimerTypeDisjoint) { |
GLint disjoint_value = 0; |