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

Side by Side Diff: gpu/command_buffer/service/program_manager.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 | Annotate | Revision Log
« no previous file with comments | « google_apis/google_api_keys.cc ('k') | ipc/ipc_channel_factory.cc » ('j') | 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) 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 427 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 if (mapped_name && *mapped_name != it->first) 438 if (mapped_name && *mapped_name != it->first)
439 glBindAttribLocation(service_id_, it->second, mapped_name->c_str()); 439 glBindAttribLocation(service_id_, it->second, mapped_name->c_str());
440 } 440 }
441 } 441 }
442 442
443 void ProgramManager::DoCompileShader(Shader* shader, 443 void ProgramManager::DoCompileShader(Shader* shader,
444 ShaderTranslator* translator, 444 ShaderTranslator* translator,
445 FeatureInfo* feature_info) { 445 FeatureInfo* feature_info) {
446 TimeTicks before = TimeTicks::HighResNow(); 446 TimeTicks before = TimeTicks::HighResNow();
447 if (program_cache_ && 447 if (program_cache_ &&
448 program_cache_->GetShaderCompilationStatus(shader->source() ? 448 program_cache_->GetShaderCompilationStatus(
449 *shader->source() : "") == 449 shader->source() ? *shader->source() : std::string()) ==
450 ProgramCache::COMPILATION_SUCCEEDED) { 450 ProgramCache::COMPILATION_SUCCEEDED) {
451 shader->SetStatus(true, "", translator); 451 shader->SetStatus(true, "", translator);
452 shader->FlagSourceAsCompiled(false); 452 shader->FlagSourceAsCompiled(false);
453 UMA_HISTOGRAM_CUSTOM_COUNTS( 453 UMA_HISTOGRAM_CUSTOM_COUNTS(
454 "GPU.ProgramCache.CompilationCacheHitTime", 454 "GPU.ProgramCache.CompilationCacheHitTime",
455 (TimeTicks::HighResNow() - before).InMicroseconds(), 455 (TimeTicks::HighResNow() - before).InMicroseconds(),
456 0, 456 0,
457 TimeDelta::FromSeconds(1).InMicroseconds(), 457 TimeDelta::FromSeconds(1).InMicroseconds(),
458 50); 458 50);
459 return; 459 return;
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
518 glGetShaderiv(shader->service_id(), GL_INFO_LOG_LENGTH, &max_len); 518 glGetShaderiv(shader->service_id(), GL_INFO_LOG_LENGTH, &max_len);
519 scoped_ptr<char[]> temp(new char[max_len]); 519 scoped_ptr<char[]> temp(new char[max_len]);
520 GLint len = 0; 520 GLint len = 0;
521 glGetShaderInfoLog(shader->service_id(), max_len, &len, temp.get()); 521 glGetShaderInfoLog(shader->service_id(), max_len, &len, temp.get());
522 DCHECK(max_len == 0 || len < max_len); 522 DCHECK(max_len == 0 || len < max_len);
523 DCHECK(len == 0 || temp[len] == '\0'); 523 DCHECK(len == 0 || temp[len] == '\0');
524 shader->SetStatus(false, std::string(temp.get(), len).c_str(), NULL); 524 shader->SetStatus(false, std::string(temp.get(), len).c_str(), NULL);
525 LOG_IF(ERROR, translator) 525 LOG_IF(ERROR, translator)
526 << "Shader translator allowed/produced an invalid shader " 526 << "Shader translator allowed/produced an invalid shader "
527 << "unless the driver is buggy:" 527 << "unless the driver is buggy:"
528 << "\n--original-shader--\n" << (source ? *source : "") 528 << "\n--original-shader--\n" << (source ? *source : std::string())
529 << "\n--translated-shader--\n" << shader_src 529 << "\n--translated-shader--\n" << shader_src << "\n--info-log--\n"
530 << "\n--info-log--\n" << *shader->log_info(); 530 << *shader->log_info();
531 } 531 }
532 } 532 }
533 533
534 bool Program::Link(ShaderManager* manager, 534 bool Program::Link(ShaderManager* manager,
535 ShaderTranslator* vertex_translator, 535 ShaderTranslator* vertex_translator,
536 ShaderTranslator* fragment_translator, 536 ShaderTranslator* fragment_translator,
537 FeatureInfo* feature_info, 537 FeatureInfo* feature_info,
538 const ShaderCacheCallback& shader_callback) { 538 const ShaderCacheCallback& shader_callback) {
539 ClearLinkStatus(); 539 ClearLinkStatus();
540 if (!CanLink()) { 540 if (!CanLink()) {
(...skipping 681 matching lines...) Expand 10 before | Expand all | Expand 10 after
1222 program->ClearUniforms(&zero_); 1222 program->ClearUniforms(&zero_);
1223 } 1223 }
1224 } 1224 }
1225 1225
1226 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) { 1226 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) {
1227 return index + element * 0x10000; 1227 return index + element * 0x10000;
1228 } 1228 }
1229 1229
1230 } // namespace gles2 1230 } // namespace gles2
1231 } // namespace gpu 1231 } // namespace gpu
OLDNEW
« no previous file with comments | « google_apis/google_api_keys.cc ('k') | ipc/ipc_channel_factory.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698