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

Side by Side 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: Initial patch 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 unified diff | Download patch
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2015 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/gl/gpu_timing.h" 5 #include "ui/gl/gpu_timing.h"
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/time/time.h" 8 #include "base/time/time.h"
9 #include "ui/gl/gl_bindings.h" 9 #include "ui/gl/gl_bindings.h"
10 #include "ui/gl/gl_context.h" 10 #include "ui/gl/gl_context.h"
(...skipping 299 matching lines...) Expand 10 before | Expand all | Expand 10 after
310 private: 310 private:
311 ~TimeStampTimerQuery() override {} 311 ~TimeStampTimerQuery() override {}
312 uint32_t gl_query_id_ = 0; 312 uint32_t gl_query_id_ = 0;
313 scoped_refptr<QueryResult> query_result_; 313 scoped_refptr<QueryResult> query_result_;
314 }; 314 };
315 315
316 GPUTimingImpl::GPUTimingImpl(GLContextReal* context) { 316 GPUTimingImpl::GPUTimingImpl(GLContextReal* context) {
317 DCHECK(context); 317 DCHECK(context);
318 const GLVersionInfo* version_info = context->GetVersionInfo(); 318 const GLVersionInfo* version_info = context->GetVersionInfo();
319 DCHECK(version_info); 319 DCHECK(version_info);
320 if (version_info->is_es3 && // glGetInteger64v is supported under ES3. 320 if (context->HasExtension("GL_EXT_disjoint_timer_query")) {
321 context->HasExtension("GL_EXT_disjoint_timer_query")) {
322 timer_type_ = GPUTiming::kTimerTypeDisjoint; 321 timer_type_ = GPUTiming::kTimerTypeDisjoint;
322 if (!version_info->is_es3) {
323 // Due to a bug in the specification, glGetInteger64v is only supported
324 // under ES3. Since it is only used for timestamps, we workaround this by
325 // emulating timestamps on ES2 so WebGL 1.0 will still have access to the
326 // extension
327 force_time_elapsed_query_ = true;
328 timestamp_bit_count_gl_ = 0;
329 }
323 } else if (context->HasExtension("GL_ARB_timer_query")) { 330 } else if (context->HasExtension("GL_ARB_timer_query")) {
324 timer_type_ = GPUTiming::kTimerTypeARB; 331 timer_type_ = GPUTiming::kTimerTypeARB;
325 } else if (context->HasExtension("GL_EXT_timer_query")) { 332 } else if (context->HasExtension("GL_EXT_timer_query")) {
326 timer_type_ = GPUTiming::kTimerTypeEXT; 333 timer_type_ = GPUTiming::kTimerTypeEXT;
327 force_time_elapsed_query_ = true; 334 force_time_elapsed_query_ = true;
328 timestamp_bit_count_gl_ = 0; 335 timestamp_bit_count_gl_ = 0;
329 } 336 }
330 } 337 }
331 338
332 GPUTimingImpl::~GPUTimingImpl() { 339 GPUTimingImpl::~GPUTimingImpl() {
(...skipping 319 matching lines...) Expand 10 before | Expand all | Expand 10 after
652 659
653 void GPUTimingClient::ForceTimeElapsedQuery() { 660 void GPUTimingClient::ForceTimeElapsedQuery() {
654 DCHECK(gpu_timing_); 661 DCHECK(gpu_timing_);
655 gpu_timing_->ForceTimeElapsedQuery(); 662 gpu_timing_->ForceTimeElapsedQuery();
656 } 663 }
657 664
658 GPUTimingClient::~GPUTimingClient() { 665 GPUTimingClient::~GPUTimingClient() {
659 } 666 }
660 667
661 } // namespace gfx 668 } // namespace gfx
OLDNEW
« no previous file with comments | « gpu/command_buffer/service/feature_info.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698