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

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

Issue 2220933002: Empty program info log should not be a '\0' string in WebGL (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: replace length with empty Created 4 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
« 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 <stddef.h> 7 #include <stddef.h>
8 #include <stdint.h> 8 #include <stdint.h>
9 9
10 #include <algorithm> 10 #include <algorithm>
(...skipping 464 matching lines...) Expand 10 before | Expand all | Expand 10 after
475 output += hashed_name; 475 output += hashed_name;
476 } 476 }
477 477
478 return output + input.as_string(); 478 return output + input.as_string();
479 } 479 }
480 480
481 void Program::UpdateLogInfo() { 481 void Program::UpdateLogInfo() {
482 GLint max_len = 0; 482 GLint max_len = 0;
483 glGetProgramiv(service_id_, GL_INFO_LOG_LENGTH, &max_len); 483 glGetProgramiv(service_id_, GL_INFO_LOG_LENGTH, &max_len);
484 if (max_len == 0) { 484 if (max_len == 0) {
485 set_log_info(NULL); 485 set_log_info(nullptr);
486 return; 486 return;
487 } 487 }
488 std::unique_ptr<char[]> temp(new char[max_len]); 488 std::unique_ptr<char[]> temp(new char[max_len]);
489 GLint len = 0; 489 GLint len = 0;
490 glGetProgramInfoLog(service_id_, max_len, &len, temp.get()); 490 glGetProgramInfoLog(service_id_, max_len, &len, temp.get());
491 DCHECK(max_len == 0 || len < max_len); 491 DCHECK(max_len == 0 || len < max_len);
492 DCHECK(len == 0 || temp[len] == '\0'); 492 DCHECK(len == 0 || temp[len] == '\0');
493 std::string log(temp.get(), len); 493 std::string log(temp.get(), len);
494 set_log_info(ProcessLogInfo(log).c_str()); 494 log = ProcessLogInfo(log);
495 set_log_info(log.empty() ? nullptr : log.c_str());
495 } 496 }
496 497
497 void Program::ClearUniforms(std::vector<uint8_t>* zero_buffer) { 498 void Program::ClearUniforms(std::vector<uint8_t>* zero_buffer) {
498 DCHECK(zero_buffer); 499 DCHECK(zero_buffer);
499 if (uniforms_cleared_) { 500 if (uniforms_cleared_) {
500 return; 501 return;
501 } 502 }
502 uniforms_cleared_ = true; 503 uniforms_cleared_ = true;
503 for (const UniformInfo& uniform_info : uniform_infos_) { 504 for (const UniformInfo& uniform_info : uniform_infos_) {
504 GLint location = uniform_info.element_locations[0]; 505 GLint location = uniform_info.element_locations[0];
(...skipping 2059 matching lines...) Expand 10 before | Expand all | Expand 10 after
2564 DCHECK(program); 2565 DCHECK(program);
2565 program->ClearUniforms(&zero_); 2566 program->ClearUniforms(&zero_);
2566 } 2567 }
2567 2568
2568 int32_t ProgramManager::MakeFakeLocation(int32_t index, int32_t element) { 2569 int32_t ProgramManager::MakeFakeLocation(int32_t index, int32_t element) {
2569 return index + element * 0x10000; 2570 return index + element * 0x10000;
2570 } 2571 }
2571 2572
2572 } // namespace gles2 2573 } // namespace gles2
2573 } // namespace gpu 2574 } // 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