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 <stddef.h> | 7 #include <stddef.h> |
8 #include <stdint.h> | 8 #include <stdint.h> |
9 | 9 |
10 #include <algorithm> | 10 #include <algorithm> |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 } | 52 } |
53 } | 53 } |
54 | 54 |
55 // Given a name like "foo.bar[123].moo[456]" sets new_name to "foo.bar[123].moo" | 55 // Given a name like "foo.bar[123].moo[456]" sets new_name to "foo.bar[123].moo" |
56 // and sets element_index to 456. returns false if element expression was not a | 56 // and sets element_index to 456. returns false if element expression was not a |
57 // whole decimal number. For example: "foo[1b2]" | 57 // whole decimal number. For example: "foo[1b2]" |
58 bool GetUniformNameSansElement( | 58 bool GetUniformNameSansElement( |
59 const std::string& name, int* element_index, std::string* new_name) { | 59 const std::string& name, int* element_index, std::string* new_name) { |
60 DCHECK(element_index); | 60 DCHECK(element_index); |
61 DCHECK(new_name); | 61 DCHECK(new_name); |
62 if (name.size() < 3 || name[name.size() - 1] != ']') { | 62 if (name.size() < 3 || name.back() != ']') { |
63 *element_index = 0; | 63 *element_index = 0; |
64 *new_name = name; | 64 *new_name = name; |
65 return true; | 65 return true; |
66 } | 66 } |
67 | 67 |
68 // Look for an array specification. | 68 // Look for an array specification. |
69 size_t open_pos = name.find_last_of('['); | 69 size_t open_pos = name.find_last_of('['); |
70 if (open_pos == std::string::npos || | 70 if (open_pos == std::string::npos || |
71 open_pos >= name.size() - 2) { | 71 open_pos >= name.size() - 2) { |
72 return false; | 72 return false; |
(...skipping 1569 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1642 return true; | 1642 return true; |
1643 } | 1643 } |
1644 continue; | 1644 continue; |
1645 } | 1645 } |
1646 | 1646 |
1647 if (!hit->second.isSameVaryingAtLinkTime(key_value.second, | 1647 if (!hit->second.isSameVaryingAtLinkTime(key_value.second, |
1648 shader_version)) { | 1648 shader_version)) { |
1649 *conflicting_name = name; | 1649 *conflicting_name = name; |
1650 return true; | 1650 return true; |
1651 } | 1651 } |
1652 | |
1653 } | 1652 } |
1654 return false; | 1653 return false; |
1655 } | 1654 } |
1656 | 1655 |
1657 bool Program::DetectFragmentInputLocationBindingConflicts() const { | 1656 bool Program::DetectFragmentInputLocationBindingConflicts() const { |
1658 auto shader = attached_shaders_[ShaderTypeToIndex(GL_FRAGMENT_SHADER)].get(); | 1657 auto shader = attached_shaders_[ShaderTypeToIndex(GL_FRAGMENT_SHADER)].get(); |
1659 if (!shader || !shader->valid()) | 1658 if (!shader || !shader->valid()) |
1660 return false; | 1659 return false; |
1661 | 1660 |
1662 std::set<GLint> location_binding_used; | 1661 std::set<GLint> location_binding_used; |
(...skipping 704 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2367 DCHECK(program); | 2366 DCHECK(program); |
2368 program->ClearUniforms(&zero_); | 2367 program->ClearUniforms(&zero_); |
2369 } | 2368 } |
2370 | 2369 |
2371 int32_t ProgramManager::MakeFakeLocation(int32_t index, int32_t element) { | 2370 int32_t ProgramManager::MakeFakeLocation(int32_t index, int32_t element) { |
2372 return index + element * 0x10000; | 2371 return index + element * 0x10000; |
2373 } | 2372 } |
2374 | 2373 |
2375 } // namespace gles2 | 2374 } // namespace gles2 |
2376 } // namespace gpu | 2375 } // namespace gpu |
OLD | NEW |