OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "gpu/command_buffer/service/program_manager.h" | 5 #include "gpu/command_buffer/service/program_manager.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <set> | 8 #include <set> |
9 #include <utility> | 9 #include <utility> |
10 #include <vector> | 10 #include <vector> |
(...skipping 376 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
387 FeatureInfo* feature_info) { | 387 FeatureInfo* feature_info) { |
388 base::Time before = base::Time::Now(); | 388 base::Time before = base::Time::Now(); |
389 if (program_cache_ && | 389 if (program_cache_ && |
390 program_cache_->GetShaderCompilationStatus(info->source() ? | 390 program_cache_->GetShaderCompilationStatus(info->source() ? |
391 *info->source() : "") == | 391 *info->source() : "") == |
392 ProgramCache::COMPILATION_SUCCEEDED) { | 392 ProgramCache::COMPILATION_SUCCEEDED) { |
393 info->SetStatus(true, "", translator); | 393 info->SetStatus(true, "", translator); |
394 info->FlagSourceAsCompiled(false); | 394 info->FlagSourceAsCompiled(false); |
395 UMA_HISTOGRAM_CUSTOM_COUNTS("GPU.ProgramCache.CompilationCacheHitTime", | 395 UMA_HISTOGRAM_CUSTOM_COUNTS("GPU.ProgramCache.CompilationCacheHitTime", |
396 (base::Time::Now() - before).InMicroseconds(), | 396 (base::Time::Now() - before).InMicroseconds(), |
397 100, | 397 0, |
398 TimeDelta::FromSeconds(1).InMicroseconds(), | 398 TimeDelta::FromSeconds(1).InMicroseconds(), |
399 50); | 399 50); |
400 return; | 400 return; |
401 } | 401 } |
402 ForceCompileShader(info->source(), info, translator, feature_info); | 402 ForceCompileShader(info->source(), info, translator, feature_info); |
403 UMA_HISTOGRAM_CUSTOM_COUNTS("GPU.ProgramCache.CompilationCacheMissTime", | 403 UMA_HISTOGRAM_CUSTOM_COUNTS("GPU.ProgramCache.CompilationCacheMissTime", |
404 (base::Time::Now() - before).InMicroseconds(), | 404 (base::Time::Now() - before).InMicroseconds(), |
405 100, | 405 0, |
406 TimeDelta::FromSeconds(1).InMicroseconds(), | 406 TimeDelta::FromSeconds(1).InMicroseconds(), |
407 50); | 407 50); |
408 } | 408 } |
409 | 409 |
410 void ProgramManager::ForceCompileShader(const std::string* source, | 410 void ProgramManager::ForceCompileShader(const std::string* source, |
411 ShaderManager::ShaderInfo* info, | 411 ShaderManager::ShaderInfo* info, |
412 ShaderTranslator* translator, | 412 ShaderTranslator* translator, |
413 FeatureInfo* feature_info) { | 413 FeatureInfo* feature_info) { |
414 info->FlagSourceAsCompiled(true); | 414 info->FlagSourceAsCompiled(true); |
415 | 415 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
541 if (success == GL_TRUE) { | 541 if (success == GL_TRUE) { |
542 Update(); | 542 Update(); |
543 if (cache && link) { | 543 if (cache && link) { |
544 cache->SaveLinkedProgram(service_id(), | 544 cache->SaveLinkedProgram(service_id(), |
545 attached_shaders_[0], | 545 attached_shaders_[0], |
546 attached_shaders_[1], | 546 attached_shaders_[1], |
547 &bind_attrib_location_map_); | 547 &bind_attrib_location_map_); |
548 UMA_HISTOGRAM_CUSTOM_COUNTS( | 548 UMA_HISTOGRAM_CUSTOM_COUNTS( |
549 "GPU.ProgramCache.BinaryCacheMissTime", | 549 "GPU.ProgramCache.BinaryCacheMissTime", |
550 (base::Time::Now() - before_time).InMicroseconds(), | 550 (base::Time::Now() - before_time).InMicroseconds(), |
551 100, | 551 0, |
552 TimeDelta::FromSeconds(1).InMicroseconds(), | 552 TimeDelta::FromSeconds(10).InMicroseconds(), |
553 50); | 553 50); |
554 } else if (cache) { | 554 } else if (cache) { |
555 UMA_HISTOGRAM_CUSTOM_COUNTS( | 555 UMA_HISTOGRAM_CUSTOM_COUNTS( |
556 "GPU.ProgramCache.BinaryCacheHitTime", | 556 "GPU.ProgramCache.BinaryCacheHitTime", |
557 (base::Time::Now() - before_time).InMicroseconds(), | 557 (base::Time::Now() - before_time).InMicroseconds(), |
558 100, | 558 0, |
559 TimeDelta::FromSeconds(1).InMicroseconds(), | 559 TimeDelta::FromSeconds(1).InMicroseconds(), |
560 50); | 560 50); |
561 } | 561 } |
562 } else { | 562 } else { |
563 UpdateLogInfo(); | 563 UpdateLogInfo(); |
564 } | 564 } |
565 return success == GL_TRUE; | 565 return success == GL_TRUE; |
566 } | 566 } |
567 | 567 |
568 void ProgramManager::ProgramInfo::Validate() { | 568 void ProgramManager::ProgramInfo::Validate() { |
(...skipping 580 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1149 info->ClearUniforms(&zero_); | 1149 info->ClearUniforms(&zero_); |
1150 } | 1150 } |
1151 } | 1151 } |
1152 | 1152 |
1153 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) { | 1153 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) { |
1154 return index + element * 0x10000; | 1154 return index + element * 0x10000; |
1155 } | 1155 } |
1156 | 1156 |
1157 } // namespace gles2 | 1157 } // namespace gles2 |
1158 } // namespace gpu | 1158 } // namespace gpu |
OLD | NEW |