Skip to content

Commit b2caf83

Browse files
authored
Update to latest WebGPU WebIDL (#2596)
1 parent 80da105 commit b2caf83

31 files changed

+916
-389
lines changed

crates/web-sys/Cargo.toml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -403,8 +403,6 @@ GetRootNodeOptions = []
403403
GetUserMediaRequest = []
404404
Gpu = []
405405
GpuAdapter = []
406-
GpuAdapterFeatures = []
407-
GpuAdapterLimits = []
408406
GpuAddressMode = []
409407
GpuBindGroup = []
410408
GpuBindGroupDescriptor = []
@@ -422,7 +420,7 @@ GpuBufferBindingLayout = []
422420
GpuBufferBindingType = []
423421
GpuBufferDescriptor = []
424422
GpuBufferUsage = []
425-
GpuCanvasContext = []
423+
GpuCanvasCompositingAlphaMode = []
426424
GpuColorDict = []
427425
GpuColorTargetState = []
428426
GpuColorWrite = []
@@ -446,13 +444,17 @@ GpuDeviceLostInfo = []
446444
GpuDeviceLostReason = []
447445
GpuErrorFilter = []
448446
GpuExtent3dDict = []
447+
GpuExternalTexture = []
448+
GpuExternalTextureBindingLayout = []
449+
GpuExternalTextureDescriptor = []
449450
GpuFeatureName = []
450451
GpuFilterMode = []
451452
GpuFragmentState = []
452453
GpuFrontFace = []
453454
GpuImageCopyBuffer = []
454-
GpuImageCopyImageBitmap = []
455+
GpuImageCopyExternalImage = []
455456
GpuImageCopyTexture = []
457+
GpuImageCopyTextureTagged = []
456458
GpuImageDataLayout = []
457459
GpuIndexFormat = []
458460
GpuInputStepMode = []
@@ -468,6 +470,9 @@ GpuPipelineLayout = []
468470
GpuPipelineLayoutDescriptor = []
469471
GpuPipelineStatisticName = []
470472
GpuPowerPreference = []
473+
GpuPredefinedColorSpace = []
474+
GpuPresentationConfiguration = []
475+
GpuPresentationContext = []
471476
GpuPrimitiveState = []
472477
GpuPrimitiveTopology = []
473478
GpuProgrammableStage = []
@@ -498,8 +503,8 @@ GpuStencilOperation = []
498503
GpuStorageTextureAccess = []
499504
GpuStorageTextureBindingLayout = []
500505
GpuStoreOp = []
501-
GpuSwapChain = []
502-
GpuSwapChainDescriptor = []
506+
GpuSupportedFeatures = []
507+
GpuSupportedLimits = []
503508
GpuTexture = []
504509
GpuTextureAspect = []
505510
GpuTextureBindingLayout = []

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

Lines changed: 17 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,29 +27,40 @@ 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-
#[cfg(feature = "GpuAdapterFeatures")]
30+
#[cfg(feature = "GpuSupportedFeatures")]
3131
# [wasm_bindgen (structural , method , getter , js_class = "GPUAdapter" , js_name = features)]
3232
#[doc = "Getter for the `features` field of this object."]
3333
#[doc = ""]
3434
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/features)"]
3535
#[doc = ""]
36-
#[doc = "*This API requires the following crate features to be activated: `GpuAdapter`, `GpuAdapterFeatures`*"]
36+
#[doc = "*This API requires the following crate features to be activated: `GpuAdapter`, `GpuSupportedFeatures`*"]
3737
#[doc = ""]
3838
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
3939
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
40-
pub fn features(this: &GpuAdapter) -> GpuAdapterFeatures;
40+
pub fn features(this: &GpuAdapter) -> GpuSupportedFeatures;
4141
#[cfg(web_sys_unstable_apis)]
42-
#[cfg(feature = "GpuAdapterLimits")]
42+
#[cfg(feature = "GpuSupportedLimits")]
4343
# [wasm_bindgen (structural , method , getter , js_class = "GPUAdapter" , js_name = limits)]
4444
#[doc = "Getter for the `limits` field of this object."]
4545
#[doc = ""]
4646
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/limits)"]
4747
#[doc = ""]
48-
#[doc = "*This API requires the following crate features to be activated: `GpuAdapter`, `GpuAdapterLimits`*"]
48+
#[doc = "*This API requires the following crate features to be activated: `GpuAdapter`, `GpuSupportedLimits`*"]
4949
#[doc = ""]
5050
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
5151
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
52-
pub fn limits(this: &GpuAdapter) -> GpuAdapterLimits;
52+
pub fn limits(this: &GpuAdapter) -> GpuSupportedLimits;
53+
#[cfg(web_sys_unstable_apis)]
54+
# [wasm_bindgen (structural , method , getter , js_class = "GPUAdapter" , js_name = isSoftware)]
55+
#[doc = "Getter for the `isSoftware` field of this object."]
56+
#[doc = ""]
57+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/isSoftware)"]
58+
#[doc = ""]
59+
#[doc = "*This API requires the following crate features to be activated: `GpuAdapter`*"]
60+
#[doc = ""]
61+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
62+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
63+
pub fn is_software(this: &GpuAdapter) -> bool;
5364
#[cfg(web_sys_unstable_apis)]
5465
# [wasm_bindgen (method , structural , js_class = "GPUAdapter" , js_name = requestDevice)]
5566
#[doc = "The `requestDevice()` method."]

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,28 @@ impl GpuBindGroupLayoutEntry {
7070
self
7171
}
7272
#[cfg(web_sys_unstable_apis)]
73+
#[cfg(feature = "GpuExternalTextureBindingLayout")]
74+
#[doc = "Change the `externalTexture` field of this object."]
75+
#[doc = ""]
76+
#[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`, `GpuExternalTextureBindingLayout`*"]
77+
#[doc = ""]
78+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
79+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
80+
pub fn external_texture(&mut self, val: &GpuExternalTextureBindingLayout) -> &mut Self {
81+
use wasm_bindgen::JsValue;
82+
let r = ::js_sys::Reflect::set(
83+
self.as_ref(),
84+
&JsValue::from("externalTexture"),
85+
&JsValue::from(val),
86+
);
87+
debug_assert!(
88+
r.is_ok(),
89+
"setting properties should never fail on our dictionary objects"
90+
);
91+
let _ = r;
92+
self
93+
}
94+
#[cfg(web_sys_unstable_apis)]
7395
#[cfg(feature = "GpuSamplerBindingLayout")]
7496
#[doc = "Change the `sampler` field of this object."]
7597
#[doc = ""]

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

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ use wasm_bindgen::prelude::*;
1212
pub enum GpuBlendFactor {
1313
Zero = "zero",
1414
One = "one",
15-
SrcColor = "src-color",
16-
OneMinusSrcColor = "one-minus-src-color",
15+
Src = "src",
16+
OneMinusSrc = "one-minus-src",
1717
SrcAlpha = "src-alpha",
1818
OneMinusSrcAlpha = "one-minus-src-alpha",
19-
DstColor = "dst-color",
20-
OneMinusDstColor = "one-minus-dst-color",
19+
Dst = "dst",
20+
OneMinusDst = "one-minus-dst",
2121
DstAlpha = "dst-alpha",
2222
OneMinusDstAlpha = "one-minus-dst-alpha",
2323
SrcAlphaSaturated = "src-alpha-saturated",
24-
BlendColor = "blend-color",
25-
OneMinusBlendColor = "one-minus-blend-color",
24+
Constant = "constant",
25+
OneMinusConstant = "one-minus-constant",
2626
}
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
#![allow(unused_imports)]
2+
use wasm_bindgen::prelude::*;
3+
#[cfg(web_sys_unstable_apis)]
4+
#[wasm_bindgen]
5+
#[doc = "The `GpuCanvasCompositingAlphaMode` enum."]
6+
#[doc = ""]
7+
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasCompositingAlphaMode`*"]
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 GpuCanvasCompositingAlphaMode {
13+
Opaque = "opaque",
14+
Premultiplied = "premultiplied",
15+
}

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

Lines changed: 0 additions & 48 deletions
This file was deleted.

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

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,4 +60,26 @@ extern "C" {
6060
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
6161
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
6262
pub fn line_pos(this: &GpuCompilationMessage) -> f64;
63+
#[cfg(web_sys_unstable_apis)]
64+
# [wasm_bindgen (structural , method , getter , js_class = "GPUCompilationMessage" , js_name = offset)]
65+
#[doc = "Getter for the `offset` field of this object."]
66+
#[doc = ""]
67+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCompilationMessage/offset)"]
68+
#[doc = ""]
69+
#[doc = "*This API requires the following crate features to be activated: `GpuCompilationMessage`*"]
70+
#[doc = ""]
71+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
72+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
73+
pub fn offset(this: &GpuCompilationMessage) -> f64;
74+
#[cfg(web_sys_unstable_apis)]
75+
# [wasm_bindgen (structural , method , getter , js_class = "GPUCompilationMessage" , js_name = length)]
76+
#[doc = "Getter for the `length` field of this object."]
77+
#[doc = ""]
78+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCompilationMessage/length)"]
79+
#[doc = ""]
80+
#[doc = "*This API requires the following crate features to be activated: `GpuCompilationMessage`*"]
81+
#[doc = ""]
82+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
83+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
84+
pub fn length(this: &GpuCompilationMessage) -> f64;
6385
}

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

Lines changed: 0 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -30,27 +30,6 @@ impl GpuDepthStencilState {
3030
ret
3131
}
3232
#[cfg(web_sys_unstable_apis)]
33-
#[doc = "Change the `clampDepth` field of this object."]
34-
#[doc = ""]
35-
#[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`*"]
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 clamp_depth(&mut self, val: bool) -> &mut Self {
40-
use wasm_bindgen::JsValue;
41-
let r = ::js_sys::Reflect::set(
42-
self.as_ref(),
43-
&JsValue::from("clampDepth"),
44-
&JsValue::from(val),
45-
);
46-
debug_assert!(
47-
r.is_ok(),
48-
"setting properties should never fail on our dictionary objects"
49-
);
50-
let _ = r;
51-
self
52-
}
53-
#[cfg(web_sys_unstable_apis)]
5433
#[doc = "Change the `depthBias` field of this object."]
5534
#[doc = ""]
5635
#[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`*"]

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

