Chromium Code Reviews| 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 420 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 431 glGetShaderiv(info->service_id(), GL_COMPILE_STATUS, &status); | 431 glGetShaderiv(info->service_id(), GL_COMPILE_STATUS, &status); |
| 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. |
|
alokp
2012/07/31 23:04:56
Could you append "unless the driver is buggy" to t
| |
| 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 << "\n--original-shader--\n" << (source ? *source : "") | |
| 453 << "\n--translated-shader--\n" << shader_src | |
| 454 << "\n--info-log--\n" << *info->log_info(); | |
| 452 } | 455 } |
| 453 } | 456 } |
| 454 | 457 |
| 455 bool ProgramManager::ProgramInfo::Link(ShaderManager* manager, | 458 bool ProgramManager::ProgramInfo::Link(ShaderManager* manager, |
| 456 ShaderTranslator* vertex_translator, | 459 ShaderTranslator* vertex_translator, |
| 457 ShaderTranslator* fragment_translator, | 460 ShaderTranslator* fragment_translator, |
| 458 FeatureInfo* feature_info) { | 461 FeatureInfo* feature_info) { |
| 459 ClearLinkStatus(); | 462 ClearLinkStatus(); |
| 460 if (!CanLink()) { | 463 if (!CanLink()) { |
| 461 set_log_info("missing shaders"); | 464 set_log_info("missing shaders"); |
| (...skipping 652 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1114 info->ClearUniforms(&zero_); | 1117 info->ClearUniforms(&zero_); |
| 1115 } | 1118 } |
| 1116 } | 1119 } |
| 1117 | 1120 |
| 1118 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) { | 1121 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) { |
| 1119 return index + element * 0x10000; | 1122 return index + element * 0x10000; |
| 1120 } | 1123 } |
| 1121 | 1124 |
| 1122 } // namespace gles2 | 1125 } // namespace gles2 |
| 1123 } // namespace gpu | 1126 } // namespace gpu |
| OLD | NEW |