| Index: gpu/command_buffer/service/program_manager.cc
|
| diff --git a/gpu/command_buffer/service/program_manager.cc b/gpu/command_buffer/service/program_manager.cc
|
| index f1a0400f6650891a598712d0020ce8848c5a1316..27f2e6ca3b5da4591f7c9a3992579fd583ca0cfb 100644
|
| --- a/gpu/command_buffer/service/program_manager.cc
|
| +++ b/gpu/command_buffer/service/program_manager.cc
|
| @@ -576,6 +576,13 @@ void ProgramManager::ProgramInfo::Validate() {
|
|
|
| GLint ProgramManager::ProgramInfo::GetUniformFakeLocation(
|
| const std::string& name) const {
|
| + bool getting_array_location = false;
|
| + size_t open_pos = std::string::npos;
|
| + int index = 0;
|
| + if (!GLES2Util::ParseUniformName(
|
| + name, &open_pos, &index, &getting_array_location)) {
|
| + return -1;
|
| + }
|
| for (GLuint ii = 0; ii < uniform_infos_.size(); ++ii) {
|
| const UniformInfo& info = uniform_infos_[ii];
|
| if (!info.IsValid()) {
|
| @@ -585,26 +592,12 @@ GLint ProgramManager::ProgramInfo::GetUniformFakeLocation(
|
| (info.is_array &&
|
| info.name.compare(0, info.name.size() - 3, name) == 0)) {
|
| return info.fake_location_base;
|
| - } else if (info.is_array &&
|
| - name.size() >= 3 && name[name.size() - 1] == ']') {
|
| + } else if (getting_array_location && info.is_array) {
|
| // Look for an array specification.
|
| - size_t open_pos = name.find_last_of('[');
|
| - if (open_pos != std::string::npos &&
|
| - open_pos < name.size() - 2 &&
|
| - info.name.size() > open_pos &&
|
| + size_t open_pos_2 = info.name.find_last_of('[');
|
| + if (open_pos_2 == open_pos &&
|
| name.compare(0, open_pos, info.name, 0, open_pos) == 0) {
|
| - GLint index = 0;
|
| - size_t last = name.size() - 1;
|
| - bool bad = false;
|
| - for (size_t pos = open_pos + 1; pos < last; ++pos) {
|
| - int8 digit = name[pos] - '0';
|
| - if (digit < 0 || digit > 9) {
|
| - bad = true;
|
| - break;
|
| - }
|
| - index = index * 10 + digit;
|
| - }
|
| - if (!bad && index >= 0 && index < info.size) {
|
| + if (index >= 0 && index < info.size) {
|
| return ProgramManager::MakeFakeLocation(
|
| info.fake_location_base, index);
|
| }
|
|
|