Support "length" in dawn.json could be a integer

Struct member defined in dawn.json could have a 'length' attribute
defines the length of the member if it is an array.

In previous, the 'length' could only be 'strlen' or other variable
which has 'uint32_t' types. It cannot support constant length.

CopyTextureForBrowserOptions transfers conversion parameters and
conversion matrix with a constant length. This CL adds this ability
to meet such requirements.

Bug: dawn:1140
Change-Id: I6eeabbc55cc3853fe15e33bdd44060b16f6096bf
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/72580
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Shaobo Yan <shaobo.yan@intel.com>
This commit is contained in:
Yan
2021-12-15 04:08:56 +00:00
committed by Dawn LUCI CQ
parent f7b0c28f17
commit 5204053954
5 changed files with 41 additions and 51 deletions

View File

@@ -297,6 +297,10 @@ def linked_record_members(json_data, types):
assert False
elif m['length'] == 'strlen':
member.length = 'strlen'
elif isinstance(m['length'], int):
assert m['length'] > 0
member.length = "constant"
member.constant_length = m['length']
else:
member.length = members_by_name[m['length']]