Commit 14f8918c by Cody Northrop Committed by Commit Bot

Migrate more scripts to python3

Test: python3 scripts/run_code_generation.py Bug: angleproject:5707 Change-Id: I5abae69c1c6bf03cc418f10beaabc80288fa1c94 Reviewed-on: https://chromium-review.googlesource.com/c/angle/angle/+/2828979Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarShahbaz Youssefi <syoussefi@chromium.org> Commit-Queue: Cody Northrop <cnorthrop@google.com>
parent 69a26def
......@@ -4,11 +4,11 @@
"src/libANGLE/renderer/Format_table_autogen.cpp":
"969f821f7241fbc3df16864daeafa68e",
"src/libANGLE/renderer/angle_format.py":
"e5ac2fcfbc930ac2e3f3d54effeafed9",
"35b819b32d3259961da75f5c971baba4",
"src/libANGLE/renderer/angle_format_data.json":
"4b3b5d4beef95c282ba4f20fdc2b20ed",
"src/libANGLE/renderer/angle_format_map.json":
"46b589fc0fc306b2f7c97ee7bb08baee",
"src/libANGLE/renderer/gen_angle_format_table.py":
"428255701f3a3a9630593ab110ca98c1"
"70bdbceee30506d4b14bf52f2bbd8f2b"
}
\ No newline at end of file
{
"src/libANGLE/renderer/angle_format.py":
"e5ac2fcfbc930ac2e3f3d54effeafed9",
"35b819b32d3259961da75f5c971baba4",
"src/libANGLE/renderer/gen_load_functions_table.py":
"bbc2f2cbce34313d7c06a3511eff5a1f",
"c131c494e7e0b35b65a8a097b4b8e5ce",
"src/libANGLE/renderer/load_functions_data.json":
"912670e6835fbe5074533bbeba44ef02",
"src/libANGLE/renderer/load_functions_table_autogen.cpp":
......
{
"src/compiler/generate_parser_tools.py":
"78362c0f409423550b6b22a88c0ca64b",
"6a34ad911710a45e5644e9f79dfd2ce5",
"src/compiler/preprocessor/generate_parser.py":
"cc871de99688a35bfe32ef501f965d5a",
"src/compiler/preprocessor/preprocessor.l":
......
{
"src/compiler/generate_parser_tools.py":
"78362c0f409423550b6b22a88c0ca64b",
"6a34ad911710a45e5644e9f79dfd2ce5",
"src/compiler/translator/generate_parser.py":
"566178ecdfae3a29803b3687fc518ebb",
"src/compiler/translator/glslang.l":
......
{
"src/libANGLE/renderer/angle_format.py":
"e5ac2fcfbc930ac2e3f3d54effeafed9",
"35b819b32d3259961da75f5c971baba4",
"src/libANGLE/renderer/d3d/d3d11/gen_texture_format_table.py":
"8ad208de51aafef78452ae7f6cf8b340",
"bbb56f0a35bb2506524654444c8210d3",
"src/libANGLE/renderer/d3d/d3d11/texture_format_data.json":
"b491f92f2adadad269248eb17dee8821",
"src/libANGLE/renderer/d3d/d3d11/texture_format_map.json":
......
{
"src/libANGLE/renderer/angle_format.py":
"e5ac2fcfbc930ac2e3f3d54effeafed9",
"35b819b32d3259961da75f5c971baba4",
"src/libANGLE/renderer/angle_format_map.json":
"46b589fc0fc306b2f7c97ee7bb08baee",
"src/libANGLE/renderer/dxgi_format_data.json":
......@@ -8,5 +8,5 @@
"src/libANGLE/renderer/dxgi_format_map_autogen.cpp":
"974308ca798476dfaa076fb864478310",
"src/libANGLE/renderer/gen_dxgi_format_table.py":
"8540567c885f88cbac66b7dc96b2dc10"
"317faa90fd375c39cc8fbefe897604b3"
}
\ No newline at end of file
......@@ -4,5 +4,5 @@
"src/libANGLE/renderer/dxgi_support_table_autogen.cpp":
"220fadac8434f87259bc47c1473a309d",
"src/libANGLE/renderer/gen_dxgi_support_tables.py":
"c6a42175680fc5ac6fd62ba3c5e8a2f9"
"7f015104b9124627d3e962972284e507"
}
\ No newline at end of file
......@@ -4,5 +4,5 @@
"src/compiler/translator/emulated_builtin_functions_hlsl_autogen.cpp":
"eeb085d4abc08e7dd15a1db8807efed6",
"src/compiler/translator/gen_emulated_builtin_function_tables.py":
"6e8fce6e03e32cf3b6a7350865621bdb"
"0150347bc316e7c3772a7c1492c588b8"
}
\ No newline at end of file
......@@ -4,7 +4,7 @@
"src/libANGLE/es3_copy_conversion_table_autogen.cpp":
"c8418c317a331e54a6913c407e47aafb",
"src/libANGLE/gen_copy_conversion_table.py":
"52b879061499e456a3469da3d452f6c5",
"0a73b7580342b9e27d4c71ade3af55e5",
"src/libANGLE/renderer/angle_format.py":
"e5ac2fcfbc930ac2e3f3d54effeafed9"
"35b819b32d3259961da75f5c971baba4"
}
\ No newline at end of file
......@@ -2,11 +2,11 @@
"src/libANGLE/es3_format_type_combinations.json":
"b7d0c224864b87afd09a557a0099c2bb",
"src/libANGLE/format_map_autogen.cpp":
"18a0f3e044cfefb36cbbdfec6b4b1654",
"b71c162b72facbbe89d2366b5e7cc4bf",
"src/libANGLE/format_map_data.json":
"2e5db33b6d6b142b569123f614f3ddb7",
"src/libANGLE/gen_format_map.py":
"4062c6247b9c81ab3e8e6422fbd55349",
"2421e2cfb4e074ae3fa6baa031c6394e",
"src/libANGLE/renderer/angle_format.py":
"e5ac2fcfbc930ac2e3f3d54effeafed9"
"35b819b32d3259961da75f5c971baba4"
}
\ No newline at end of file
{
"src/libANGLE/renderer/angle_format.py":
"e5ac2fcfbc930ac2e3f3d54effeafed9",
"35b819b32d3259961da75f5c971baba4",
"src/libANGLE/renderer/angle_format_map.json":
"46b589fc0fc306b2f7c97ee7bb08baee",
"src/libANGLE/renderer/gen_angle_format_table.py":
"428255701f3a3a9630593ab110ca98c1",
"70bdbceee30506d4b14bf52f2bbd8f2b",
"src/libANGLE/renderer/metal/shaders/blit.metal":
"2f6286729703039d41d0f6a109a23ac2",
"src/libANGLE/renderer/metal/shaders/clear.metal":
......@@ -22,7 +22,7 @@
"src/libANGLE/renderer/metal/shaders/gen_mipmap.metal":
"54dca94c48bead446624079070b9b309",
"src/libANGLE/renderer/metal/shaders/gen_mtl_internal_shaders.py":
"af7a98ffaa3f3885b1e3cc7160c8549b",
"ba74ebbfa2ceb825f36e84f2985b3d3d",
"src/libANGLE/renderer/metal/shaders/mtl_default_shaders_src_autogen.inc":
"94260983944013d7b094aaab74f37a17",
"src/libANGLE/renderer/metal/shaders/visibility.metal":
......
{
"src/libANGLE/renderer/angle_format.py":
"e5ac2fcfbc930ac2e3f3d54effeafed9",
"35b819b32d3259961da75f5c971baba4",
"src/libANGLE/renderer/angle_format_map.json":
"46b589fc0fc306b2f7c97ee7bb08baee",
"src/libANGLE/renderer/metal/gen_mtl_format_table.py":
......
......@@ -2,13 +2,13 @@
"scripts/gl.xml":
"2a73a58a7e26d8676a2c0af6d528cae6",
"src/libANGLE/renderer/angle_format.py":
"e5ac2fcfbc930ac2e3f3d54effeafed9",
"35b819b32d3259961da75f5c971baba4",
"src/libANGLE/renderer/gl/DispatchTableGL_autogen.cpp":
"54a5c8b87d54114ee61a4c535931ea48",
"src/libANGLE/renderer/gl/DispatchTableGL_autogen.h":
"e41b2685228feb5c20b5c1400837c055",
"src/libANGLE/renderer/gl/generate_gl_dispatch_table.py":
"30e1c2d60a3f81bcc354dcad5a8d9ec2",
"d133c757b44279ad205183c9c9c9b598",
"src/libANGLE/renderer/gl/gl_bindings_data.json":
"6f46f537e07b457850c060ef0c7b76c5",
"src/libANGLE/renderer/gl/null_functions.cpp":
......
{
"src/libANGLE/renderer/angle_format.py":
"e5ac2fcfbc930ac2e3f3d54effeafed9",
"35b819b32d3259961da75f5c971baba4",
"src/libANGLE/renderer/angle_format_map.json":
"46b589fc0fc306b2f7c97ee7bb08baee",
"src/libANGLE/renderer/vulkan/gen_vk_format_table.py":
"bcd28f46d41727b93943129edfeda12d",
"ffeebc0e8ec8db860e472c7cf04cd880",
"src/libANGLE/renderer/vulkan/vk_format_map.json":
"3b4563c98576280cbe4bcb9af4aafdde",
"src/libANGLE/renderer/vulkan/vk_format_table_autogen.cpp":
"c5e18754528e417628eb72186b8465ce"
"459f920b945c11152539e9241de46a95"
}
\ No newline at end of file
{
"src/libANGLE/renderer/angle_format.py":
"e5ac2fcfbc930ac2e3f3d54effeafed9",
"35b819b32d3259961da75f5c971baba4",
"src/libANGLE/renderer/vulkan/gen_vk_mandatory_format_support_table.py":
"3e2b8cd80373275e862bb7c8ba20a745",
"src/libANGLE/renderer/vulkan/vk_format_map.json":
......
......@@ -2,7 +2,7 @@
"src/tests/restricted_traces/.gitignore":
"9e34de23403add0a73d889d998971292",
"src/tests/restricted_traces/gen_restricted_traces.py":
"7cc5d772c8e18a58224ab4436fc3a205",
"f700505c2ba8299a6ce68962763d7f2d",
"src/tests/restricted_traces/restricted_traces.json":
"1ba9185b74b0c64bcbd98226219f0e3c",
"src/tests/restricted_traces/restricted_traces_autogen.cpp":
......
{
"src/common/gen_uniform_type_table.py":
"714cdb13f7c30af4890922a856456ddb",
"f57829d5e5b97ac1dcb8a95316736de9",
"src/common/uniform_type_info_autogen.cpp":
"85b351f2d5525d1af422a880e361a2bd"
}
\ No newline at end of file
#!/usr/bin/python
#!/usr/bin/python3
# Copyright 2017 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -255,9 +255,9 @@ def main():
outputs = ['uniform_type_info_autogen.cpp']
if sys.argv[1] == 'inputs':
print ','.join(inputs)
print(','.join(inputs))
elif sys.argv[1] == 'outputs':
print ','.join(outputs)
print(','.join(outputs))
else:
print('Invalid script parameters')
return 1
......
#!/usr/bin/python
#!/usr/bin/python3
# Copyright 2019 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -148,12 +148,12 @@ def generate_parser(basename, generate_header):
# Call flex and bison to generate the lexer and parser.
flex_result = run_flex(basename)
if flex_result != 0:
print 'Failed to run flex. Error ' + str(flex_result)
print('Failed to run flex. Error %s' % str(flex_result))
return 1
bison_result = run_bison(basename, generate_header)
if bison_result != 0:
print 'Failed to run bison. Error ' + str(bison_result)
print('Failed to run bison. Error %s' % str(bison_result))
return 2
return 0
#!/usr/bin/python
#!/usr/bin/python3
# Copyright 2017 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -122,9 +122,9 @@ def main():
outputs = [hlsl_fname]
if sys.argv[1] == 'inputs':
print ','.join(inputs)
print(','.join(inputs))
elif sys.argv[1] == 'outputs':
print ','.join(outputs)
print(','.join(outputs))
else:
print('Invalid script parameters')
return 1
......
#!/usr/bin/python
#!/usr/bin/python3
# Copyright 2016 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -77,9 +77,9 @@ def main():
outputs = [out_file_name]
if sys.argv[1] == 'inputs':
print ','.join(inputs)
print(','.join(inputs))
elif sys.argv[1] == 'outputs':
print ','.join(outputs)
print(','.join(outputs))
else:
print('Invalid script parameters')
return 1
......@@ -89,7 +89,7 @@ def main():
format_map = {}
for description, data in json_data.iteritems():
for description, data in sorted(json_data.items()):
for texture_format, framebuffer_format in data:
if texture_format not in format_map:
format_map[texture_format] = []
......@@ -97,7 +97,7 @@ def main():
texture_format_cases = ""
for texture_format, framebuffer_formats in sorted(format_map.iteritems()):
for texture_format, framebuffer_formats in sorted(format_map.items()):
texture_format_cases += parse_texture_format_case(texture_format, framebuffer_formats)
with open(out_file_name, 'wt') as out_file:
......
#!/usr/bin/python
#!/usr/bin/python3
# Copyright 2016 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -117,7 +117,7 @@ def parse_type_case(type, result):
def parse_format_case(format, type_map):
type_cases = ""
for type, internal_format in sorted(type_map.iteritems()):
for type, internal_format in sorted(type_map.items()):
type_cases += parse_type_case(type, internal_format)
return template_format_case.format(format=format, type_cases=type_cases)
......@@ -132,9 +132,9 @@ def main():
outputs = ['format_map_autogen.cpp']
if sys.argv[1] == 'inputs':
print ','.join(inputs)
print(','.join(inputs))
elif sys.argv[1] == 'outputs':
print ','.join(outputs)
print(','.join(outputs))
else:
print('Invalid script parameters')
return 1
......@@ -146,7 +146,7 @@ def main():
format_cases = ""
for format, type_map in sorted(format_map.iteritems()):
for format, type_map in sorted(format_map.items()):
format_cases += parse_format_case(format, type_map)
combo_data_file = 'es3_format_type_combinations.json'
......@@ -179,9 +179,9 @@ def main():
es3_combo_cases = ""
for format, type_combos in combos.iteritems():
for format, type_combos in sorted(combos.items()):
this_type_cases = ""
for type, combos in type_combos.iteritems():
for type, combos in sorted(type_combos.items()):
internal_format_cases = ""
for internal_format in combos:
internal_format_cases += " case " + internal_format + ":\n"
......
#!/usr/bin/python
#!/usr/bin/python3
# Copyright 2016 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -53,7 +53,7 @@ def load_with_override(override_path):
results = load_without_override()
overrides = load_json(override_path)
for k, v in overrides.iteritems():
for k, v in sorted(overrides.items()):
results[k] = v
return results
......@@ -95,7 +95,7 @@ def get_component_type(format_id):
def get_channel_tokens(format_id):
r = re.compile(r'([' + kChannels + '][\d]+)')
return filter(r.match, r.split(format_id))
return list(filter(r.match, r.split(format_id)))
def get_channels(format_id):
......
#!/usr/bin/python
#!/usr/bin/python3
# Copyright 2015 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -84,9 +84,10 @@ def get_swizzle_format_id(internal_format, angle_format):
internal_format)
bits = angle_format['bits']
max_component_bits = max(bits.itervalues())
max_component_bits = max(bits.values())
bits_iter = iter(list(sorted(bits.values())))
channels_different = not all(
[component_bits == bits.itervalues().next() for component_bits in bits.itervalues()])
[component_bits == next(bits_iter) for component_bits in bits.values()])
# The format itself can be used for swizzles if it can be accessed as a render target and
# sampled and the bit count for all 4 channels is the same.
......@@ -196,7 +197,7 @@ def json_to_table_data(internal_format, format_name, prefix, json):
"condition": prefix,
}
for k, v in json.iteritems():
for k, v in sorted(json.items()):
parsed[k] = v
# Derived values.
......@@ -217,15 +218,15 @@ def parse_json_angle_format_case(format_name, angle_format, json_data):
support_test = None
fallback = None
for k, v in angle_format.iteritems():
for k, v in sorted(angle_format.items()):
if k == "FL10Plus":
assert support_test is None
support_test = "OnlyFL10Plus(deviceCaps)"
for k2, v2 in v.iteritems():
for k2, v2 in sorted(v.items()):
supported_case[k2] = v2
elif k == "FL9_3":
split = True
for k2, v2 in v.iteritems():
for k2, v2 in sorted(v.items()):
unsupported_case[k2] = v2
elif k == "supportTest":
assert support_test is None
......@@ -250,7 +251,7 @@ def parse_json_angle_format_case(format_name, angle_format, json_data):
def parse_json_into_switch_angle_format_string(json_map, json_data):
table_data = ''
for internal_format, format_name in sorted(json_map.iteritems()):
for internal_format, format_name in sorted(json_map.items()):
if format_name not in json_data:
continue
......@@ -289,9 +290,9 @@ def main():
outputs = ['texture_format_table_autogen.cpp']
if sys.argv[1] == 'inputs':
print ','.join(inputs)
print(','.join(inputs))
elif sys.argv[1] == 'outputs':
print ','.join(outputs)
print(','.join(outputs))
else:
print('Invalid script parameters')
return 1
......
#!/usr/bin/python
#!/usr/bin/python3
# Copyright 2016 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -93,7 +93,7 @@ const Format *GetFormatInfoTable()
def ceil_int(value, mod):
assert mod > 0 and value > 0, 'integer modulation should be larger than 0'
return (value + mod - 1) / mod
return (value + mod - 1) // mod
def is_depth_stencil(angle_format):
......@@ -287,7 +287,7 @@ def json_to_table_data(format_id, json, angle_to_gl):
"fastCopyFunctions": "NoCopyFunctions",
}
for k, v in json.iteritems():
for k, v in sorted(json.items()):
parsed[k] = v
if "glInternalFormat" not in parsed:
......@@ -407,9 +407,9 @@ def main():
outputs = ['Format_table_autogen.cpp', 'FormatID_autogen.h']
if sys.argv[1] == 'inputs':
print ','.join(inputs)
print(','.join(inputs))
elif sys.argv[1] == 'outputs':
print ','.join(outputs)
print(','.join(outputs))
else:
print('Invalid script parameters')
return 1
......
#!/usr/bin/python
#!/usr/bin/python3
# Copyright 2016 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -10,6 +10,8 @@
import sys
import angle_format
from functools import reduce
template_cpp = """// GENERATED FILE - DO NOT EDIT.
// Generated by {script_name} using data from {data_source_name}.
//
......@@ -93,9 +95,9 @@ def main():
outputs = ['dxgi_format_map_autogen.cpp']
if sys.argv[1] == 'inputs':
print ','.join(inputs)
print(','.join(inputs))
elif sys.argv[1] == 'outputs':
print ','.join(outputs)
print(','.join(outputs))
else:
print('Invalid script parameters')
return 1
......@@ -119,7 +121,7 @@ def main():
all_angle = angle_format.get_all_angle_formats()
for dxgi_format, a_format in sorted(dxgi_map.iteritems()):
for dxgi_format, a_format in sorted(dxgi_map.items()):
found = [ctype in dxgi_format for ctype in types.keys()]
count = reduce((lambda a, b: int(a) + int(b)), found)
......@@ -127,7 +129,8 @@ def main():
component_type = 'GL_NONE'
if count == 1:
gltype = next(gltype for ctype, gltype in types.iteritems() if ctype in dxgi_format)
gltype = next(
gltype for ctype, gltype in sorted(types.items()) if ctype in dxgi_format)
component_cases += format_case(dxgi_format, gltype)
else:
component_cases += undefined_case(dxgi_format)
......
#!/usr/bin/python
#!/usr/bin/python3
# Copyright 2015 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -183,7 +183,7 @@ def do_format(format_data):
'mipAutoGen': macro_prefix + 'MIPGEN'
}
for format_name, format_support in sorted(format_data.iteritems()):
for format_name, format_support in sorted(format_data.items()):
always_supported = set()
never_supported = set()
......@@ -198,7 +198,7 @@ def do_format(format_data):
fl_10_0_check_10_1_supported = set()
fl_10_0_check_11_0_supported = set()
for json_flag, support in format_support.iteritems():
for json_flag, support in sorted(format_support.items()):
d3d_flag = [json_flag_to_d3d[json_flag]]
......@@ -306,9 +306,9 @@ def main():
outputs = ['dxgi_support_table_autogen.cpp']
if sys.argv[1] == 'inputs':
print ','.join(inputs)
print(','.join(inputs))
elif sys.argv[1] == 'outputs':
print ','.join(outputs)
print(','.join(outputs))
else:
print('Invalid script parameters')
return 1
......
#!/usr/bin/python
#!/usr/bin/python3
# Copyright 2015 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -112,7 +112,7 @@ def get_load_func(func_name, type_functions):
snippet += "{\n"
snippet += " switch (type)\n"
snippet += " {\n"
for gl_type, load_function in sorted(type_functions.iteritems()):
for gl_type, load_function in sorted(type_functions.items()):
snippet += " case " + gl_type + ":\n"
requiresConversion = str('LoadToNative<' not in load_function).lower()
snippet += " return LoadImageFunctionInfo(" + load_function + ", " + requiresConversion + ");\n"
......@@ -135,14 +135,14 @@ def get_unknown_load_func(angle_to_type_map, internal_format):
def parse_json(json_data):
table_data = ''
load_functions_data = ''
for internal_format, angle_to_type_map in sorted(json_data.iteritems()):
for internal_format, angle_to_type_map in sorted(json_data.items()):
s = ' '
table_data += s + 'case ' + internal_format + ':\n'
do_switch = len(
angle_to_type_map) > 1 or angle_to_type_map.keys()[0] != angle_format_unknown
do_switch = len(angle_to_type_map) > 1 or list(
angle_to_type_map)[0] != angle_format_unknown
if do_switch:
table_data += s + '{\n'
......@@ -151,7 +151,7 @@ def parse_json(json_data):
table_data += s + '{\n'
s += ' '
for angle_format, type_functions in sorted(angle_to_type_map.iteritems()):
for angle_format, type_functions in sorted(angle_to_type_map.items()):
if angle_format == angle_format_unknown:
continue
......@@ -163,7 +163,8 @@ def parse_json(json_data):
table_data += s + ' return ' + func_name + ';\n'
if angle_format_unknown in angle_to_type_map:
for gl_type, load_function in angle_to_type_map[angle_format_unknown].iteritems():
for gl_type, load_function in sorted(
angle_to_type_map[angle_format_unknown].items()):
if gl_type not in type_functions:
type_functions[gl_type] = load_function
......@@ -201,9 +202,9 @@ def main():
outputs = ['load_functions_table_autogen.cpp']
if sys.argv[1] == 'inputs':
print ','.join(inputs)
print(','.join(inputs))
elif sys.argv[1] == 'outputs':
print ','.join(outputs)
print(','.join(outputs))
else:
print('Invalid script parameters')
return 1
......
#!/usr/bin/python
#!/usr/bin/python3
# Copyright 2017 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -261,9 +261,9 @@ def main():
]
if sys.argv[1] == 'inputs':
print ','.join(inputs)
print(','.join(inputs))
elif sys.argv[1] == 'outputs':
print ','.join(outputs)
print(','.join(outputs))
else:
print('Invalid script parameters')
return 1
......@@ -331,7 +331,7 @@ def main():
# Used later in the NULL bindings.
all_entry_points = []
for comment, entry_points in json_data.iteritems():
for comment, entry_points in sorted(json_data.items()):
for entry_point_no_prefix in entry_points:
entry_point = "gl" + entry_point_no_prefix
......@@ -398,7 +398,7 @@ def main():
raise Exception('Entry point ' + entry_point + ' not found in the xml.')
table_data = []
for comment, entry_points in sorted(json_data.iteritems()):
for comment, entry_points in sorted(json_data.items()):
formatted = [" // " + comment]
formatted += [format_ep_decl(entry_point) for entry_point in sorted(entry_points)]
......@@ -414,25 +414,25 @@ def main():
out.write(dispatch_table_header)
gl_data = []
for gl_required, entry_points in sorted(gl_requirements.iteritems()):
for gl_required, entry_points in sorted(gl_requirements.items()):
gl_data.append(format_requirements_lines(gl_required, entry_points))
gl_extensions_data = []
for extension, entry_points in sorted(gl_extension_requirements.iteritems()):
for extension, entry_points in sorted(gl_extension_requirements.items()):
gl_extensions_data.append(
format_extension_requirements_lines(extension, entry_points, "gl"))
gles2_data = []
for gles2_required, entry_points in sorted(gles2_requirements.iteritems()):
for gles2_required, entry_points in sorted(gles2_requirements.items()):
gles2_data.append(format_requirements_lines(gles2_required, entry_points))
gles2_extensions_data = []
for extension, entry_points in sorted(gles2_extension_requirements.iteritems()):
for extension, entry_points in sorted(gles2_extension_requirements.items()):
gles2_extensions_data.append(
format_extension_requirements_lines(extension, entry_points, "gles2"))
both_extensions_data = []
for extension, entry_points in sorted(both_extension_requirements.iteritems()):
for extension, entry_points in sorted(both_extension_requirements.items()):
both_extensions_data.append(
format_extension_requirements_lines(extension, entry_points, "gles2|gl"))
......
#!/usr/bin/python
#!/usr/bin/python3
# Copyright 2019 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -81,9 +81,9 @@ def main():
outputs = ['format_autogen.h', 'mtl_default_shaders_src_autogen.inc']
if sys.argv[1] == 'inputs':
print ','.join(inputs)
print(','.join(inputs))
elif sys.argv[1] == 'outputs':
print ','.join(outputs)
print(','.join(outputs))
else:
print('Invalid script parameters')
return 1
......@@ -111,7 +111,8 @@ def main():
temp_fname = 'temp_master_source.metal'
with open(temp_fname, 'wb') as temp_file:
for src_file in src_files:
temp_file.write('#include "%s"\n' % src_file)
include_str = '#include "' + src_file + '" \n'
temp_file.write(include_str.encode('utf-8'))
args = [clang]
if not os.name == 'nt':
......@@ -121,7 +122,7 @@ def main():
combined_source = subprocess.check_output(args)
# Remove '@@' tokens
final_combined_src_string = combined_source.replace('@@', '')
final_combined_src_string = combined_source.replace('@@'.encode('utf-8'), ''.encode('utf-8'))
# Generate final file:
with open('mtl_default_shaders_src_autogen.inc', 'wt') as out_file:
......@@ -129,7 +130,7 @@ def main():
out_file.write('\n')
out_file.write('// C++ string version of combined Metal default shaders.\n\n')
out_file.write('\n\nstatic char gDefaultMetallibSrc[] = R"(\n')
out_file.write(final_combined_src_string)
out_file.write(final_combined_src_string.decode("utf-8"))
out_file.write('\n')
out_file.write(')";\n')
out_file.close()
......
#!/usr/bin/python
#!/usr/bin/python3
# Copyright 2016 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
......@@ -122,7 +122,7 @@ def verify_vk_map_keys(angle_to_gl, vk_json_data):
for table in ["map", "fallbacks"]:
for angle_format in vk_json_data[table].keys():
if not angle_format in angle_to_gl.keys():
print "Invalid format " + angle_format + " in vk_format_map.json in " + table
print("Invalid format " + angle_format + " in vk_format_map.json in " + table)
no_error = False
return no_error
......@@ -242,9 +242,9 @@ def main():
outputs = [out_file_name]
if sys.argv[1] == 'inputs':
print ','.join(inputs)
print(','.join(inputs))
elif sys.argv[1] == 'outputs':
print ','.join(outputs)
print(','.join(outputs))
else:
print('Invalid script parameters')
return 1
......@@ -258,23 +258,23 @@ def main():
format_id_cases = [
get_format_id_case(format_id, vk_format)
for format_id, vk_format in vk_json_data["map"].iteritems()
for format_id, vk_format in sorted(vk_json_data["map"].items())
]
vk_format_cases = [
get_vk_format_case(format_id, vk_format)
for format_id, vk_format in vk_json_data["map"].iteritems()
for format_id, vk_format in sorted(vk_json_data["map"].items())
]
vk_cases = [
gen_format_case(angle, gl, vk_json_data) for angle, gl in sorted(angle_to_gl.iteritems())
gen_format_case(angle, gl, vk_json_data) for angle, gl in sorted(angle_to_gl.items())
]
output_cpp = template_table_autogen_cpp.format(
format_case_data="\n".join(vk_cases),
format_id_cases=",\n".join(format_id_cases),
vk_format_cases="".join(vk_format_cases),
script_name=__file__,
script_name=os.path.basename(__file__),
out_file_name=out_file_name,
input_file_name=input_file_name)
......
#!/usr/bin/python
#!/usr/bin/python3
#
# Copyright 2020 The ANGLE Project Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
......@@ -334,7 +334,7 @@ def main():
return 0
format_args = {
"script_name": __file__,
"script_name": os.path.basename(__file__),
"data_source_name": json_file,
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment