OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 | 8 |
9 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
10 #include "base/logging.h" | 10 #include "base/logging.h" |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
197 } | 197 } |
198 | 198 |
199 const ProgramManager::ProgramInfo::UniformInfo* | 199 const ProgramManager::ProgramInfo::UniformInfo* |
200 ProgramManager::ProgramInfo::AddUniformInfo( | 200 ProgramManager::ProgramInfo::AddUniformInfo( |
201 GLsizei size, GLenum type, GLint location, const std::string& name) { | 201 GLsizei size, GLenum type, GLint location, const std::string& name) { |
202 const char* kArraySpec = "[0]"; | 202 const char* kArraySpec = "[0]"; |
203 uniform_infos_.push_back(UniformInfo(size, type, name)); | 203 uniform_infos_.push_back(UniformInfo(size, type, name)); |
204 UniformInfo& info = uniform_infos_.back(); | 204 UniformInfo& info = uniform_infos_.back(); |
205 info.element_locations.resize(size); | 205 info.element_locations.resize(size); |
206 info.element_locations[0] = location; | 206 info.element_locations[0] = location; |
207 size_t num_texture_units = info.IsSampler() ? size : 0u; | 207 DCHECK_GE(size, 0); |
| 208 size_t num_texture_units = info.IsSampler() ? static_cast<size_t>(size) : 0u; |
208 info.texture_units.clear(); | 209 info.texture_units.clear(); |
209 info.texture_units.resize(num_texture_units, 0); | 210 info.texture_units.resize(num_texture_units, 0); |
210 | 211 |
211 if (size > 1) { | 212 if (size > 1) { |
212 // Sadly there is no way to tell if this is an array except if the name | 213 // Sadly there is no way to tell if this is an array except if the name |
213 // has an array string or the size > 1. That means an array of size 1 can | 214 // has an array string or the size > 1. That means an array of size 1 can |
214 // be ambiguous. | 215 // be ambiguous. |
215 // | 216 // |
216 // For now we just make sure that if the size is > 1 then the name must have | 217 // For now we just make sure that if the size is > 1 then the name must have |
217 // an array spec. | 218 // an array spec. |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
362 return true; | 363 return true; |
363 } | 364 } |
364 } | 365 } |
365 return false; | 366 return false; |
366 } | 367 } |
367 | 368 |
368 } // namespace gles2 | 369 } // namespace gles2 |
369 } // namespace gpu | 370 } // namespace gpu |
370 | 371 |
371 | 372 |
OLD | NEW |