| OLD | NEW |
| 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 Loading... |
| 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 glDeleteQueriesARB(2, queries_); | 47 glDeleteQueries(2, queries_); |
| 48 } | 48 } |
| 49 | 49 |
| 50 void GPUTimer::Start() { | 50 void GPUTimer::Start() { |
| 51 switch (gpu_timing_client_->gpu_timing_->timer_type_) { | 51 switch (gpu_timing_client_->gpu_timing_->timer_type_) { |
| 52 case GPUTiming::kTimerTypeARB: | 52 case GPUTiming::kTimerTypeARB: |
| 53 case GPUTiming::kTimerTypeDisjoint: | 53 case GPUTiming::kTimerTypeDisjoint: |
| 54 // GL_TIMESTAMP and GL_TIMESTAMP_EXT both have the same value. | 54 // GL_TIMESTAMP and GL_TIMESTAMP_EXT both have the same value. |
| 55 glQueryCounter(queries_[0], GL_TIMESTAMP); | 55 glQueryCounter(queries_[0], GL_TIMESTAMP); |
| 56 break; | 56 break; |
| 57 case GPUTiming::kTimerTypeEXT: | 57 case GPUTiming::kTimerTypeEXT: |
| (...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 138 case GPUTiming::kTimerTypeARB: | 138 case GPUTiming::kTimerTypeARB: |
| 139 case GPUTiming::kTimerTypeDisjoint: | 139 case GPUTiming::kTimerTypeDisjoint: |
| 140 queries = 2; | 140 queries = 2; |
| 141 break; | 141 break; |
| 142 case GPUTiming::kTimerTypeEXT: | 142 case GPUTiming::kTimerTypeEXT: |
| 143 queries = 1; | 143 queries = 1; |
| 144 break; | 144 break; |
| 145 default: | 145 default: |
| 146 NOTREACHED(); | 146 NOTREACHED(); |
| 147 } | 147 } |
| 148 glGenQueriesARB(queries, queries_); | 148 glGenQueries(queries, queries_); |
| 149 } | 149 } |
| 150 | 150 |
| 151 GPUTimingClient::GPUTimingClient(GPUTiming* gpu_timing) | 151 GPUTimingClient::GPUTimingClient(GPUTiming* gpu_timing) |
| 152 : gpu_timing_(gpu_timing) { | 152 : gpu_timing_(gpu_timing) { |
| 153 if (gpu_timing) { | 153 if (gpu_timing) { |
| 154 timer_type_ = gpu_timing->GetTimerType(); | 154 timer_type_ = gpu_timing->GetTimerType(); |
| 155 disjoint_counter_ = gpu_timing_->GetDisjointCount(); | 155 disjoint_counter_ = gpu_timing_->GetDisjointCount(); |
| 156 } | 156 } |
| 157 } | 157 } |
| 158 | 158 |
| (...skipping 55 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 214 | 214 |
| 215 void GPUTimingClient::SetCpuTimeForTesting( | 215 void GPUTimingClient::SetCpuTimeForTesting( |
| 216 const base::Callback<int64(void)>& cpu_time) { | 216 const base::Callback<int64(void)>& cpu_time) { |
| 217 cpu_time_for_testing_ = cpu_time; | 217 cpu_time_for_testing_ = cpu_time; |
| 218 } | 218 } |
| 219 | 219 |
| 220 GPUTimingClient::~GPUTimingClient() { | 220 GPUTimingClient::~GPUTimingClient() { |
| 221 } | 221 } |
| 222 | 222 |
| 223 } // namespace gfx | 223 } // namespace gfx |
| OLD | NEW |