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

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

Issue 10824120: Add logging for shaders that don't compile (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 8 years, 4 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 | « no previous file | 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) 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 421 matching lines...) Expand 10 before | Expand all | Expand 10 after
432 if (status) { 432 if (status) {
433 info->SetStatus(true, "", translator); 433 info->SetStatus(true, "", translator);
434 if (program_cache_) { 434 if (program_cache_) {
435 const char* untranslated_source = source ? source->c_str() : ""; 435 const char* untranslated_source = source ? source->c_str() : "";
436 program_cache_->ShaderCompilationSucceeded(untranslated_source); 436 program_cache_->ShaderCompilationSucceeded(untranslated_source);
437 } 437 }
438 } else { 438 } else {
439 // We cannot reach here if we are using the shader translator. 439 // We cannot reach here if we are using the shader translator.
440 // All invalid shaders must be rejected by the translator. 440 // All invalid shaders must be rejected by the translator.
441 // All translated shaders must compile. 441 // All translated shaders must compile.
442 LOG_IF(ERROR, translator)
443 << "Shader translator allowed/produced an invalid shader.";
444 GLint max_len = 0; 442 GLint max_len = 0;
445 glGetShaderiv(info->service_id(), GL_INFO_LOG_LENGTH, &max_len); 443 glGetShaderiv(info->service_id(), GL_INFO_LOG_LENGTH, &max_len);
446 scoped_array<char> temp(new char[max_len]); 444 scoped_array<char> temp(new char[max_len]);
447 GLint len = 0; 445 GLint len = 0;
448 glGetShaderInfoLog(info->service_id(), max_len, &len, temp.get()); 446 glGetShaderInfoLog(info->service_id(), max_len, &len, temp.get());
449 DCHECK(max_len == 0 || len < max_len); 447 DCHECK(max_len == 0 || len < max_len);
450 DCHECK(len == 0 || temp[len] == '\0'); 448 DCHECK(len == 0 || temp[len] == '\0');
451 info->SetStatus(false, std::string(temp.get(), len).c_str(), NULL); 449 info->SetStatus(false, std::string(temp.get(), len).c_str(), NULL);
450 LOG_IF(ERROR, translator)
451 << "Shader translator allowed/produced an invalid shader "
452 << "unless the driver is buggy:"
453 << "\n--original-shader--\n" << (source ? *source : "")
454 << "\n--translated-shader--\n" << shader_src
455 << "\n--info-log--\n" << *info->log_info();
452 } 456 }
453 } 457 }
454 458
455 bool ProgramManager::ProgramInfo::Link(ShaderManager* manager, 459 bool ProgramManager::ProgramInfo::Link(ShaderManager* manager,
456 ShaderTranslator* vertex_translator, 460 ShaderTranslator* vertex_translator,
457 ShaderTranslator* fragment_translator, 461 ShaderTranslator* fragment_translator,
458 FeatureInfo* feature_info) { 462 FeatureInfo* feature_info) {
459 ClearLinkStatus(); 463 ClearLinkStatus();
460 if (!CanLink()) { 464 if (!CanLink()) {
461 set_log_info("missing shaders"); 465 set_log_info("missing shaders");
(...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after
1114 info->ClearUniforms(&zero_); 1118 info->ClearUniforms(&zero_);
1115 } 1119 }
1116 } 1120 }
1117 1121
1118 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) { 1122 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) {
1119 return index + element * 0x10000; 1123 return index + element * 0x10000;
1120 } 1124 }
1121 1125
1122 } // namespace gles2 1126 } // namespace gles2
1123 } // namespace gpu 1127 } // namespace gpu
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698