Skip to content

Commit 3640e7f

Browse files
committed
Update to latest WebGPU WebIDL
1 parent 8e49c4a commit 3640e7f

23 files changed

+767
-175
lines changed

crates/web-sys/Cargo.toml

+3-1
Original file line numberDiff line numberDiff line change
@@ -402,6 +402,7 @@ GetRootNodeOptions = []
402402
GetUserMediaRequest = []
403403
Gpu = []
404404
GpuAdapter = []
405+
GpuAdapterFeatures = []
405406
GpuAddressMode = []
406407
GpuBindGroup = []
407408
GpuBindGroupDescriptor = []
@@ -440,8 +441,8 @@ GpuDevice = ["EventTarget"]
440441
GpuDeviceDescriptor = []
441442
GpuDeviceLostInfo = []
442443
GpuErrorFilter = []
443-
GpuExtensionName = []
444444
GpuExtent3dDict = []
445+
GpuFeatureName = []
445446
GpuFence = []
446447
GpuFenceDescriptor = []
447448
GpuFilterMode = []
@@ -451,6 +452,7 @@ GpuIndexFormat = []
451452
GpuInputStepMode = []
452453
GpuLimits = []
453454
GpuLoadOp = []
455+
GpuMapMode = []
454456
GpuObjectDescriptorBase = []
455457
GpuOrigin2dDict = []
456458
GpuOrigin3dDict = []

crates/web-sys/src/features/gen_GpuAdapter.rs

+6-5
Original file line numberDiff line numberDiff line change
@@ -27,16 +27,17 @@ extern "C" {
2727
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
2828
pub fn name(this: &GpuAdapter) -> String;
2929
#[cfg(web_sys_unstable_apis)]
30-
# [ wasm_bindgen ( structural , method , getter , js_class = "GPUAdapter" , js_name = extensions ) ]
31-
#[doc = "Getter for the `extensions` field of this object."]
30+
#[cfg(feature = "GpuAdapterFeatures")]
31+
# [ wasm_bindgen ( structural , method , getter , js_class = "GPUAdapter" , js_name = features ) ]
32+
#[doc = "Getter for the `features` field of this object."]
3233
#[doc = ""]
33-
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/extensions)"]
34+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/features)"]
3435
#[doc = ""]
35-
#[doc = "*This API requires the following crate features to be activated: `GpuAdapter`*"]
36+
#[doc = "*This API requires the following crate features to be activated: `GpuAdapter`, `GpuAdapterFeatures`*"]
3637
#[doc = ""]
3738
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
3839
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
39-
pub fn extensions(this: &GpuAdapter) -> ::js_sys::Array;
40+
pub fn features(this: &GpuAdapter) -> GpuAdapterFeatures;
4041
#[cfg(web_sys_unstable_apis)]
4142
# [ wasm_bindgen ( method , structural , js_class = "GPUAdapter" , js_name = requestDevice ) ]
4243
#[doc = "The `requestDevice()` method."]
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#![allow(unused_imports)]
2+
use super::*;
3+
use wasm_bindgen::prelude::*;
4+
#[cfg(web_sys_unstable_apis)]
5+
#[wasm_bindgen]
6+
extern "C" {
7+
# [ wasm_bindgen ( extends = :: js_sys :: Object , js_name = GPUAdapterFeatures , typescript_type = "GPUAdapterFeatures" ) ]
8+
#[derive(Debug, Clone, PartialEq, Eq)]
9+
#[doc = "The `GpuAdapterFeatures` class."]
10+
#[doc = ""]
11+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapterFeatures)"]
12+
#[doc = ""]
13+
#[doc = "*This API requires the following crate features to be activated: `GpuAdapterFeatures`*"]
14+
#[doc = ""]
15+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
16+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
17+
pub type GpuAdapterFeatures;
18+
}

crates/web-sys/src/features/gen_GpuBindGroupLayoutEntry.rs

