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

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

Issue 11770002: Fix crash when translated ANGLE shader source has length zero. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Created 7 years, 11 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 454 matching lines...) Expand 10 before | Expand all | Expand 10 after
465 GLint max_len = 0; 465 GLint max_len = 0;
466 glGetShaderiv(info->service_id(), 466 glGetShaderiv(info->service_id(),
467 GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE, 467 GL_TRANSLATED_SHADER_SOURCE_LENGTH_ANGLE,
468 &max_len); 468 &max_len);
469 scoped_array<char> temp(new char[max_len]); 469 scoped_array<char> temp(new char[max_len]);
470 GLint len = 0; 470 GLint len = 0;
471 glGetTranslatedShaderSourceANGLE( 471 glGetTranslatedShaderSourceANGLE(
472 info->service_id(), max_len, &len, temp.get()); 472 info->service_id(), max_len, &len, temp.get());
473 DCHECK(max_len == 0 || len < max_len); 473 DCHECK(max_len == 0 || len < max_len);
474 DCHECK(len == 0 || temp[len] == '\0'); 474 DCHECK(len == 0 || temp[len] == '\0');
475 info->UpdateTranslatedSource(temp.get()); 475 info->UpdateTranslatedSource(max_len ? temp.get() : NULL);
476 } 476 }
477 477
478 GLint status = GL_FALSE; 478 GLint status = GL_FALSE;
479 glGetShaderiv(info->service_id(), GL_COMPILE_STATUS, &status); 479 glGetShaderiv(info->service_id(), GL_COMPILE_STATUS, &status);
480 if (status) { 480 if (status) {
481 info->SetStatus(true, "", translator); 481 info->SetStatus(true, "", translator);
482 if (program_cache_) { 482 if (program_cache_) {
483 const char* untranslated_source = source ? source->c_str() : ""; 483 const char* untranslated_source = source ? source->c_str() : "";
484 program_cache_->ShaderCompilationSucceeded(untranslated_source); 484 program_cache_->ShaderCompilationSucceeded(untranslated_source);
485 } 485 }
(...skipping 691 matching lines...) Expand 10 before | Expand all | Expand 10 after
1177 info->ClearUniforms(&zero_); 1177 info->ClearUniforms(&zero_);
1178 } 1178 }
1179 } 1179 }
1180 1180
1181 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) { 1181 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) {
1182 return index + element * 0x10000; 1182 return index + element * 0x10000;
1183 } 1183 }
1184 1184
1185 } // namespace gles2 1185 } // namespace gles2
1186 } // namespace gpu 1186 } // 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