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 #include <algorithm> | 7 #include <algorithm> |
| 8 |
7 #include "base/basictypes.h" | 9 #include "base/basictypes.h" |
8 #include "base/logging.h" | 10 #include "base/logging.h" |
9 #include "base/scoped_ptr.h" | 11 #include "base/scoped_ptr.h" |
10 #include "base/string_util.h" | 12 #include "base/string_number_conversions.h" |
11 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" | 13 #include "gpu/command_buffer/service/gles2_cmd_decoder.h" |
12 | 14 |
13 namespace gpu { | 15 namespace gpu { |
14 namespace gles2 { | 16 namespace gles2 { |
15 | 17 |
16 static int ShaderTypeToIndex(GLenum shader_type) { | 18 static int ShaderTypeToIndex(GLenum shader_type) { |
17 switch (shader_type) { | 19 switch (shader_type) { |
18 case GL_VERTEX_SHADER: | 20 case GL_VERTEX_SHADER: |
19 return 0; | 21 return 0; |
20 case GL_FRAGMENT_SHADER: | 22 case GL_FRAGMENT_SHADER: |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
220 size_t array_pos = name.rfind(kArraySpec); | 222 size_t array_pos = name.rfind(kArraySpec); |
221 std::string base_name = name; | 223 std::string base_name = name; |
222 if (name.size() > 3) { | 224 if (name.size() > 3) { |
223 if (array_pos != name.size() - 3) { | 225 if (array_pos != name.size() - 3) { |
224 info.name = name + kArraySpec; | 226 info.name = name + kArraySpec; |
225 } else { | 227 } else { |
226 base_name = name.substr(0, name.size() - 3); | 228 base_name = name.substr(0, name.size() - 3); |
227 } | 229 } |
228 } | 230 } |
229 for (GLsizei ii = 1; ii < info.size; ++ii) { | 231 for (GLsizei ii = 1; ii < info.size; ++ii) { |
230 std::string element_name(base_name + "[" + IntToString(ii) + "]"); | 232 std::string element_name(base_name + "[" + base::IntToString(ii) + "]"); |
231 info.element_locations[ii] = | 233 info.element_locations[ii] = |
232 glGetUniformLocation(service_id_, element_name.c_str()); | 234 glGetUniformLocation(service_id_, element_name.c_str()); |
233 } | 235 } |
234 } | 236 } |
235 | 237 |
236 info.is_array = | 238 info.is_array = |
237 (size > 1 || | 239 (size > 1 || |
238 (info.name.size() > 3 && | 240 (info.name.size() > 3 && |
239 info.name.rfind(kArraySpec) == info.name.size() - 3)); | 241 info.name.rfind(kArraySpec) == info.name.size() - 3)); |
240 | 242 |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
360 return true; | 362 return true; |
361 } | 363 } |
362 } | 364 } |
363 return false; | 365 return false; |
364 } | 366 } |
365 | 367 |
366 } // namespace gles2 | 368 } // namespace gles2 |
367 } // namespace gpu | 369 } // namespace gpu |
368 | 370 |
369 | 371 |
OLD | NEW |