dawn.json changes to match upstream webgpu.h
Bug: dawn:1080
Change-Id: Icc77f8ccd5a07162d0e7795d7160d936f9c33e49
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/64620
Reviewed-by: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Kai Ninomiya <kainino@chromium.org>
diff --git a/dawn.json b/dawn.json
index 60caac3..5103746 100644
--- a/dawn.json
+++ b/dawn.json
@@ -22,7 +22,9 @@
"extensible": "in",
"tags": ["upstream"],
"members": [
- {"name": "compatible surface", "type": "surface"}
+ {"name": "compatible surface", "type": "surface"},
+ {"name": "power preference", "type": "power preference", "tags": ["upstream"]},
+ {"name": "force fallback adapter", "type": "bool", "tags": ["upstream"]}
]
},
"request adapter status": {
@@ -51,6 +53,14 @@
"tags": ["upstream"],
"methods": [
{
+ "name": "get limits",
+ "returns": "bool",
+ "tags": ["upstream"],
+ "args": [
+ {"name": "limits", "type": "supported limits", "annotation": "*"}
+ ]
+ },
+ {
"name": "get properties",
"tags": ["upstream"],
"args": [
@@ -58,6 +68,14 @@
]
},
{
+ "name": "has feature",
+ "returns": "bool",
+ "tags": ["upstream"],
+ "args": [
+ {"name": "feature", "type": "feature name"}
+ ]
+ },
+ {
"name": "request device",
"args": [
{"name": "descriptor", "type": "device descriptor", "annotation": "const*"},
@@ -94,7 +112,11 @@
"extensible": "in",
"tags": ["upstream"],
"_TODO": "Add requiredFeatures and requiredLimits support",
- "members": []
+ "members": [
+ {"name": "required features count", "type": "uint32_t"},
+ {"name": "required features", "type": "feature name", "annotation": "const*", "length": "required features count"},
+ {"name": "required limits", "type": "required limits", "annotation": "const*"}
+ ]
},
"address mode": {
"category": "enum",
@@ -412,6 +434,14 @@
{"value": 15, "name": "all"}
]
},
+ "constant entry": {
+ "category": "structure",
+ "extensible": "in",
+ "members": [
+ {"name": "key", "type": "char", "annotation": "const*"},
+ {"name": "value", "type": "double"}
+ ]
+ },
"command buffer": {
"category": "object"
},
@@ -524,6 +554,7 @@
},
{
"name": "write buffer",
+ "tags": ["dawn"],
"args": [
{"name": "buffer", "type": "buffer"},
{"name": "buffer offset", "type": "uint64_t"},
@@ -1126,6 +1157,21 @@
{"name": "format", "type": "texture format"}
]
},
+ "feature name": {
+ "category": "enum",
+ "tags": ["upstream"],
+ "values": [
+ {"value": 0, "name": "undefined", "jsrepr": "undefined"},
+ {"value": 1, "name": "depth clamping"},
+ {"value": 2, "name": "depth24 unorm stencil8"},
+ {"value": 3, "name": "depth32 float stencil8"},
+ {"value": 4, "name": "timestamp query"},
+ {"value": 5, "name": "pipeline statistics query"},
+ {"value": 6, "name": "texture compression BC"},
+ {"value": 7, "name": "texture compression ETC2"},
+ {"value": 8, "name": "texture compression ASTC"}
+ ]
+ },
"filter mode": {
"category": "enum",
"values": [
@@ -1278,6 +1324,14 @@
{"value": 4, "name": "compute shader invocations"}
]
},
+ "power preference": {
+ "category": "enum",
+ "tags": ["upstream"],
+ "values": [
+ {"value": 0, "name": "low power"},
+ {"value": 1, "name": "high performance"}
+ ]
+ },
"present mode": {
"category": "enum",
"emscripten_no_enum_table": true,
@@ -1292,7 +1346,9 @@
"extensible": "in",
"members": [
{"name": "module", "type": "shader module"},
- {"name": "entry point", "type": "char", "annotation": "const*", "length": "strlen"}
+ {"name": "entry point", "type": "char", "annotation": "const*", "length": "strlen"},
+ {"name": "constant count", "type": "uint32_t", "tags": ["upstream"]},
+ {"name": "constants", "type": "constant entry", "annotation": "const*", "length": "constant count", "tags": ["upstream"]}
]
},
"primitive topology": {
@@ -1760,6 +1816,8 @@
"members": [
{"name": "module", "type": "shader module"},
{"name": "entry point", "type": "char", "annotation": "const*", "length": "strlen"},
+ {"name": "constant count", "type": "uint32_t", "tags": ["upstream"]},
+ {"name": "constants", "type": "constant entry", "annotation": "const*", "length": "constant count", "tags": ["upstream"]},
{"name": "buffer count", "type": "uint32_t", "default": 0},
{"name": "buffers", "type": "vertex buffer layout", "annotation": "const*", "length": "buffer count"}
]
@@ -1817,6 +1875,8 @@
"members": [
{"name": "module", "type": "shader module"},
{"name": "entry point", "type": "char", "annotation": "const*", "length": "strlen"},
+ {"name": "constant count", "type": "uint32_t", "tags": ["upstream"]},
+ {"name": "constants", "type": "constant entry", "annotation": "const*", "length": "constant count", "tags": ["upstream"]},
{"name": "target count", "type": "uint32_t"},
{"name": "targets", "type": "color target state", "annotation": "const*", "length": "target count"}
]
diff --git a/generator/dawn_json_generator.py b/generator/dawn_json_generator.py
index 3b138c8..439eda1 100644
--- a/generator/dawn_json_generator.py
+++ b/generator/dawn_json_generator.py
@@ -309,7 +309,7 @@
# similar to the original order (though the sort isn't technically stable).
#
# It works by computing for each struct type what is the depth of its DAG of
-# dependents, then resorting based on that depth using Python's stable sort.
+# dependents, then re-sorting based on that depth using Python's stable sort.
# This makes a toposort because if A depends on B then its depth will be bigger
# than B's. It is also nice because all nodes with the same depth are kept in
# the input order.
diff --git a/generator/templates/webgpu.h b/generator/templates/webgpu.h
index a0a6e3e..9630d1a 100644
--- a/generator/templates/webgpu.h
+++ b/generator/templates/webgpu.h
@@ -116,9 +116,9 @@
{% for type in by_category["structure"] %}
typedef struct {{as_cType(type.name)}} {
{% set Out = "Out" if type.output else "" %}
- {% set const = "const" if not type.output else "" %}
+ {% set const = "const " if not type.output else "" %}
{% if type.extensible %}
- WGPUChainedStruct{{Out}} {{const}} * nextInChain;
+ WGPUChainedStruct{{Out}} {{const}}* nextInChain;
{% endif %}
{% if type.chained %}
WGPUChainedStruct{{Out}} chain;