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>
This commit is contained in:
Austin Eng 2021-09-20 16:07:25 +00:00 committed by Dawn LUCI CQ
parent 39046f36d7
commit 0c82405aca
2 changed files with 64 additions and 59 deletions

110
dawn.json
View File

@ -69,8 +69,7 @@
}, },
"adapter properties": { "adapter properties": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "out",
"output": true,
"members": [ "members": [
{"name": "vendor ID", "type": "uint32_t"}, {"name": "vendor ID", "type": "uint32_t"},
{"name": "device ID", "type": "uint32_t"}, {"name": "device ID", "type": "uint32_t"},
@ -124,7 +123,7 @@
}, },
"bind group entry": { "bind group entry": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "binding", "type": "uint32_t"}, {"name": "binding", "type": "uint32_t"},
{"name": "buffer", "type": "buffer", "optional": true}, {"name": "buffer", "type": "buffer", "optional": true},
@ -136,7 +135,7 @@
}, },
"bind group descriptor": { "bind group descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}, {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
{"name": "layout", "type": "bind group layout"}, {"name": "layout", "type": "bind group layout"},
@ -159,7 +158,7 @@
}, },
"buffer binding layout": { "buffer binding layout": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "type", "type": "buffer binding type", "default": "undefined"}, {"name": "type", "type": "buffer binding type", "default": "undefined"},
{"name": "has dynamic offset", "type": "bool", "default": "false"}, {"name": "has dynamic offset", "type": "bool", "default": "false"},
@ -178,7 +177,7 @@
}, },
"sampler binding layout": { "sampler binding layout": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "type", "type": "sampler binding type", "default": "undefined"} {"name": "type", "type": "sampler binding type", "default": "undefined"}
] ]
@ -197,7 +196,7 @@
}, },
"texture binding layout": { "texture binding layout": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "sample type", "type": "texture sample type", "default": "undefined"}, {"name": "sample type", "type": "texture sample type", "default": "undefined"},
{"name": "view dimension", "type": "texture view dimension", "default": "undefined"}, {"name": "view dimension", "type": "texture view dimension", "default": "undefined"},
@ -207,7 +206,7 @@
"external texture binding entry": { "external texture binding entry": {
"category": "structure", "category": "structure",
"chained": true, "chained": "in",
"tags": ["dawn"], "tags": ["dawn"],
"members": [ "members": [
{"name": "external texture", "type": "external texture"} {"name": "external texture", "type": "external texture"}
@ -216,7 +215,7 @@
"external texture binding layout": { "external texture binding layout": {
"category": "structure", "category": "structure",
"chained": true, "chained": "in",
"tags": ["dawn"], "tags": ["dawn"],
"members": [] "members": []
}, },
@ -230,7 +229,7 @@
}, },
"storage texture binding layout": { "storage texture binding layout": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "access", "type": "storage texture access", "default": "undefined"}, {"name": "access", "type": "storage texture access", "default": "undefined"},
{"name": "format", "type": "texture format", "default": "undefined"}, {"name": "format", "type": "texture format", "default": "undefined"},
@ -240,7 +239,7 @@
"bind group layout entry": { "bind group layout entry": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "binding", "type": "uint32_t"}, {"name": "binding", "type": "uint32_t"},
{"name": "visibility", "type": "shader stage"}, {"name": "visibility", "type": "shader stage"},
@ -252,7 +251,7 @@
}, },
"bind group layout descriptor": { "bind group layout descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}, {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
{"name": "entry count", "type": "uint32_t"}, {"name": "entry count", "type": "uint32_t"},
@ -347,7 +346,7 @@
}, },
"buffer descriptor": { "buffer descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}, {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
{"name": "usage", "type": "buffer usage"}, {"name": "usage", "type": "buffer usage"},
@ -418,7 +417,7 @@
}, },
"command buffer descriptor": { "command buffer descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true} {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}
] ]
@ -534,7 +533,7 @@
}, },
"command encoder descriptor": { "command encoder descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true} {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}
] ]
@ -605,7 +604,7 @@
}, },
"compute pass descriptor": { "compute pass descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true} {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}
] ]
@ -704,7 +703,7 @@
}, },
"compute pipeline descriptor": { "compute pipeline descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}, {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
{"name": "layout", "type": "pipeline layout", "optional": true}, {"name": "layout", "type": "pipeline layout", "optional": true},
@ -722,7 +721,7 @@
}, },
"copy texture for browser options": { "copy texture for browser options": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"tags": ["dawn"], "tags": ["dawn"],
"members": [ "members": [
{"name": "flipY", "type": "bool", "default": "false"}, {"name": "flipY", "type": "bool", "default": "false"},
@ -1041,15 +1040,14 @@
}, },
"required limits": { "required limits": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "limits", "type": "limits"} {"name": "limits", "type": "limits"}
] ]
}, },
"supported limits": { "supported limits": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "out",
"output": true,
"members": [ "members": [
{"name": "limits", "type": "limits"} {"name": "limits", "type": "limits"}
] ]
@ -1112,7 +1110,7 @@
}, },
"external texture descriptor": { "external texture descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"tags": ["dawn"], "tags": ["dawn"],
"members": [ "members": [
{"name": "plane 0", "type": "texture view"}, {"name": "plane 0", "type": "texture view"},
@ -1138,7 +1136,7 @@
}, },
"image copy buffer": { "image copy buffer": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "layout", "type": "texture data layout"}, {"name": "layout", "type": "texture data layout"},
{"name": "buffer", "type": "buffer"} {"name": "buffer", "type": "buffer"}
@ -1146,7 +1144,7 @@
}, },
"image copy texture": { "image copy texture": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "texture", "type": "texture"}, {"name": "texture", "type": "texture"},
{"name": "mip level", "type": "uint32_t", "default": "0"}, {"name": "mip level", "type": "uint32_t", "default": "0"},
@ -1189,7 +1187,7 @@
}, },
"instance descriptor": { "instance descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [] "members": []
}, },
"vertex attribute": { "vertex attribute": {
@ -1254,7 +1252,7 @@
}, },
"pipeline layout descriptor": { "pipeline layout descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}, {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
{"name": "bind group layout count", "type": "uint32_t"}, {"name": "bind group layout count", "type": "uint32_t"},
@ -1282,7 +1280,7 @@
}, },
"programmable stage descriptor": { "programmable stage descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "module", "type": "shader module"}, {"name": "module", "type": "shader module"},
{"name": "entry point", "type": "char", "annotation": "const*", "length": "strlen"} {"name": "entry point", "type": "char", "annotation": "const*", "length": "strlen"}
@ -1308,7 +1306,7 @@
}, },
"query set descriptor": { "query set descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}, {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
{"name": "type", "type": "query type"}, {"name": "type", "type": "query type"},
@ -1364,7 +1362,7 @@
}, },
{ {
"name": "copy texture for browser", "name": "copy texture for browser",
"extensible": true, "extensible": "in",
"tags": ["dawn"], "tags": ["dawn"],
"args": [ "args": [
{"name": "source", "type": "image copy texture", "annotation": "const*"}, {"name": "source", "type": "image copy texture", "annotation": "const*"},
@ -1494,7 +1492,7 @@
"render bundle descriptor": { "render bundle descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true} {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}
] ]
@ -1502,7 +1500,7 @@
"render bundle encoder descriptor": { "render bundle encoder descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}, {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
{"name": "color formats count", "type": "uint32_t"}, {"name": "color formats count", "type": "uint32_t"},
@ -1540,7 +1538,7 @@
"render pass descriptor": { "render pass descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}, {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
{"name": "color attachment count", "type": "uint32_t"}, {"name": "color attachment count", "type": "uint32_t"},
@ -1749,7 +1747,7 @@
"vertex state": { "vertex state": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "module", "type": "shader module"}, {"name": "module", "type": "shader module"},
{"name": "entry point", "type": "char", "annotation": "const*", "length": "strlen"}, {"name": "entry point", "type": "char", "annotation": "const*", "length": "strlen"},
@ -1760,7 +1758,7 @@
"primitive state": { "primitive state": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "topology", "type": "primitive topology", "default": "triangle list"}, {"name": "topology", "type": "primitive topology", "default": "triangle list"},
{"name": "strip index format", "type": "index format", "default": "undefined"}, {"name": "strip index format", "type": "index format", "default": "undefined"},
@ -1771,7 +1769,7 @@
"primitive depth clamping state": { "primitive depth clamping state": {
"category": "structure", "category": "structure",
"chained": true, "chained": "in",
"members": [ "members": [
{"name": "clamp depth", "type": "bool", "default": "false"} {"name": "clamp depth", "type": "bool", "default": "false"}
] ]
@ -1779,7 +1777,7 @@
"depth stencil state": { "depth stencil state": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "format", "type": "texture format"}, {"name": "format", "type": "texture format"},
{"name": "depth write enabled", "type": "bool", "default": "false"}, {"name": "depth write enabled", "type": "bool", "default": "false"},
@ -1796,7 +1794,7 @@
"multisample state": { "multisample state": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "count", "type": "uint32_t", "default": "1"}, {"name": "count", "type": "uint32_t", "default": "1"},
{"name": "mask", "type": "uint32_t", "default": "0xFFFFFFFF"}, {"name": "mask", "type": "uint32_t", "default": "0xFFFFFFFF"},
@ -1806,7 +1804,7 @@
"fragment state": { "fragment state": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "module", "type": "shader module"}, {"name": "module", "type": "shader module"},
{"name": "entry point", "type": "char", "annotation": "const*", "length": "strlen"}, {"name": "entry point", "type": "char", "annotation": "const*", "length": "strlen"},
@ -1816,7 +1814,7 @@
}, },
"color target state": { "color target state": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "format", "type": "texture format"}, {"name": "format", "type": "texture format"},
{"name": "blend", "type": "blend state", "annotation": "const*", "optional": true}, {"name": "blend", "type": "blend state", "annotation": "const*", "optional": true},
@ -1834,7 +1832,7 @@
"render pipeline descriptor": { "render pipeline descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}, {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
{"name": "layout", "type": "pipeline layout", "optional": true}, {"name": "layout", "type": "pipeline layout", "optional": true},
@ -1851,7 +1849,7 @@
}, },
"sampler descriptor": { "sampler descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}, {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
{"name": "address mode u", "type": "address mode", "default": "clamp to edge"}, {"name": "address mode u", "type": "address mode", "default": "clamp to edge"},
@ -1888,14 +1886,14 @@
}, },
"shader module descriptor": { "shader module descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true} {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}
] ]
}, },
"shader module SPIRV descriptor": { "shader module SPIRV descriptor": {
"category": "structure", "category": "structure",
"chained": true, "chained": "in",
"members": [ "members": [
{"name": "code size", "type": "uint32_t"}, {"name": "code size", "type": "uint32_t"},
{"name": "code", "type": "uint32_t", "annotation": "const*", "length": "code size"} {"name": "code", "type": "uint32_t", "annotation": "const*", "length": "code size"}
@ -1903,7 +1901,7 @@
}, },
"shader module WGSL descriptor": { "shader module WGSL descriptor": {
"category": "structure", "category": "structure",
"chained": true, "chained": "in",
"members": [ "members": [
{"name": "source", "type": "char", "annotation": "const*", "length": "strlen"} {"name": "source", "type": "char", "annotation": "const*", "length": "strlen"}
] ]
@ -1955,21 +1953,21 @@
}, },
"surface descriptor": { "surface descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true} {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}
] ]
}, },
"surface descriptor from canvas HTML selector": { "surface descriptor from canvas HTML selector": {
"category": "structure", "category": "structure",
"chained": true, "chained": "in",
"members": [ "members": [
{"name": "selector", "type": "char", "annotation": "const*", "length": "strlen"} {"name": "selector", "type": "char", "annotation": "const*", "length": "strlen"}
] ]
}, },
"surface descriptor from metal layer": { "surface descriptor from metal layer": {
"category": "structure", "category": "structure",
"chained": true, "chained": "in",
"tags": ["native"], "tags": ["native"],
"members": [ "members": [
{"name": "layer", "type": "void", "annotation": "*"} {"name": "layer", "type": "void", "annotation": "*"}
@ -1977,7 +1975,7 @@
}, },
"surface descriptor from windows HWND": { "surface descriptor from windows HWND": {
"category": "structure", "category": "structure",
"chained": true, "chained": "in",
"tags": ["native"], "tags": ["native"],
"members": [ "members": [
{"name": "hinstance", "type": "void", "annotation": "*"}, {"name": "hinstance", "type": "void", "annotation": "*"},
@ -1986,7 +1984,7 @@
}, },
"surface descriptor from xlib": { "surface descriptor from xlib": {
"category": "structure", "category": "structure",
"chained": true, "chained": "in",
"tags": ["native"], "tags": ["native"],
"members": [ "members": [
{"name": "display", "type": "void", "annotation": "*"}, {"name": "display", "type": "void", "annotation": "*"},
@ -1995,7 +1993,7 @@
}, },
"surface descriptor from windows core window": { "surface descriptor from windows core window": {
"category": "structure", "category": "structure",
"chained": true, "chained": "in",
"tags": ["dawn"], "tags": ["dawn"],
"members": [ "members": [
{"name": "core window", "type": "void", "annotation": "*"} {"name": "core window", "type": "void", "annotation": "*"}
@ -2003,7 +2001,7 @@
}, },
"surface descriptor from windows swap chain panel": { "surface descriptor from windows swap chain panel": {
"category": "structure", "category": "structure",
"chained": true, "chained": "in",
"tags": ["dawn"], "tags": ["dawn"],
"members": [ "members": [
{"name": "swap chain panel", "type": "void", "annotation": "*"} {"name": "swap chain panel", "type": "void", "annotation": "*"}
@ -2028,7 +2026,7 @@
}, },
"swap chain descriptor": { "swap chain descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}, {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
{"name": "usage", "type": "texture usage"}, {"name": "usage", "type": "texture usage"},
@ -2103,7 +2101,7 @@
}, },
"texture data layout": { "texture data layout": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "offset", "type": "uint64_t", "default": 0}, {"name": "offset", "type": "uint64_t", "default": 0},
{"name": "bytes per row", "type": "uint32_t", "default": "WGPU_COPY_STRIDE_UNDEFINED"}, {"name": "bytes per row", "type": "uint32_t", "default": "WGPU_COPY_STRIDE_UNDEFINED"},
@ -2112,7 +2110,7 @@
}, },
"texture descriptor": { "texture descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}, {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
{"name": "usage", "type": "texture usage"}, {"name": "usage", "type": "texture usage"},
@ -2255,7 +2253,7 @@
}, },
"texture view descriptor": { "texture view descriptor": {
"category": "structure", "category": "structure",
"extensible": true, "extensible": "in",
"members": [ "members": [
{"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true}, {"name": "label", "type": "char", "annotation": "const*", "length": "strlen", "optional": true},
{"name": "format", "type": "texture format", "default": "undefined"}, {"name": "format", "type": "texture format", "default": "undefined"},
@ -2359,7 +2357,7 @@
}, },
"dawn texture internal usage descriptor": { "dawn texture internal usage descriptor": {
"category": "structure", "category": "structure",
"chained": true, "chained": "in",
"tags": ["dawn"], "tags": ["dawn"],
"members": [ "members": [
{"name": "internal usage", "type": "texture usage", "default": "none"} {"name": "internal usage", "type": "texture usage", "default": "none"}

View File

@ -215,14 +215,21 @@ class StructureType(Record, Type):
m for m in json_data['members'] if is_enabled(m) m for m in json_data['members'] if is_enabled(m)
] ]
Type.__init__(self, name, dict(json_data, **json_data_override)) Type.__init__(self, name, dict(json_data, **json_data_override))
self.chained = json_data.get("chained", False) self.chained = json_data.get("chained", None)
self.extensible = json_data.get("extensible", False) self.extensible = json_data.get("extensible", None)
self.output = json_data.get("output", False) 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 # Chained structs inherit from wgpu::ChainedStruct, which has
# nextInChain, so setting both extensible and chained would result in # nextInChain, so setting both extensible and chained would result in
# two nextInChain members. # two nextInChain members.
assert not (self.extensible and self.chained) assert not (self.extensible and self.chained)
@property
def output(self):
return self.chained == "out" or self.extensible == "out"
class Command(Record): class Command(Record):
def __init__(self, name, members=None): def __init__(self, name, members=None):