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

Unified Diff: ui/gl/gpu_timing.cc

Issue 1687353002: Force time elapsed queries on certain drivers. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 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
« no previous file with comments | « no previous file | no next file » | 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 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, &timestamp_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;
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698