Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion webgpu/generate/webgpu-spec
Submodule webgpu-spec updated 83 files
+6 −0 .devcontainer/devcontainer.json
+2 −0 .dockerignore
+81 −5 .github/workflows/build-push-custom-image.yml
+5 −1 .github/workflows/build-validate-publish.yml
+1 −1 .github/workflows/preview-pull-request.yml
+1 −1 .github/workflows/publish-TR-webgpu.yml
+1 −1 .github/workflows/publish-TR-wgsl.yml
+2 −16 .gitignore
+26 −3 CONTRIBUTING.md
+53 −9 LICENSE.md
+0 −9 README.md
+4 −2 correspondence/index.bs
+5 −5 design/AdapterIdentifiers.md
+1 −1 design/ErrorHandling.md
+1 −1 design/Pipelines.md
+1 −1 explainer/index.bs
+12 −5 process/RequirementsForAdditionalFunctionality.md
+54 −2 proposals/README.md
+110 −0 proposals/atomic-64-min-max.md
+590 −0 proposals/bindless.md
+283 −0 proposals/buffer-view.md
+38 −35 proposals/compatibility-mode.md
+66 −0 proposals/explainers/compatibility-mode.md
+182 −0 proposals/explicit_bindgroup_layout_parameters.md
+93 −0 proposals/fragment-depth.md
+213 −0 proposals/immediate-data.md
+4 −5 proposals/pipeline-statistics-query.md
+98 −0 proposals/primitive-index.md
+0 −125 proposals/push-constants.md
+198 −0 proposals/reinterpret_view.md
+17 −20 proposals/sized-binding-arrays.md
+83 −0 proposals/subgroup-id.md
+720 −0 proposals/subgroup-matrix.md
+129 −0 proposals/subgroup-size-control.md
+14 −12 proposals/subgroups.md
+3 −5 proposals/texel-buffers.md
+82 −0 proposals/texture-component-swizzle.md
+4 −5 proposals/timestamp-query-inside-passes.md
+90 −0 proposals/transient-attachments.md
+1 −1 spec/img/buffer-map-failure.mmd.svg
+1 −1 spec/img/buffer-map-unmap.mmd.svg
+1,481 −505 spec/index.bs
+27 −14 spec/sections/copies.bs
+1 −1 spec/sections/privacy-and-security.bs
+21 −10 tools/custom-action/Dockerfile
+8 −6 tools/custom-action/dependency-versions.sh
+7 −3 tools/custom-action/prepare.sh
+1 −1 tools/install-dependencies.sh
+4 −4 tools/invoke-bikeshed.sh
+2 −0 tools/populate-out.sh
+148 −0 tools/proposals-index.py
+14 −3 wgsl/Makefile
+18 −0 wgsl/README.md
+28 −0 wgsl/grammar/.gitignore
+0 −26 wgsl/grammar/Cargo.toml
+0 −114 wgsl/grammar/Makefile
+0 −61 wgsl/grammar/Package.swift
+0 −11 wgsl/grammar/bindings/c/tree-sitter-wgsl.pc.in
+0 −14 wgsl/grammar/bindings/go/binding.go
+0 −42 wgsl/grammar/bindings/python/tree_sitter_wgsl/__init__.py
+0 −20 wgsl/grammar/bindings/rust/build.rs
+0 −5 wgsl/grammar/go.mod
+8 −8 wgsl/grammar/package.json
+0 −29 wgsl/grammar/pyproject.toml
+0 −63 wgsl/grammar/setup.py
+33 −0 wgsl/grammar/tree-sitter.json
+885 −232 wgsl/index.bs
+5 −4 wgsl/syntax.bnf
+2 −0 wgsl/syntax/core_lhs_expression.syntax.bs.include
+5 −0 wgsl/syntax/language_extension_list.syntax.bs.include
+1 −1 wgsl/syntax/language_extension_name.syntax.bs.include
+1 −1 wgsl/syntax/requires_directive.syntax.bs.include
+0 −5 wgsl/syntax/software_extension_list.syntax.bs.include
+8 −8 wgsl/tools/analyze/Grammar.py
+5 −11 wgsl/tools/analyze/test.py
+19 −18 wgsl/tools/extract-grammar.py
+765 −0 wgsl/tools/generate-reserved-words.py
+0 −719 wgsl/tools/keywords
+5 −5 wgsl/tools/wgsl_unit_tests_template.py
+10 −8 wgsl/wgsl.recursive.bs.include
+71 −73 wgsl/wgsl.reserved.bs.include
+146 −0 wgsl/wgsl.reserved.plain
+1 −1 wgsl/wgsl_spec_style_guide.md
126 changes: 120 additions & 6 deletions webgpu/generate/webgpu-transforms.json
Original file line number Diff line number Diff line change
Expand Up @@ -221,27 +221,27 @@
{
"operation": {
"remove-variant-case": {
"variant": "gpu-buffer-binding-or-gpu-external-texture-or-gpu-sampler-or-gpu-texture-view",
"variant": "gpu-buffer-or-gpu-buffer-binding-or-gpu-external-texture-or-gpu-sampler-or-gpu-texture-or-gpu-texture-view",
"case": "gpu-external-texture"
}
}
},
{
"operation": {
"rename-type": {
"from": "gpu-buffer-binding-or-gpu-external-texture-or-gpu-sampler-or-gpu-texture-view",
"to": "gpu-buffer-binding-or-gpu-sampler-or-gpu-texture-view"
"from": "gpu-buffer-or-gpu-buffer-binding-or-gpu-external-texture-or-gpu-sampler-or-gpu-texture-or-gpu-texture-view",
"to": "gpu-buffer-or-gpu-buffer-binding-or-gpu-sampler-or-gpu-texture-or-gpu-texture-view"
}
}
},
{
"operation": {
"replace-type-usages": {
"old": {
"named": "gpu-buffer-binding-or-gpu-external-texture-or-gpu-sampler-or-gpu-texture-view"
"named": "gpu-buffer-or-gpu-buffer-binding-or-gpu-external-texture-or-gpu-sampler-or-gpu-texture-or-gpu-texture-view"
},
"new": {
"named": "gpu-buffer-binding-or-gpu-sampler-or-gpu-texture-view"
"named": "gpu-buffer-or-gpu-buffer-binding-or-gpu-sampler-or-gpu-texture-or-gpu-texture-view"
}
}
}
Expand Down Expand Up @@ -525,6 +525,90 @@
}
]
},
{
"reason": "Beautify gpu-command-encoder.copy-buffer-to-buffer, no tuple params. Using the more powerful variant with offsets and making the offsets optional",
"operations": [
{
"vars": {
"$_SOURCE": {
"find-type": {
"variant-case": {
"variant": "gpu-command-encoder-copy-buffer-to-buffer-params",
"case": "source-source-offset-destination-destination-offset-size"
},
"unwrap-t": [
{ "tuple": 0 }
]
}
},
"$_SOURCE_OFFSET": {
"find-type": {
"variant-case": {
"variant": "gpu-command-encoder-copy-buffer-to-buffer-params",
"case": "source-source-offset-destination-destination-offset-size"
},
"unwrap-t": [
{ "tuple": 1 }
]
}
},
"$_DESTINATION": {
"find-type": {
"variant-case": {
"variant": "gpu-command-encoder-copy-buffer-to-buffer-params",
"case": "source-source-offset-destination-destination-offset-size"
},
"unwrap-t": [
{ "tuple": 2 }
]
}
},
"$_DESTINATION_OFFSET": {
"find-type": {
"variant-case": {
"variant": "gpu-command-encoder-copy-buffer-to-buffer-params",
"case": "source-source-offset-destination-destination-offset-size"
},
"unwrap-t": [
{ "tuple": 3 }
]
}
},
"$_SIZE": {
"find-type": {
"variant-case": {
"variant": "gpu-command-encoder-copy-buffer-to-buffer-params",
"case": "source-source-offset-destination-destination-offset-size"
},
"unwrap-t": [
{ "tuple": 4 }
]
}
}
},
"operation": {
"retype-func-params": {
"resource": "gpu-command-encoder",
"func": "copy-buffer-to-buffer",
"new-params": {
"items": [
["source", "$_SOURCE"],
["source-offset", { "option": "$_SOURCE_OFFSET" }],
["destination", "$_DESTINATION"],
["destination-offset", { "option": "$_DESTINATION_OFFSET" }],
["size", "$_SIZE"]
]
}
}
}
},
{
"operation": {
"remove-type": "gpu-command-encoder-copy-buffer-to-buffer-params"
}
}
]
},
{
"reason": "Remove allow-shared-buffer-source as it's web related and temporarily replace it with list<u8>",
"operations": [
Expand Down Expand Up @@ -830,7 +914,7 @@
{
"operation": {
"rename-type": {
"from" : "gpu-buffer-binding-or-gpu-sampler-or-gpu-texture-view",
"from" : "gpu-buffer-or-gpu-buffer-binding-or-gpu-sampler-or-gpu-texture-or-gpu-texture-view",
"to" : "gpu-binding-resource"
}
}
Expand Down Expand Up @@ -1037,6 +1121,36 @@
}
]
},
{
"reason": "Accepting a texture in place of a texture view is just shorthand for texture.createView() (https://www.w3.org/TR/webgpu/#abstract-opdef-get-as-texture-view), so it's unnecessary — callers can call create-view themselves. JS can hide this behind dynamic typing, but in WIT it would require a variant and complicate the API. webgpu.h also disallows it (https://github.com/gpuweb/gpuweb/pull/5228#issuecomment-3046161091).",
"operations": [
{
"vars": {
"$_VIEW": {
"find-type": {
"variant-case": {
"variant": "gpu-texture-or-gpu-texture-view",
"case": "gpu-texture-view"
}
}
}
},
"operation": {
"replace-type-usages": {
"old": {
"named": "gpu-texture-or-gpu-texture-view"
},
"new": "$_VIEW"
}
}
},
{
"operation": {
"remove-type": "gpu-texture-or-gpu-texture-view"
}
}
]
},
{
"reason": "Errors have the message field raised to the top level type so that they don't have to be taken out of the inner error. Important if we allow new error types in the future that the developer has not yet handled. They also get a `kind` to enable detecting the error type. `kind` is a variant and not an enum so that they can have fields inside like `pipeline-error.reason`. Note: not changing gpu-error to a record even though errors added by us are records, because GPUError is an interface in the spec, and might one day gain interface like properties",
"operations": [
Expand Down
30 changes: 28 additions & 2 deletions webgpu/webgpu.wit
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@ interface webgpu {
features: func() -> gpu-supported-features;
limits: func() -> gpu-supported-limits;
info: func() -> gpu-adapter-info;
is-fallback-adapter: func() -> bool;
request-device: func(descriptor: option<gpu-device-descriptor>) -> future<result<gpu-device, request-device-error>>;
}
resource gpu-adapter-info {
Expand All @@ -44,6 +43,7 @@ interface webgpu {
description: func() -> string;
subgroup-min-size: func() -> u32;
subgroup-max-size: func() -> u32;
is-fallback-adapter: func() -> bool;
}
enum gpu-address-mode {
clamp-to-edge,
Expand Down Expand Up @@ -80,8 +80,10 @@ interface webgpu {
storage-texture: option<gpu-storage-texture-binding-layout>,
}
variant gpu-binding-resource {
gpu-buffer(borrow<gpu-buffer>),
gpu-buffer-binding(gpu-buffer-binding),
gpu-sampler(borrow<gpu-sampler>),
gpu-texture(borrow<gpu-texture>),
gpu-texture-view(borrow<gpu-texture-view>),
}
record gpu-blend-component {
Expand Down Expand Up @@ -235,7 +237,7 @@ interface webgpu {
resource gpu-command-encoder {
begin-render-pass: func(descriptor: gpu-render-pass-descriptor) -> gpu-render-pass-encoder;
begin-compute-pass: func(descriptor: option<gpu-compute-pass-descriptor>) -> gpu-compute-pass-encoder;
copy-buffer-to-buffer: func(source: borrow<gpu-buffer>, source-offset: gpu-size64, destination: borrow<gpu-buffer>, destination-offset: gpu-size64, size: gpu-size64);
copy-buffer-to-buffer: func(source: borrow<gpu-buffer>, source-offset: option<gpu-size64>, destination: borrow<gpu-buffer>, destination-offset: option<gpu-size64>, size: option<gpu-size64>);
copy-buffer-to-texture: func(source: gpu-texel-copy-buffer-info, destination: gpu-texel-copy-texture-info, copy-size: gpu-extent3-d);
copy-texture-to-buffer: func(source: gpu-texel-copy-texture-info, destination: gpu-texel-copy-buffer-info, copy-size: gpu-extent3-d);
copy-texture-to-texture: func(source: gpu-texel-copy-texture-info, destination: gpu-texel-copy-texture-info, copy-size: gpu-extent3-d);
Expand Down Expand Up @@ -292,6 +294,7 @@ interface webgpu {
pop-debug-group: func();
insert-debug-marker: func(marker-label: string);
set-bind-group: func(index: gpu-index32, bind-group: option<borrow<gpu-bind-group>>, dynamic-offsets-data: option<list<gpu-buffer-dynamic-offset>>, dynamic-offsets-data-start: option<gpu-size64>, dynamic-offsets-data-length: option<gpu-size32>) -> result<_, set-bind-group-error>;
set-immediates: func(range-offset: gpu-size32, data: list<u8>, data-offset: option<gpu-size64>, data-size: option<gpu-size64>);
}
record gpu-compute-pass-timestamp-writes {
query-set: borrow<gpu-query-set>,
Expand Down Expand Up @@ -388,6 +391,7 @@ interface webgpu {
depth-or-array-layers: option<gpu-integer-coordinate>,
}
enum gpu-feature-name {
core-features-and-limits,
depth-clip-control,
depth32float-stencil8,
texture-compression-bc,
Expand All @@ -405,6 +409,10 @@ interface webgpu {
clip-distances,
dual-source-blending,
subgroups,
texture-formats-tier1,
texture-formats-tier2,
primitive-index,
texture-component-swizzle,
}
enum gpu-filter-mode {
nearest,
Expand Down Expand Up @@ -466,6 +474,7 @@ interface webgpu {
}
record gpu-pipeline-layout-descriptor {
bind-group-layouts: list<option<borrow<gpu-bind-group-layout>>>,
immediate-size: option<gpu-size32>,
label: option<string>,
}
enum gpu-power-preference {
Expand Down Expand Up @@ -533,6 +542,7 @@ interface webgpu {
pop-debug-group: func();
insert-debug-marker: func(marker-label: string);
set-bind-group: func(index: gpu-index32, bind-group: option<borrow<gpu-bind-group>>, dynamic-offsets-data: option<list<gpu-buffer-dynamic-offset>>, dynamic-offsets-data-start: option<gpu-size64>, dynamic-offsets-data-length: option<gpu-size32>) -> result<_, set-bind-group-error>;
set-immediates: func(range-offset: gpu-size32, data: list<u8>, data-offset: option<gpu-size64>, data-size: option<gpu-size64>);
set-pipeline: func(pipeline: borrow<gpu-render-pipeline>);
set-index-buffer: func(buffer: borrow<gpu-buffer>, index-format: gpu-index-format, offset: option<gpu-size64>, size: option<gpu-size64>);
set-vertex-buffer: func(slot: gpu-index32, buffer: option<borrow<gpu-buffer>>, offset: option<gpu-size64>, size: option<gpu-size64>);
Expand Down Expand Up @@ -591,6 +601,7 @@ interface webgpu {
pop-debug-group: func();
insert-debug-marker: func(marker-label: string);
set-bind-group: func(index: gpu-index32, bind-group: option<borrow<gpu-bind-group>>, dynamic-offsets-data: option<list<gpu-buffer-dynamic-offset>>, dynamic-offsets-data-start: option<gpu-size64>, dynamic-offsets-data-length: option<gpu-size32>) -> result<_, set-bind-group-error>;
set-immediates: func(range-offset: gpu-size32, data: list<u8>, data-offset: option<gpu-size64>, data-size: option<gpu-size64>);
set-pipeline: func(pipeline: borrow<gpu-render-pipeline>);
set-index-buffer: func(buffer: borrow<gpu-buffer>, index-format: gpu-index-format, offset: option<gpu-size64>, size: option<gpu-size64>);
set-vertex-buffer: func(slot: gpu-index32, buffer: option<borrow<gpu-buffer>>, offset: option<gpu-size64>, size: option<gpu-size64>);
Expand Down Expand Up @@ -716,13 +727,18 @@ interface webgpu {
max-texture-array-layers: func() -> u32;
max-bind-groups: func() -> u32;
max-bind-groups-plus-vertex-buffers: func() -> u32;
max-immediate-size: func() -> u32;
max-bindings-per-bind-group: func() -> u32;
max-dynamic-uniform-buffers-per-pipeline-layout: func() -> u32;
max-dynamic-storage-buffers-per-pipeline-layout: func() -> u32;
max-sampled-textures-per-shader-stage: func() -> u32;
max-samplers-per-shader-stage: func() -> u32;
max-storage-buffers-per-shader-stage: func() -> u32;
max-storage-buffers-in-vertex-stage: func() -> u32;
max-storage-buffers-in-fragment-stage: func() -> u32;
max-storage-textures-per-shader-stage: func() -> u32;
max-storage-textures-in-vertex-stage: func() -> u32;
max-storage-textures-in-fragment-stage: func() -> u32;
max-uniform-buffers-per-shader-stage: func() -> u32;
max-uniform-buffer-binding-size: func() -> u64;
max-storage-buffer-binding-size: func() -> u64;
Expand Down Expand Up @@ -770,6 +786,7 @@ interface webgpu {
dimension: func() -> gpu-texture-dimension;
format: func() -> gpu-texture-format;
usage: func() -> gpu-flags-constant;
texture-binding-view-dimension: func() -> option<gpu-texture-view-dimension>;
label: func() -> string;
set-label: func(label: string);
from-graphics-buffer: static func(buffer: abstract-buffer) -> gpu-texture;
Expand All @@ -792,6 +809,7 @@ interface webgpu {
format: gpu-texture-format,
usage: gpu-texture-usage-flags,
view-formats: option<list<gpu-texture-format>>,
texture-binding-view-dimension: option<gpu-texture-view-dimension>,
label: option<string>,
}
enum gpu-texture-dimension {
Expand All @@ -804,6 +822,8 @@ interface webgpu {
r8snorm,
r8uint,
r8sint,
r16unorm,
r16snorm,
r16uint,
r16sint,
r16float,
Expand All @@ -814,6 +834,8 @@ interface webgpu {
r32uint,
r32sint,
r32float,
rg16unorm,
rg16snorm,
rg16uint,
rg16sint,
rg16float,
Expand All @@ -831,6 +853,8 @@ interface webgpu {
rg32uint,
rg32sint,
rg32float,
rgba16unorm,
rgba16snorm,
rgba16uint,
rgba16sint,
rgba16float,
Expand Down Expand Up @@ -909,6 +933,7 @@ interface webgpu {
TEXTURE-BINDING: static func() -> gpu-flags-constant;
STORAGE-BINDING: static func() -> gpu-flags-constant;
RENDER-ATTACHMENT: static func() -> gpu-flags-constant;
TRANSIENT-ATTACHMENT: static func() -> gpu-flags-constant;
}
type gpu-texture-usage-flags = u32;
resource gpu-texture-view {
Expand All @@ -924,6 +949,7 @@ interface webgpu {
mip-level-count: option<gpu-integer-coordinate>,
base-array-layer: option<gpu-integer-coordinate>,
array-layer-count: option<gpu-integer-coordinate>,
swizzle: option<string>,
label: option<string>,
}
enum gpu-texture-view-dimension {
Expand Down
Loading