Skip to content

Commit 8f874c8

Browse files
authored
Update to latest WebGPU WebIDL (#2658)
1 parent 2ccdbd9 commit 8f874c8

13 files changed

+419
-134
lines changed

crates/web-sys/Cargo.toml

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,8 @@ GpuBufferBindingType = []
421421
GpuBufferDescriptor = []
422422
GpuBufferUsage = []
423423
GpuCanvasCompositingAlphaMode = []
424+
GpuCanvasConfiguration = []
425+
GpuCanvasContext = []
424426
GpuColorDict = []
425427
GpuColorTargetState = []
426428
GpuColorWrite = []
@@ -457,7 +459,6 @@ GpuImageCopyTexture = []
457459
GpuImageCopyTextureTagged = []
458460
GpuImageDataLayout = []
459461
GpuIndexFormat = []
460-
GpuInputStepMode = []
461462
GpuLoadOp = []
462463
GpuMapMode = []
463464
GpuMultisampleState = []
@@ -471,8 +472,6 @@ GpuPipelineLayoutDescriptor = []
471472
GpuPipelineStatisticName = []
472473
GpuPowerPreference = []
473474
GpuPredefinedColorSpace = []
474-
GpuPresentationConfiguration = []
475-
GpuPresentationContext = []
476475
GpuPrimitiveState = []
477476
GpuPrimitiveTopology = []
478477
GpuProgrammableStage = []
@@ -488,6 +487,7 @@ GpuRenderPassColorAttachment = []
488487
GpuRenderPassDepthStencilAttachment = []
489488
GpuRenderPassDescriptor = []
490489
GpuRenderPassEncoder = []
490+
GpuRenderPassLayout = []
491491
GpuRenderPipeline = []
492492
GpuRenderPipelineDescriptor = []
493493
GpuRequestAdapterOptions = []
@@ -523,6 +523,7 @@ GpuVertexAttribute = []
523523
GpuVertexBufferLayout = []
524524
GpuVertexFormat = []
525525
GpuVertexState = []
526+
GpuVertexStepMode = []
526527
GridDeclaration = []
527528
GridTrackState = []
528529
GroupedHistoryEventInit = []

crates/web-sys/src/features/gen_GpuPresentationConfiguration.rs renamed to crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs

Lines changed: 21 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -4,22 +4,22 @@ use wasm_bindgen::prelude::*;
44
#[cfg(web_sys_unstable_apis)]
55
#[wasm_bindgen]
66
extern "C" {
7-
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUPresentationConfiguration)]
7+
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUCanvasConfiguration)]
88
#[derive(Debug, Clone, PartialEq, Eq)]
9-
#[doc = "The `GpuPresentationConfiguration` dictionary."]
9+
#[doc = "The `GpuCanvasConfiguration` dictionary."]
1010
#[doc = ""]
11-
#[doc = "*This API requires the following crate features to be activated: `GpuPresentationConfiguration`*"]
11+
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"]
1212
#[doc = ""]
1313
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
1414
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
15-
pub type GpuPresentationConfiguration;
15+
pub type GpuCanvasConfiguration;
1616
}
1717
#[cfg(web_sys_unstable_apis)]
18-
impl GpuPresentationConfiguration {
18+
impl GpuCanvasConfiguration {
1919
#[cfg(all(feature = "GpuDevice", feature = "GpuTextureFormat",))]
20-
#[doc = "Construct a new `GpuPresentationConfiguration`."]
20+
#[doc = "Construct a new `GpuCanvasConfiguration`."]
2121
#[doc = ""]
22-
#[doc = "*This API requires the following crate features to be activated: `GpuDevice`, `GpuPresentationConfiguration`, `GpuTextureFormat`*"]
22+
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuDevice`, `GpuTextureFormat`*"]
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)*"]
@@ -31,15 +31,20 @@ impl GpuPresentationConfiguration {
3131
ret
3232
}
3333
#[cfg(web_sys_unstable_apis)]
34-
#[doc = "Change the `label` field of this object."]
34+
#[cfg(feature = "GpuPredefinedColorSpace")]
35+
#[doc = "Change the `colorSpace` field of this object."]
3536
#[doc = ""]
36-
#[doc = "*This API requires the following crate features to be activated: `GpuPresentationConfiguration`*"]
37+
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuPredefinedColorSpace`*"]
3738
#[doc = ""]
3839
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
3940
#[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+
pub fn color_space(&mut self, val: GpuPredefinedColorSpace) -> &mut Self {
4142
use wasm_bindgen::JsValue;
42-
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val));
43+
let r = ::js_sys::Reflect::set(
44+
self.as_ref(),
45+
&JsValue::from("colorSpace"),
46+
&JsValue::from(val),
47+
);
4348
debug_assert!(
4449
r.is_ok(),
4550
"setting properties should never fail on our dictionary objects"
@@ -51,7 +56,7 @@ impl GpuPresentationConfiguration {
5156
#[cfg(feature = "GpuCanvasCompositingAlphaMode")]
5257
#[doc = "Change the `compositingAlphaMode` field of this object."]
5358
#[doc = ""]
54-
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasCompositingAlphaMode`, `GpuPresentationConfiguration`*"]
59+
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasCompositingAlphaMode`, `GpuCanvasConfiguration`*"]
5560
#[doc = ""]
5661
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
5762
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
@@ -73,7 +78,7 @@ impl GpuPresentationConfiguration {
7378
#[cfg(feature = "GpuDevice")]
7479
#[doc = "Change the `device` field of this object."]
7580
#[doc = ""]
76-
#[doc = "*This API requires the following crate features to be activated: `GpuDevice`, `GpuPresentationConfiguration`*"]
81+
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuDevice`*"]
7782
#[doc = ""]
7883
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
7984
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
@@ -92,7 +97,7 @@ impl GpuPresentationConfiguration {
9297
#[cfg(feature = "GpuTextureFormat")]
9398
#[doc = "Change the `format` field of this object."]
9499
#[doc = ""]
95-
#[doc = "*This API requires the following crate features to be activated: `GpuPresentationConfiguration`, `GpuTextureFormat`*"]
100+
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuTextureFormat`*"]
96101
#[doc = ""]
97102
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
98103
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
@@ -110,7 +115,7 @@ impl GpuPresentationConfiguration {
110115
#[cfg(web_sys_unstable_apis)]
111116
#[doc = "Change the `size` field of this object."]
112117
#[doc = ""]
113-
#[doc = "*This API requires the following crate features to be activated: `GpuPresentationConfiguration`*"]
118+
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"]
114119
#[doc = ""]
115120
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
116121
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
@@ -127,7 +132,7 @@ impl GpuPresentationConfiguration {
127132
#[cfg(web_sys_unstable_apis)]
128133
#[doc = "Change the `usage` field of this object."]
129134
#[doc = ""]
130-
#[doc = "*This API requires the following crate features to be activated: `GpuPresentationConfiguration`*"]
135+
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"]
131136
#[doc = ""]
132137
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
133138
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]

crates/web-sys/src/features/gen_GpuPresentationContext.rs renamed to crates/web-sys/src/features/gen_GpuCanvasContext.rs

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -4,65 +4,73 @@ use wasm_bindgen::prelude::*;
44
#[cfg(web_sys_unstable_apis)]
55
#[wasm_bindgen]
66
extern "C" {
7-
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUPresentationContext , typescript_type = "GPUPresentationContext")]
7+
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUCanvasContext , typescript_type = "GPUCanvasContext")]
88
#[derive(Debug, Clone, PartialEq, Eq)]
9-
#[doc = "The `GpuPresentationContext` class."]
9+
#[doc = "The `GpuCanvasContext` class."]
1010
#[doc = ""]
11-
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUPresentationContext)"]
11+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCanvasContext)"]
1212
#[doc = ""]
13-
#[doc = "*This API requires the following crate features to be activated: `GpuPresentationContext`*"]
13+
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasContext`*"]
1414
#[doc = ""]
1515
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
1616
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
17-
pub type GpuPresentationContext;
17+
pub type GpuCanvasContext;
1818
#[cfg(web_sys_unstable_apis)]
19-
#[cfg(feature = "GpuPresentationConfiguration")]
20-
# [wasm_bindgen (method , structural , js_class = "GPUPresentationContext" , js_name = configure)]
19+
# [wasm_bindgen (structural , method , getter , js_class = "GPUCanvasContext" , js_name = canvas)]
20+
#[doc = "Getter for the `canvas` field of this object."]
21+
#[doc = ""]
22+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCanvasContext/canvas)"]
23+
#[doc = ""]
24+
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasContext`*"]
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 canvas(this: &GpuCanvasContext) -> ::js_sys::Object;
29+
#[cfg(web_sys_unstable_apis)]
30+
#[cfg(feature = "GpuCanvasConfiguration")]
31+
# [wasm_bindgen (method , structural , js_class = "GPUCanvasContext" , js_name = configure)]
2132
#[doc = "The `configure()` method."]
2233
#[doc = ""]
23-
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUPresentationContext/configure)"]
34+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCanvasContext/configure)"]
2435
#[doc = ""]
25-
#[doc = "*This API requires the following crate features to be activated: `GpuPresentationConfiguration`, `GpuPresentationContext`*"]
36+
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuCanvasContext`*"]
2637
#[doc = ""]
2738
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
2839
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
29-
pub fn configure(this: &GpuPresentationContext, configuration: &GpuPresentationConfiguration);
40+
pub fn configure(this: &GpuCanvasContext, configuration: &GpuCanvasConfiguration);
3041
#[cfg(web_sys_unstable_apis)]
3142
#[cfg(feature = "GpuTexture")]
32-
# [wasm_bindgen (method , structural , js_class = "GPUPresentationContext" , js_name = getCurrentTexture)]
43+
# [wasm_bindgen (method , structural , js_class = "GPUCanvasContext" , js_name = getCurrentTexture)]
3344
#[doc = "The `getCurrentTexture()` method."]
3445
#[doc = ""]
35-
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUPresentationContext/getCurrentTexture)"]
46+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCanvasContext/getCurrentTexture)"]
3647
#[doc = ""]
37-
#[doc = "*This API requires the following crate features to be activated: `GpuPresentationContext`, `GpuTexture`*"]
48+
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasContext`, `GpuTexture`*"]
3849
#[doc = ""]
3950
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
4051
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
41-
pub fn get_current_texture(this: &GpuPresentationContext) -> GpuTexture;
52+
pub fn get_current_texture(this: &GpuCanvasContext) -> GpuTexture;
4253
#[cfg(web_sys_unstable_apis)]
4354
#[cfg(all(feature = "GpuAdapter", feature = "GpuTextureFormat",))]
44-
# [wasm_bindgen (method , structural , js_class = "GPUPresentationContext" , js_name = getPreferredFormat)]
55+
# [wasm_bindgen (method , structural , js_class = "GPUCanvasContext" , js_name = getPreferredFormat)]
4556
#[doc = "The `getPreferredFormat()` method."]
4657
#[doc = ""]
47-
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUPresentationContext/getPreferredFormat)"]
58+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCanvasContext/getPreferredFormat)"]
4859
#[doc = ""]
49-
#[doc = "*This API requires the following crate features to be activated: `GpuAdapter`, `GpuPresentationContext`, `GpuTextureFormat`*"]
60+
#[doc = "*This API requires the following crate features to be activated: `GpuAdapter`, `GpuCanvasContext`, `GpuTextureFormat`*"]
5061
#[doc = ""]
5162
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
5263
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
53-
pub fn get_preferred_format(
54-
this: &GpuPresentationContext,
55-
adapter: &GpuAdapter,
56-
) -> GpuTextureFormat;
64+
pub fn get_preferred_format(this: &GpuCanvasContext, adapter: &GpuAdapter) -> GpuTextureFormat;
5765
#[cfg(web_sys_unstable_apis)]
58-
# [wasm_bindgen (method , structural , js_class = "GPUPresentationContext" , js_name = unconfigure)]
66+
# [wasm_bindgen (method , structural , js_class = "GPUCanvasContext" , js_name = unconfigure)]
5967
#[doc = "The `unconfigure()` method."]
6068
#[doc = ""]
61-
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUPresentationContext/unconfigure)"]
69+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCanvasContext/unconfigure)"]
6270
#[doc = ""]
63-
#[doc = "*This API requires the following crate features to be activated: `GpuPresentationContext`*"]
71+
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasContext`*"]
6472
#[doc = ""]
6573
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
6674
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
67-
pub fn unconfigure(this: &GpuPresentationContext);
75+
pub fn unconfigure(this: &GpuCanvasContext);
6876
}

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

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -109,4 +109,46 @@ impl GpuRenderBundleEncoderDescriptor {
109109
let _ = r;
110110
self
111111
}
112+
#[cfg(web_sys_unstable_apis)]
113+
#[doc = "Change the `depthReadOnly` field of this object."]
114+
#[doc = ""]
115+
#[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleEncoderDescriptor`*"]
116+
#[doc = ""]
117+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
118+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
119+
pub fn depth_read_only(&mut self, val: bool) -> &mut Self {
120+
use wasm_bindgen::JsValue;
121+
let r = ::js_sys::Reflect::set(
122+
self.as_ref(),
123+
&JsValue::from("depthReadOnly"),
124+
&JsValue::from(val),
125+
);
126+
debug_assert!(
127+
r.is_ok(),
128+
"setting properties should never fail on our dictionary objects"
129+
);
130+
let _ = r;
131+
self
132+
}
133+
#[cfg(web_sys_unstable_apis)]
134+
#[doc = "Change the `stencilReadOnly` field of this object."]
135+
#[doc = ""]
136+
#[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleEncoderDescriptor`*"]
137+
#[doc = ""]
138+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
139+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
140+
pub fn stencil_read_only(&mut self, val: bool) -> &mut Self {
141+
use wasm_bindgen::JsValue;
142+
let r = ::js_sys::Reflect::set(
143+
self.as_ref(),
144+
&JsValue::from("stencilReadOnly"),
145+
&JsValue::from(val),
146+
);
147+
debug_assert!(
148+
r.is_ok(),
149+
"setting properties should never fail on our dictionary objects"
150+
);
151+
let _ = r;
152+
self
153+
}
112154
}

0 commit comments

Comments
 (0)