| OLD | NEW |
| 1 #!/usr/bin/env python | 1 #!/usr/bin/env python |
| 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. | 2 # Copyright (c) 2012 The Chromium Authors. All rights reserved. |
| 3 # Use of this source code is governed by a BSD-style license that can be | 3 # Use of this source code is governed by a BSD-style license that can be |
| 4 # found in the LICENSE file. | 4 # found in the LICENSE file. |
| 5 | 5 |
| 6 """code generator for GLES2 command buffers.""" | 6 """code generator for GLES2 command buffers.""" |
| 7 | 7 |
| 8 import itertools | 8 import itertools |
| 9 import os | 9 import os |
| 10 import os.path | 10 import os.path |
| (...skipping 10930 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 10941 f.write(code % { | 10941 f.write(code % { |
| 10942 'name': ToUnderscore(name), | 10942 'name': ToUnderscore(name), |
| 10943 }) | 10943 }) |
| 10944 if named_type.GetValidValuesES3(): | 10944 if named_type.GetValidValuesES3(): |
| 10945 code = """ %(name)s.AddValues( | 10945 code = """ %(name)s.AddValues( |
| 10946 valid_%(name)s_table_es3, arraysize(valid_%(name)s_table_es3)); | 10946 valid_%(name)s_table_es3, arraysize(valid_%(name)s_table_es3)); |
| 10947 """ | 10947 """ |
| 10948 f.write(code % { | 10948 f.write(code % { |
| 10949 'name': ToUnderscore(name), | 10949 'name': ToUnderscore(name), |
| 10950 }) | 10950 }) |
| 10951 f.write("UpdateETCCompressedTextureFormats();"); | |
| 10952 f.write("}\n\n"); | 10951 f.write("}\n\n"); |
| 10953 | 10952 |
| 10954 f.write("void Validators::UpdateETCCompressedTextureFormats() {\n") | 10953 f.write("void Validators::UpdateETCCompressedTextureFormats() {\n") |
| 10955 for name in ['CompressedTextureFormat', 'TextureInternalFormatStorage']: | 10954 for name in ['CompressedTextureFormat', 'TextureInternalFormatStorage']: |
| 10956 for fmt in _ETC_COMPRESSED_TEXTURE_FORMATS: | 10955 for fmt in _ETC_COMPRESSED_TEXTURE_FORMATS: |
| 10957 code = """ %(name)s.AddValue(%(format)s); | 10956 code = """ %(name)s.AddValue(%(format)s); |
| 10958 """ | 10957 """ |
| 10959 f.write(code % { | 10958 f.write(code % { |
| 10960 'name': ToUnderscore(name), | 10959 'name': ToUnderscore(name), |
| 10961 'format': fmt, | 10960 'format': fmt, |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11015 enums = sorted(_NAMED_TYPE_INFO.keys()) | 11014 enums = sorted(_NAMED_TYPE_INFO.keys()) |
| 11016 for enum in enums: | 11015 for enum in enums: |
| 11017 if _NAMED_TYPE_INFO[enum]['type'] == 'GLenum': | 11016 if _NAMED_TYPE_INFO[enum]['type'] == 'GLenum': |
| 11018 f.write("std::string GLES2Util::GetString%s(uint32_t value) {\n" % | 11017 f.write("std::string GLES2Util::GetString%s(uint32_t value) {\n" % |
| 11019 enum) | 11018 enum) |
| 11020 valid_list = _NAMED_TYPE_INFO[enum]['valid'] | 11019 valid_list = _NAMED_TYPE_INFO[enum]['valid'] |
| 11021 if 'valid_es3' in _NAMED_TYPE_INFO[enum]: | 11020 if 'valid_es3' in _NAMED_TYPE_INFO[enum]: |
| 11022 for es3_enum in _NAMED_TYPE_INFO[enum]['valid_es3']: | 11021 for es3_enum in _NAMED_TYPE_INFO[enum]['valid_es3']: |
| 11023 if not es3_enum in valid_list: | 11022 if not es3_enum in valid_list: |
| 11024 valid_list.append(es3_enum) | 11023 valid_list.append(es3_enum) |
| 11025 if enum in [ | |
| 11026 'CompressedTextureFormat', | |
| 11027 'TextureInternalFormatStorage', | |
| 11028 ]: | |
| 11029 for es3_enum in _ETC_COMPRESSED_TEXTURE_FORMATS: | |
| 11030 valid_list.append(es3_enum) | |
| 11031 assert len(valid_list) == len(set(valid_list)) | 11024 assert len(valid_list) == len(set(valid_list)) |
| 11032 if len(valid_list) > 0: | 11025 if len(valid_list) > 0: |
| 11033 f.write(" static const EnumToString string_table[] = {\n") | 11026 f.write(" static const EnumToString string_table[] = {\n") |
| 11034 for value in valid_list: | 11027 for value in valid_list: |
| 11035 f.write(' { %s, "%s" },\n' % (value, value)) | 11028 f.write(' { %s, "%s" },\n' % (value, value)) |
| 11036 f.write(""" }; | 11029 f.write(""" }; |
| 11037 return GLES2Util::GetQualifiedEnumString( | 11030 return GLES2Util::GetQualifiedEnumString( |
| 11038 string_table, arraysize(string_table), value); | 11031 string_table, arraysize(string_table), value); |
| 11039 } | 11032 } |
| 11040 | 11033 |
| (...skipping 301 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 11342 Format(gen.generated_cpp_filenames) | 11335 Format(gen.generated_cpp_filenames) |
| 11343 | 11336 |
| 11344 if gen.errors > 0: | 11337 if gen.errors > 0: |
| 11345 print "%d errors" % gen.errors | 11338 print "%d errors" % gen.errors |
| 11346 return 1 | 11339 return 1 |
| 11347 return 0 | 11340 return 0 |
| 11348 | 11341 |
| 11349 | 11342 |
| 11350 if __name__ == '__main__': | 11343 if __name__ == '__main__': |
| 11351 sys.exit(main(sys.argv[1:])) | 11344 sys.exit(main(sys.argv[1:])) |
| OLD | NEW |