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

Side by Side Diff: ui/gl/gpu_timing.cc

Issue 1135943002: Pull in various gpu/command_buffer fixes from chromium (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: Created 5 years, 7 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 | « ui/gl/gpu_timing.h ('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/time/time.h" 7 #include "base/time/time.h"
8 #include "ui/gl/gl_bindings.h" 8 #include "ui/gl/gl_bindings.h"
9 #include "ui/gl/gl_context.h" 9 #include "ui/gl/gl_context.h"
10 #include "ui/gl/gl_version_info.h" 10 #include "ui/gl/gl_version_info.h"
(...skipping 26 matching lines...) Expand all
37 GLint disjoint_value = 0; 37 GLint disjoint_value = 0;
38 glGetIntegerv(GL_GPU_DISJOINT_EXT, &disjoint_value); 38 glGetIntegerv(GL_GPU_DISJOINT_EXT, &disjoint_value);
39 if (disjoint_value) { 39 if (disjoint_value) {
40 disjoint_counter_++; 40 disjoint_counter_++;
41 } 41 }
42 } 42 }
43 return disjoint_counter_; 43 return disjoint_counter_;
44 } 44 }
45 45
46 GPUTimer::~GPUTimer() { 46 GPUTimer::~GPUTimer() {
47 glDeleteQueries(2, queries_); 47 // Destroy() must be called before the destructor.
48 DCHECK(queries_[0] == 0);
49 DCHECK(queries_[1] == 0);
50 }
51
52 void GPUTimer::Destroy(bool have_context) {
53 if (have_context) {
54 glDeleteQueries(2, queries_);
55 }
56 memset(queries_, 0, sizeof(queries_));
48 } 57 }
49 58
50 void GPUTimer::Start() { 59 void GPUTimer::Start() {
51 switch (gpu_timing_client_->gpu_timing_->timer_type_) { 60 switch (gpu_timing_client_->gpu_timing_->timer_type_) {
52 case GPUTiming::kTimerTypeARB: 61 case GPUTiming::kTimerTypeARB:
53 case GPUTiming::kTimerTypeDisjoint: 62 case GPUTiming::kTimerTypeDisjoint:
54 // GL_TIMESTAMP and GL_TIMESTAMP_EXT both have the same value. 63 // GL_TIMESTAMP and GL_TIMESTAMP_EXT both have the same value.
55 glQueryCounter(queries_[0], GL_TIMESTAMP); 64 glQueryCounter(queries_[0], GL_TIMESTAMP);
56 break; 65 break;
57 case GPUTiming::kTimerTypeEXT: 66 case GPUTiming::kTimerTypeEXT:
(...skipping 156 matching lines...) Expand 10 before | Expand all | Expand 10 after
214 223
215 void GPUTimingClient::SetCpuTimeForTesting( 224 void GPUTimingClient::SetCpuTimeForTesting(
216 const base::Callback<int64(void)>& cpu_time) { 225 const base::Callback<int64(void)>& cpu_time) {
217 cpu_time_for_testing_ = cpu_time; 226 cpu_time_for_testing_ = cpu_time;
218 } 227 }
219 228
220 GPUTimingClient::~GPUTimingClient() { 229 GPUTimingClient::~GPUTimingClient() {
221 } 230 }
222 231
223 } // namespace gfx 232 } // namespace gfx
OLDNEW
« no previous file with comments | « ui/gl/gpu_timing.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698