dawn.json: chained/extensible must be "in" or "out" or false
Bug: dawn:685
Change-Id: I0e63f6f8bfb3edb8e727670ecc2453841f3da513
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64602
Reviewed-by: Kai Ninomiya <kainino@chromium.org>
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Commit-Queue: Austin Eng <enga@chromium.org>
diff --git a/generator/dawn_json_generator.py b/generator/dawn_json_generator.py
index 684be3f..3b138c8 100644
--- a/generator/dawn_json_generator.py
+++ b/generator/dawn_json_generator.py
@@ -215,14 +215,21 @@
m for m in json_data['members'] if is_enabled(m)
]
Type.__init__(self, name, dict(json_data, **json_data_override))
- self.chained = json_data.get("chained", False)
- self.extensible = json_data.get("extensible", False)
- self.output = json_data.get("output", False)
+ self.chained = json_data.get("chained", None)
+ self.extensible = json_data.get("extensible", None)
+ if self.chained:
+ assert (self.chained == "in" or self.chained == "out")
+ if self.extensible:
+ assert (self.extensible == "in" or self.extensible == "out")
# Chained structs inherit from wgpu::ChainedStruct, which has
# nextInChain, so setting both extensible and chained would result in
# two nextInChain members.
assert not (self.extensible and self.chained)
+ @property
+ def output(self):
+ return self.chained == "out" or self.extensible == "out"
+
class Command(Record):
def __init__(self, name, members=None):