Lines changed: 24 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -16,39 +16,29 @@ extern "C" {
1616
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
1717
pub type GpuDevice;
1818
#[cfg(web_sys_unstable_apis)]
19-
#[cfg(feature = "GpuAdapter")]
20-
# [wasm_bindgen (structural , method , getter , js_class = "GPUDevice" , js_name = adapter)]
21-
#[doc = "Getter for the `adapter` field of this object."]
22-
#[doc = ""]
23-
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/adapter)"]
24-
#[doc = ""]
25-
#[doc = "*This API requires the following crate features to be activated: `GpuAdapter`, `GpuDevice`*"]
26-
#[doc = ""]
27-
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
28-
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
29-
pub fn adapter(this: &GpuDevice) -> GpuAdapter;
30-
#[cfg(web_sys_unstable_apis)]
19+
#[cfg(feature = "GpuSupportedFeatures")]
3120
# [wasm_bindgen (structural , method , getter , js_class = "GPUDevice" , js_name = features)]
3221
#[doc = "Getter for the `features` field of this object."]
3322
#[doc = ""]
3423
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/features)"]
3524
#[doc = ""]
36-
#[doc = "*This API requires the following crate features to be activated: `GpuDevice`*"]
25+
#[doc = "*This API requires the following crate features to be activated: `GpuDevice`, `GpuSupportedFeatures`*"]
3726
#[doc = ""]
3827
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
3928
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
40-
pub fn features(this: &GpuDevice) -> ::js_sys::Array;
29+
pub fn features(this: &GpuDevice) -> GpuSupportedFeatures;
4130
#[cfg(web_sys_unstable_apis)]
31+
#[cfg(feature = "GpuSupportedLimits")]
4232
# [wasm_bindgen (structural , method , getter , js_class = "GPUDevice" , js_name = limits)]
4333
#[doc = "Getter for the `limits` field of this object."]
4434
#[doc = ""]
4535
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/limits)"]
4636
#[doc = ""]
47-
#[doc = "*This API requires the following crate features to be activated: `GpuDevice`*"]
37+
#[doc = "*This API requires the following crate features to be activated: `GpuDevice`, `GpuSupportedLimits`*"]
4838
#[doc = ""]
4939
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
5040
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
51-
pub fn limits(this: &GpuDevice) -> ::js_sys::Object;
41+
pub fn limits(this: &GpuDevice) -> GpuSupportedLimits;
5242
#[cfg(web_sys_unstable_apis)]
5343
#[cfg(feature = "GpuQueue")]
5444
# [wasm_bindgen (structural , method , getter , js_class = "GPUDevice" , js_name = queue)]
@@ -360,6 +350,24 @@ extern "C" {
360350
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
361351
pub fn destroy(this: &GpuDevice);
362352
#[cfg(web_sys_unstable_apis)]
353+
#[cfg(all(
354+
feature = "GpuExternalTexture",
355+
feature = "GpuExternalTextureDescriptor",
356+
))]
357+
# [wasm_bindgen (method , structural , js_class = "GPUDevice" , js_name = importExternalTexture)]
358+
#[doc = "The `importExternalTexture()` method."]
359+
#[doc = ""]
360+
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/importExternalTexture)"]
361+
#[doc = ""]
362+
#[doc = "*This API requires the following crate features to be activated: `GpuDevice`, `GpuExternalTexture`, `GpuExternalTextureDescriptor`*"]
363+
#[doc = ""]
364+
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
365+
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
366+
pub fn import_external_texture(
367+
this: &GpuDevice,
368+
descriptor: &GpuExternalTextureDescriptor,
369+
) -> GpuExternalTexture;
370+
#[cfg(web_sys_unstable_apis)]
363371
# [wasm_bindgen (method , structural , js_class = "GPUDevice" , js_name = popErrorScope)]
364372
#[doc = "The `popErrorScope()` method."]
365373
#[doc = ""]

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,17 +45,17 @@ impl GpuDeviceDescriptor {
4545
self
4646
}
4747
#[cfg(web_sys_unstable_apis)]
48-
#[doc = "Change the `nonGuaranteedFeatures` field of this object."]
48+
#[doc = "Change the `requiredFeatures` field of this object."]
4949
#[doc = ""]
5050
#[doc = "*This API requires the following crate features to be activated: `GpuDeviceDescriptor`*"]
5151
#[doc = ""]
5252
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
5353
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
54-
pub fn non_guaranteed_features(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
54+
pub fn required_features(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
5555
use wasm_bindgen::JsValue;
5656
let r = ::js_sys::Reflect::set(
5757
self.as_ref(),
58-
&JsValue::from("nonGuaranteedFeatures"),
58+
&JsValue::from("requiredFeatures"),
5959
&JsValue::from(val),
6060
);
6161
debug_assert!(

0 commit comments

Comments
 (0)