OLD | NEW |
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 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
50 default: | 50 default: |
51 NOTREACHED(); | 51 NOTREACHED(); |
52 return NULL; | 52 return NULL; |
53 } | 53 } |
54 } | 54 } |
55 | 55 |
56 // Given a name like "foo.bar[123].moo[456]" sets new_name to "foo.bar[123].moo" | 56 // Given a name like "foo.bar[123].moo[456]" sets new_name to "foo.bar[123].moo" |
57 // and sets element_index to 456. returns false if element expression was not a | 57 // and sets element_index to 456. returns false if element expression was not a |
58 // whole decimal number. For example: "foo[1b2]" | 58 // whole decimal number. For example: "foo[1b2]" |
59 bool GetUniformNameSansElement( | 59 bool GetUniformNameSansElement( |
60 const std::string name, int* element_index, std::string* new_name) { | 60 const std::string& name, int* element_index, std::string* new_name) { |
61 DCHECK(element_index); | 61 DCHECK(element_index); |
62 DCHECK(new_name); | 62 DCHECK(new_name); |
63 if (name.size() < 3 || name[name.size() - 1] != ']') { | 63 if (name.size() < 3 || name[name.size() - 1] != ']') { |
64 *element_index = 0; | 64 *element_index = 0; |
65 *new_name = name; | 65 *new_name = name; |
66 return true; | 66 return true; |
67 } | 67 } |
68 | 68 |
69 // Look for an array specification. | 69 // Look for an array specification. |
70 size_t open_pos = name.find_last_of('['); | 70 size_t open_pos = name.find_last_of('['); |
(...skipping 1043 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1114 info->ClearUniforms(&zero_); | 1114 info->ClearUniforms(&zero_); |
1115 } | 1115 } |
1116 } | 1116 } |
1117 | 1117 |
1118 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) { | 1118 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) { |
1119 return index + element * 0x10000; | 1119 return index + element * 0x10000; |
1120 } | 1120 } |
1121 | 1121 |
1122 } // namespace gles2 | 1122 } // namespace gles2 |
1123 } // namespace gpu | 1123 } // namespace gpu |
1124 | |
1125 | |
OLD | NEW |