Commit cbed3f5b by Olli Etuaho Committed by Commit Bot

Sort texture formats in gen_texture_format_table.py better

Sort the formats in a meaningful way, so that even if the structure of the source files change, the order can be maintained. This makes it easier to review further changes that affect the autogenerated texture format table. BUG=angleproject:1318 BUG=angleproject:1244 TEST=angle_end2end_tests Change-Id: Id3602a809137da43431144a31e36d4a0ed2e596e Reviewed-on: https://chromium-review.googlesource.com/328250Reviewed-by: 's avatarJamie Madill <jmadill@chromium.org> Commit-Queue: Jamie Madill <jmadill@chromium.org> Reviewed-by: 's avatarCorentin Wallez <cwallez@chromium.org> Commit-Queue: Olli Etuaho <oetuaho@nvidia.com>
parent f8bf583b
......@@ -274,12 +274,21 @@ def get_texture_format_item(idx, texture_format):
def parse_json_into_switch_string(json_data):
table_data = ''
def format_sort(texture_format):
if 'requirementsFcn' in texture_format:
return texture_format['requirementsFcn']
elif 'texFormat' in texture_format:
return texture_format['texFormat']
else:
return texture_format
for internal_format_item in sorted(json_data.iteritems()):
internal_format = internal_format_item[0]
table_data += ' case ' + internal_format + ':\n'
table_data += ' {\n'
for idx, texture_format in enumerate(sorted(json_data[internal_format])):
for idx, texture_format in enumerate(sorted(json_data[internal_format], key=format_sort)):
table_data += get_texture_format_item(idx, texture_format)
table_data += ' else\n'
......
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