| 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 50 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 61 case GL_VERTEX_SHADER: | 61 case GL_VERTEX_SHADER: |
| 62 return 0; | 62 return 0; |
| 63 case GL_FRAGMENT_SHADER: | 63 case GL_FRAGMENT_SHADER: |
| 64 return 1; | 64 return 1; |
| 65 default: | 65 default: |
| 66 NOTREACHED(); | 66 NOTREACHED(); |
| 67 return 0; | 67 return 0; |
| 68 } | 68 } |
| 69 } | 69 } |
| 70 | 70 |
| 71 ShaderTranslator* ShaderIndexToTranslator( | |
| 72 int index, | |
| 73 ShaderTranslator* vertex_translator, | |
| 74 ShaderTranslator* fragment_translator) { | |
| 75 switch (index) { | |
| 76 case 0: | |
| 77 return vertex_translator; | |
| 78 case 1: | |
| 79 return fragment_translator; | |
| 80 default: | |
| 81 NOTREACHED(); | |
| 82 return NULL; | |
| 83 } | |
| 84 } | |
| 85 | |
| 86 // Given a name like "foo.bar[123].moo[456]" sets new_name to "foo.bar[123].moo" | 71 // Given a name like "foo.bar[123].moo[456]" sets new_name to "foo.bar[123].moo" |
| 87 // and sets element_index to 456. returns false if element expression was not a | 72 // and sets element_index to 456. returns false if element expression was not a |
| 88 // whole decimal number. For example: "foo[1b2]" | 73 // whole decimal number. For example: "foo[1b2]" |
| 89 bool GetUniformNameSansElement( | 74 bool GetUniformNameSansElement( |
| 90 const std::string& name, int* element_index, std::string* new_name) { | 75 const std::string& name, int* element_index, std::string* new_name) { |
| 91 DCHECK(element_index); | 76 DCHECK(element_index); |
| 92 DCHECK(new_name); | 77 DCHECK(new_name); |
| 93 if (name.size() < 3 || name[name.size() - 1] != ']') { | 78 if (name.size() < 3 || name[name.size() - 1] != ']') { |
| 94 *element_index = 0; | 79 *element_index = 0; |
| 95 *new_name = name; | 80 *new_name = name; |
| (...skipping 1273 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1369 program->ClearUniforms(&zero_); | 1354 program->ClearUniforms(&zero_); |
| 1370 } | 1355 } |
| 1371 } | 1356 } |
| 1372 | 1357 |
| 1373 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) { | 1358 int32 ProgramManager::MakeFakeLocation(int32 index, int32 element) { |
| 1374 return index + element * 0x10000; | 1359 return index + element * 0x10000; |
| 1375 } | 1360 } |
| 1376 | 1361 |
| 1377 } // namespace gles2 | 1362 } // namespace gles2 |
| 1378 } // namespace gpu | 1363 } // namespace gpu |
| OLD | NEW |