Skip to content

Commit fc86589

Browse files
authored
Update to latest WebGPU WebIDL (#2080)
1 parent 2b12828 commit fc86589

17 files changed

+832
-67
lines changed

crates/web-sys/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -435,6 +435,9 @@ GpuPipelineLayoutDescriptor = []
435435
GpuPowerPreference = []
436436
GpuPrimitiveTopology = []
437437
GpuProgrammableStageDescriptor = []
438+
GpuQuerySet = []
439+
GpuQuerySetDescriptor = []
440+
GpuQueryType = []
438441
GpuQueue = []
439442
GpuRasterizationStateDescriptor = []
440443
GpuRenderBundle = []

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,10 @@ impl GpuBindGroupDescriptor {
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(bindings: &::wasm_bindgen::JsValue, layout: &GpuBindGroupLayout) -> Self {
26+
pub fn new(entries: &::wasm_bindgen::JsValue, layout: &GpuBindGroupLayout) -> Self {
2727
#[allow(unused_mut)]
2828
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
29-
ret.bindings(bindings);
29+
ret.entries(entries);
3030
ret.layout(layout);
3131
ret
3232
}
@@ -48,17 +48,17 @@ impl GpuBindGroupDescriptor {
4848
self
4949
}
5050
#[cfg(web_sys_unstable_apis)]
51-
#[doc = "Change the `bindings` field of this object."]
51+
#[doc = "Change the `entries` field of this object."]
5252
#[doc = ""]
5353
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupDescriptor`*"]
5454
#[doc = ""]
5555
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
5656
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
57-
pub fn bindings(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
57+
pub fn entries(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
5858
use wasm_bindgen::JsValue;
5959
let r = ::js_sys::Reflect::set(
6060
self.as_ref(),
61-
&JsValue::from("bindings"),
61+
&JsValue::from("entries"),
6262
&JsValue::from(val),
6363
);
6464
debug_assert!(

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

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,10 @@ impl GpuBindGroupLayoutDescriptor {
2222
#[doc = ""]
2323
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
2424
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
25-
pub fn new(bindings: &::wasm_bindgen::JsValue) -> Self {
25+
pub fn new(entries: &::wasm_bindgen::JsValue) -> Self {
2626
#[allow(unused_mut)]
2727
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
28-
ret.bindings(bindings);
28+
ret.entries(entries);
2929
ret
3030
}
3131
#[cfg(web_sys_unstable_apis)]
@@ -46,17 +46,17 @@ impl GpuBindGroupLayoutDescriptor {
4646
self
4747
}
4848
#[cfg(web_sys_unstable_apis)]
49-
#[doc = "Change the `bindings` field of this object."]
49+
#[doc = "Change the `entries` field of this object."]
5050
#[doc = ""]
5151
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutDescriptor`*"]
5252
#[doc = ""]
5353
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
5454
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
55-
pub fn bindings(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
55+
pub fn entries(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
5656
use wasm_bindgen::JsValue;
5757
let r = ::js_sys::Reflect::set(
5858
self.as_ref(),
59-
&JsValue::from("bindings"),
59+
&JsValue::from("entries"),
6060
&JsValue::from(val),
6161
);
6262
debug_assert!(

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

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ 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(buffer: &GpuBuffer, row_pitch: u32) -> Self {
26+
pub fn new(buffer: &GpuBuffer, bytes_per_row: u32) -> Self {
2727
#[allow(unused_mut)]
2828
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
2929
ret.buffer(buffer);
30-
ret.row_pitch(row_pitch);
30+
ret.bytes_per_row(bytes_per_row);
3131
ret
3232
}
3333
#[cfg(web_sys_unstable_apis)]
@@ -50,17 +50,17 @@ impl GpuBufferCopyView {
5050
self
5151
}
5252
#[cfg(web_sys_unstable_apis)]
53-
#[doc = "Change the `imageHeight` field of this object."]
53+
#[doc = "Change the `bytesPerRow` field of this object."]
5454
#[doc = ""]
5555
#[doc = "*This API requires the following crate features to be activated: `GpuBufferCopyView`*"]
5656
#[doc = ""]
5757
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
5858
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
59-
pub fn image_height(&mut self, val: u32) -> &mut Self {
59+
pub fn bytes_per_row(&mut self, val: u32) -> &mut Self {
6060
use wasm_bindgen::JsValue;
6161
let r = ::js_sys::Reflect::set(
6262
self.as_ref(),
63-
&JsValue::from("imageHeight"),
63+
&JsValue::from("bytesPerRow"),
6464
&JsValue::from(val),
6565
);
6666
debug_assert!(
@@ -89,17 +89,17 @@ impl GpuBufferCopyView {
8989
self
9090
}
9191
#[cfg(web_sys_unstable_apis)]
92-
#[doc = "Change the `rowPitch` field of this object."]
92+
#[doc = "Change the `rowsPerImage` field of this object."]
9393
#[doc = ""]
9494
#[doc = "*This API requires the following crate features to be activated: `GpuBufferCopyView`*"]
9595
#[doc = ""]
9696
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
9797
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
98-
pub fn row_pitch(&mut self, val: u32) -> &mut Self {
98+
pub fn rows_per_image(&mut self, val: u32) -> &mut Self {
9999
use wasm_bindgen::JsValue;
100100
let r = ::js_sys::Reflect::set(
101101
self.as_ref(),
102-
&JsValue::from("rowPitch"),
102+
&JsValue::from("rowsPerImage"),
103103
&JsValue::from(val),
104104
);
105105
debug_assert!(

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

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,4 +90,12 @@ impl GpuBufferUsage {
9090
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
9191
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
9292
pub const INDIRECT: u32 = 256u64 as u32;
93+
#[cfg(web_sys_unstable_apis)]
94+
#[doc = "The `GPUBufferUsage.QUERY_RESOLVE` const."]
95+
#[doc = ""]
96+
#[doc = "*This API requires the following crate features to be activated: `GpuBufferUsage`*"]
97+
#[doc = ""]
98+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
99+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
100+
pub const QUERY_RESOLVE: u32 = 512u64 as u32;
93101
}

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

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -404,4 +404,42 @@ extern "C" {
404404
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
405405
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
406406
pub fn push_debug_group(this: &GpuCommandEncoder, group_label: &str);
407+
#[cfg(web_sys_unstable_apis)]
408+
#[cfg(all(feature = "GpuBuffer", feature = "GpuQuerySet",))]
409+
# [ wasm_bindgen ( method , structural , js_class = "GPUCommandEncoder" , js_name = resolveQuerySet ) ]
410+
#[doc = "The `resolveQuerySet()` method."]
411+
#[doc = ""]
412+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/resolveQuerySet)"]
413+
#[doc = ""]
414+
#[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuCommandEncoder`, `GpuQuerySet`*"]
415+
#[doc = ""]
416+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
417+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
418+
pub fn resolve_query_set_with_u32(
419+
this: &GpuCommandEncoder,
420+
query_set: &GpuQuerySet,
421+
first_query: u32,
422+
query_count: u32,
423+
destination: &GpuBuffer,
424+
destination_offset: u32,
425+
);
426+
#[cfg(web_sys_unstable_apis)]
427+
#[cfg(all(feature = "GpuBuffer", feature = "GpuQuerySet",))]
428+
# [ wasm_bindgen ( method , structural , js_class = "GPUCommandEncoder" , js_name = resolveQuerySet ) ]
429+
#[doc = "The `resolveQuerySet()` method."]
430+
#[doc = ""]
431+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/resolveQuerySet)"]
432+
#[doc = ""]
433+
#[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuCommandEncoder`, `GpuQuerySet`*"]
434+
#[doc = ""]
435+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
436+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
437+
pub fn resolve_query_set_with_f64(
438+
this: &GpuCommandEncoder,
439+
query_set: &GpuQuerySet,
440+
first_query: u32,
441+
query_count: u32,
442+
destination: &GpuBuffer,
443+
destination_offset: f64,
444+
);
407445
}

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

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,18 @@ extern "C" {
224224
descriptor: &GpuPipelineLayoutDescriptor,
225225
) -> GpuPipelineLayout;
226226
#[cfg(web_sys_unstable_apis)]
227+
#[cfg(all(feature = "GpuQuerySet", feature = "GpuQuerySetDescriptor",))]
228+
# [ wasm_bindgen ( method , structural , js_class = "GPUDevice" , js_name = createQuerySet ) ]
229+
#[doc = "The `createQuerySet()` method."]
230+
#[doc = ""]
231+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/createQuerySet)"]
232+
#[doc = ""]
233+
#[doc = "*This API requires the following crate features to be activated: `GpuDevice`, `GpuQuerySet`, `GpuQuerySetDescriptor`*"]
234+
#[doc = ""]
235+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
236+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
237+
pub fn create_query_set(this: &GpuDevice, descriptor: &GpuQuerySetDescriptor) -> GpuQuerySet;
238+
#[cfg(web_sys_unstable_apis)]
227239
#[cfg(all(
228240
feature = "GpuRenderBundleEncoder",
229241
feature = "GpuRenderBundleEncoderDescriptor",
Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
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 = GPUQuerySet , typescript_type = "GPUQuerySet" ) ]
8+
#[derive(Debug, Clone, PartialEq, Eq)]
9+
#[doc = "The `GpuQuerySet` class."]
10+
#[doc = ""]
11+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQuerySet)"]
12+
#[doc = ""]
13+
#[doc = "*This API requires the following crate features to be activated: `GpuQuerySet`*"]
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 GpuQuerySet;
18+
#[cfg(web_sys_unstable_apis)]
19+
# [ wasm_bindgen ( structural , method , getter , js_class = "GPUQuerySet" , js_name = label ) ]
20+
#[doc = "Getter for the `label` field of this object."]
21+
#[doc = ""]
22+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQuerySet/label)"]
23+
#[doc = ""]
24+
#[doc = "*This API requires the following crate features to be activated: `GpuQuerySet`*"]
25+
#[doc = ""]
26+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
27+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
28+
pub fn label(this: &GpuQuerySet) -> Option<String>;
29+
#[cfg(web_sys_unstable_apis)]
30+
# [ wasm_bindgen ( structural , method , setter , js_class = "GPUQuerySet" , js_name = label ) ]
31+
#[doc = "Setter for the `label` field of this object."]
32+
#[doc = ""]
33+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQuerySet/label)"]
34+
#[doc = ""]
35+
#[doc = "*This API requires the following crate features to be activated: `GpuQuerySet`*"]
36+
#[doc = ""]
37+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
38+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
39+
pub fn set_label(this: &GpuQuerySet, value: Option<&str>);
40+
#[cfg(web_sys_unstable_apis)]
41+
# [ wasm_bindgen ( method , structural , js_class = "GPUQuerySet" , js_name = destroy ) ]
42+
#[doc = "The `destroy()` method."]
43+
#[doc = ""]
44+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQuerySet/destroy)"]
45+
#[doc = ""]
46+
#[doc = "*This API requires the following crate features to be activated: `GpuQuerySet`*"]
47+
#[doc = ""]
48+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
49+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
50+
pub fn destroy(this: &GpuQuerySet);
51+
}
Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
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 = GPUQuerySetDescriptor ) ]
8+
#[derive(Debug, Clone, PartialEq, Eq)]
9+
#[doc = "The `GpuQuerySetDescriptor` dictionary."]
10+
#[doc = ""]
11+
#[doc = "*This API requires the following crate features to be activated: `GpuQuerySetDescriptor`*"]
12+
#[doc = ""]
13+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
14+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
15+
pub type GpuQuerySetDescriptor;
16+
}
17+
#[cfg(web_sys_unstable_apis)]
18+
impl GpuQuerySetDescriptor {
19+
#[cfg(feature = "GpuQueryType")]
20+
#[doc = "Construct a new `GpuQuerySetDescriptor`."]
21+
#[doc = ""]
22+
#[doc = "*This API requires the following crate features to be activated: `GpuQuerySetDescriptor`, `GpuQueryType`*"]
23+
#[doc = ""]
24+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
25+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
26+
pub fn new(count: u32, type_: GpuQueryType) -> Self {
27+
#[allow(unused_mut)]
28+
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
29+
ret.count(count);
30+
ret.type_(type_);
31+
ret
32+
}
33+
#[cfg(web_sys_unstable_apis)]
34+
#[doc = "Change the `label` field of this object."]
35+
#[doc = ""]
36+
#[doc = "*This API requires the following crate features to be activated: `GpuQuerySetDescriptor`*"]
37+
#[doc = ""]
38+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
39+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
40+
pub fn label(&mut self, val: &str) -> &mut Self {
41+
use wasm_bindgen::JsValue;
42+
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val));
43+
debug_assert!(
44+
r.is_ok(),
45+
"setting properties should never fail on our dictionary objects"
46+
);
47+
let _ = r;
48+
self
49+
}
50+
#[cfg(web_sys_unstable_apis)]
51+
#[doc = "Change the `count` field of this object."]
52+
#[doc = ""]
53+
#[doc = "*This API requires the following crate features to be activated: `GpuQuerySetDescriptor`*"]
54+
#[doc = ""]
55+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
56+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
57+
pub fn count(&mut self, val: u32) -> &mut Self {
58+
use wasm_bindgen::JsValue;
59+
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("count"), &JsValue::from(val));
60+
debug_assert!(
61+
r.is_ok(),
62+
"setting properties should never fail on our dictionary objects"
63+
);
64+
let _ = r;
65+
self
66+
}
67+
#[cfg(web_sys_unstable_apis)]
68+
#[cfg(feature = "GpuQueryType")]
69+
#[doc = "Change the `type` field of this object."]
70+
#[doc = ""]
71+
#[doc = "*This API requires the following crate features to be activated: `GpuQuerySetDescriptor`, `GpuQueryType`*"]
72+
#[doc = ""]
73+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
74+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
75+
pub fn type_(&mut self, val: GpuQueryType) -> &mut Self {
76+
use wasm_bindgen::JsValue;
77+
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("type"), &JsValue::from(val));
78+
debug_assert!(
79+
r.is_ok(),
80+
"setting properties should never fail on our dictionary objects"
81+
);
82+
let _ = r;
83+
self
84+
}
85+
}
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#![allow(unused_imports)]
2+
use wasm_bindgen::prelude::*;
3+
#[cfg(web_sys_unstable_apis)]
4+
#[wasm_bindgen]
5+
#[doc = "The `GpuQueryType` enum."]
6+
#[doc = ""]
7+
#[doc = "*This API requires the following crate features to be activated: `GpuQueryType`*"]
8+
#[doc = ""]
9+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
10+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
11+
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
12+
pub enum GpuQueryType {
13+
Occlusion = "occlusion",
14+
}

0 commit comments

Comments
 (0)