-21
Original file line numberDiff line numberDiff line change
@@ -95,27 +95,6 @@ impl GpuBindGroupLayoutEntry {
9595
self
9696
}
9797
#[cfg(web_sys_unstable_apis)]
98-
#[doc = "Change the `multisampled` field of this object."]
99-
#[doc = ""]
100-
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`*"]
101-
#[doc = ""]
102-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
103-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
104-
pub fn multisampled(&mut self, val: bool) -> &mut Self {
105-
use wasm_bindgen::JsValue;
106-
let r = ::js_sys::Reflect::set(
107-
self.as_ref(),
108-
&JsValue::from("multisampled"),
109-
&JsValue::from(val),
110-
);
111-
debug_assert!(
112-
r.is_ok(),
113-
"setting properties should never fail on our dictionary objects"
114-
);
115-
let _ = r;
116-
self
117-
}
118-
#[cfg(web_sys_unstable_apis)]
11998
#[cfg(feature = "GpuTextureFormat")]
12099
#[doc = "Change the `storageTextureFormat` field of this object."]
121100
#[doc = ""]

crates/web-sys/src/features/gen_GpuBindingType.rs

+1
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ pub enum GpuBindingType {
1616
Sampler = "sampler",
1717
ComparisonSampler = "comparison-sampler",
1818
SampledTexture = "sampled-texture",
19+
MultisampledTexture = "multisampled-texture",
1920
ReadonlyStorageTexture = "readonly-storage-texture",
2021
WriteonlyStorageTexture = "writeonly-storage-texture",
2122
}

crates/web-sys/src/features/gen_GpuBuffer.rs

+176-8
Original file line numberDiff line numberDiff line change
@@ -49,27 +49,195 @@ extern "C" {
4949
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
5050
pub fn destroy(this: &GpuBuffer);
5151
#[cfg(web_sys_unstable_apis)]
52-
# [ wasm_bindgen ( method , structural , js_class = "GPUBuffer" , js_name = mapReadAsync ) ]
53-
#[doc = "The `mapReadAsync()` method."]
52+
# [ wasm_bindgen ( method , structural , js_class = "GPUBuffer" , js_name = getMappedRange ) ]
53+
#[doc = "The `getMappedRange()` method."]
5454
#[doc = ""]
55-
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapReadAsync)"]
55+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"]
5656
#[doc = ""]
5757
#[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"]
5858
#[doc = ""]
5959
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
6060
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
61-
pub fn map_read_async(this: &GpuBuffer) -> ::js_sys::Promise;
61+
pub fn get_mapped_range(this: &GpuBuffer) -> ::js_sys::ArrayBuffer;
6262
#[cfg(web_sys_unstable_apis)]
63-
# [ wasm_bindgen ( method , structural , js_class = "GPUBuffer" , js_name = mapWriteAsync ) ]
64-
#[doc = "The `mapWriteAsync()` method."]
63+
# [ wasm_bindgen ( method , structural , js_class = "GPUBuffer" , js_name = getMappedRange ) ]
64+
#[doc = "The `getMappedRange()` method."]
6565
#[doc = ""]
66-
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapWriteAsync)"]
66+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"]
6767
#[doc = ""]
6868
#[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"]
6969
#[doc = ""]
7070
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
7171
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
72-
pub fn map_write_async(this: &GpuBuffer) -> ::js_sys::Promise;
72+
pub fn get_mapped_range_with_u32(this: &GpuBuffer, offset: u32) -> ::js_sys::ArrayBuffer;
73+
#[cfg(web_sys_unstable_apis)]
74+
# [ wasm_bindgen ( method , structural , js_class = "GPUBuffer" , js_name = getMappedRange ) ]
75+
#[doc = "The `getMappedRange()` method."]
76+
#[doc = ""]
77+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"]
78+
#[doc = ""]
79+
#[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"]
80+
#[doc = ""]
81+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
82+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
83+
pub fn get_mapped_range_with_f64(this: &GpuBuffer, offset: f64) -> ::js_sys::ArrayBuffer;
84+
#[cfg(web_sys_unstable_apis)]
85+
# [ wasm_bindgen ( method , structural , js_class = "GPUBuffer" , js_name = getMappedRange ) ]
86+
#[doc = "The `getMappedRange()` method."]
87+
#[doc = ""]
88+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"]
89+
#[doc = ""]
90+
#[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"]
91+
#[doc = ""]
92+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
93+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
94+
pub fn get_mapped_range_with_u32_and_u32(
95+
this: &GpuBuffer,
96+
offset: u32,
97+
size: u32,
98+
) -> ::js_sys::ArrayBuffer;
99+
#[cfg(web_sys_unstable_apis)]
100+
# [ wasm_bindgen ( method , structural , js_class = "GPUBuffer" , js_name = getMappedRange ) ]
101+
#[doc = "The `getMappedRange()` method."]
102+
#[doc = ""]
103+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"]
104+
#[doc = ""]
105+
#[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"]
106+
#[doc = ""]
107+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
108+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
109+
pub fn get_mapped_range_with_f64_and_u32(
110+
this: &GpuBuffer,
111+
offset: f64,
112+
size: u32,
113+
) -> ::js_sys::ArrayBuffer;
114+
#[cfg(web_sys_unstable_apis)]
115+
# [ wasm_bindgen ( method , structural , js_class = "GPUBuffer" , js_name = getMappedRange ) ]
116+
#[doc = "The `getMappedRange()` method."]
117+
#[doc = ""]
118+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"]
119+
#[doc = ""]
120+
#[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"]
121+
#[doc = ""]
122+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
123+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
124+
pub fn get_mapped_range_with_u32_and_f64(
125+
this: &GpuBuffer,
126+
offset: u32,
127+
size: f64,
128+
) -> ::js_sys::ArrayBuffer;
129+
#[cfg(web_sys_unstable_apis)]
130+
# [ wasm_bindgen ( method , structural , js_class = "GPUBuffer" , js_name = getMappedRange ) ]
131+
#[doc = "The `getMappedRange()` method."]
132+
#[doc = ""]
133+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"]
134+
#[doc = ""]
135+
#[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"]
136+
#[doc = ""]
137+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
138+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
139+
pub fn get_mapped_range_with_f64_and_f64(
140+
this: &GpuBuffer,
141+
offset: f64,
142+
size: f64,
143+
) -> ::js_sys::ArrayBuffer;
144+
#[cfg(web_sys_unstable_apis)]
145+
# [ wasm_bindgen ( method , structural , js_class = "GPUBuffer" , js_name = mapAsync ) ]
146+
#[doc = "The `mapAsync()` method."]
147+
#[doc = ""]
148+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapAsync)"]
149+
#[doc = ""]
150+
#[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"]
151+
#[doc = ""]
152+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
153+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
154+
pub fn map_async(this: &GpuBuffer, mode: u32) -> ::js_sys::Promise;
155+
#[cfg(web_sys_unstable_apis)]
156+
# [ wasm_bindgen ( method , structural , js_class = "GPUBuffer" , js_name = mapAsync ) ]
157+
#[doc = "The `mapAsync()` method."]
158+
#[doc = ""]
159+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapAsync)"]
160+
#[doc = ""]
161+
#[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"]
162+
#[doc = ""]
163+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
164+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
165+
pub fn map_async_with_u32(this: &GpuBuffer, mode: u32, offset: u32) -> ::js_sys::Promise;
166+
#[cfg(web_sys_unstable_apis)]
167+
# [ wasm_bindgen ( method , structural , js_class = "GPUBuffer" , js_name = mapAsync ) ]
168+
#[doc = "The `mapAsync()` method."]
169+
#[doc = ""]
170+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapAsync)"]
171+
#[doc = ""]
172+
#[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"]
173+
#[doc = ""]
174+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
175+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
176+
pub fn map_async_with_f64(this: &GpuBuffer, mode: u32, offset: f64) -> ::js_sys::Promise;
177+
#[cfg(web_sys_unstable_apis)]
178+
# [ wasm_bindgen ( method , structural , js_class = "GPUBuffer" , js_name = mapAsync ) ]
179+
#[doc = "The `mapAsync()` method."]
180+
#[doc = ""]
181+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapAsync)"]
182+
#[doc = ""]
183+
#[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"]
184+
#[doc = ""]
185+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
186+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
187+
pub fn map_async_with_u32_and_u32(
188+
this: &GpuBuffer,
189+
mode: u32,
190+
offset: u32,
191+
size: u32,
192+
) -> ::js_sys::Promise;
193+
#[cfg(web_sys_unstable_apis)]
194+
# [ wasm_bindgen ( method , structural , js_class = "GPUBuffer" , js_name = mapAsync ) ]
195+
#[doc = "The `mapAsync()` method."]
196+
#[doc = ""]
197+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapAsync)"]
198+
#[doc = ""]
199+
#[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"]
200+
#[doc = ""]
201+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
202+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
203+
pub fn map_async_with_f64_and_u32(
204+
this: &GpuBuffer,
205+
mode: u32,
206+
offset: f64,
207+
size: u32,
208+
) -> ::js_sys::Promise;
209+
#[cfg(web_sys_unstable_apis)]
210+
# [ wasm_bindgen ( method , structural , js_class = "GPUBuffer" , js_name = mapAsync ) ]
211+
#[doc = "The `mapAsync()` method."]
212+
#[doc = ""]
213+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapAsync)"]
214+
#[doc = ""]
215+
#[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"]
216+
#[doc = ""]
217+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
218+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
219+
pub fn map_async_with_u32_and_f64(
220+
this: &GpuBuffer,
221+
mode: u32,
222+
offset: u32,
223+
size: f64,
224+
) -> ::js_sys::Promise;
225+
#[cfg(web_sys_unstable_apis)]
226+
# [ wasm_bindgen ( method , structural , js_class = "GPUBuffer" , js_name = mapAsync ) ]
227+
#[doc = "The `mapAsync()` method."]
228+
#[doc = ""]
229+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapAsync)"]
230+
#[doc = ""]
231+
#[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"]
232+
#[doc = ""]
233+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
234+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
235+
pub fn map_async_with_f64_and_f64(
236+
this: &GpuBuffer,
237+
mode: u32,
238+
offset: f64,
239+
size: f64,
240+
) -> ::js_sys::Promise;
73241
#[cfg(web_sys_unstable_apis)]
74242
# [ wasm_bindgen ( method , structural , js_class = "GPUBuffer" , js_name = unmap ) ]
75243
#[doc = "The `unmap()` method."]

crates/web-sys/src/features/gen_GpuBufferCopyView.rs

+1-2
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,9 @@ impl GpuBufferCopyView {
2323
#[doc = ""]
2424
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
2525
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
26-
pub fn new(bytes_per_row: u32, buffer: &GpuBuffer) -> Self {
26+
pub fn new(buffer: &GpuBuffer) -> Self {
2727
#[allow(unused_mut)]
2828
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
29-
ret.bytes_per_row(bytes_per_row);
3029
ret.buffer(buffer);
3130
ret
3231
}

crates/web-sys/src/features/gen_GpuBufferDescriptor.rs

+21
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,27 @@ impl GpuBufferDescriptor {
4747
self
4848
}
4949
#[cfg(web_sys_unstable_apis)]
50+
#[doc = "Change the `mappedAtCreation` field of this object."]
51+
#[doc = ""]
52+
#[doc = "*This API requires the following crate features to be activated: `GpuBufferDescriptor`*"]
53+
#[doc = ""]
54+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
55+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
56+
pub fn mapped_at_creation(&mut self, val: bool) -> &mut Self {
57+
use wasm_bindgen::JsValue;
58+
let r = ::js_sys::Reflect::set(
59+
self.as_ref(),
60+
&JsValue::from("mappedAtCreation"),
61+
&JsValue::from(val),
62+
);
63+
debug_assert!(
64+
r.is_ok(),
65+
"setting properties should never fail on our dictionary objects"
66+
);
67+
let _ = r;
68+
self
69+
}
70+
#[cfg(web_sys_unstable_apis)]
5071
#[doc = "Change the `size` field of this object."]
5172
#[doc = ""]
5273
#[doc = "*This API requires the following crate features to be activated: `GpuBufferDescriptor`*"]

0 commit comments

Comments
 (0)