Skip to content

Commit

Permalink
Update WebGPU's webidl (#3480)
Browse files Browse the repository at this point in the history
  • Loading branch information
JolifantoBambla authored Jun 14, 2023
1 parent f569fdd commit e84fd83
Show file tree
Hide file tree
Showing 25 changed files with 539 additions and 291 deletions.
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,13 @@
* Extend `AudioContext` with unstable features supporting audio sink configuration.
[#3433](https://github.com/rustwasm/wasm-bindgen/pull/3433)

### Changed

* Updated the WebGPU WebIDL.
The optional `message` argument of [`GPUPipelineError`](https://www.w3.org/TR/webgpu/#gpupipelineerror)'s constructor has been manually specified as a required argument,
because required arguments occurring after optional arguments are currently not supported by the generator.
[#3480](https://github.com/rustwasm/wasm-bindgen/pull/3480)

## [0.2.87](https://github.com/rustwasm/wasm-bindgen/compare/0.2.86...0.2.87)

Released 2023-06-12.
Expand Down
10 changes: 6 additions & 4 deletions crates/web-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -481,8 +481,7 @@ GpuCompilationMessage = []
GpuCompilationMessageType = []
GpuComputePassDescriptor = []
GpuComputePassEncoder = []
GpuComputePassTimestampLocation = []
GpuComputePassTimestampWrite = []
GpuComputePassTimestampWrites = []
GpuComputePipeline = []
GpuComputePipelineDescriptor = []
GpuCullMode = []
Expand Down Expand Up @@ -516,6 +515,9 @@ GpuOrigin2dDict = []
GpuOrigin3dDict = []
GpuOutOfMemoryError = ["GpuError"]
GpuPipelineDescriptorBase = []
GpuPipelineError = ["DomException"]
GpuPipelineErrorInit = []
GpuPipelineErrorReason = []
GpuPipelineLayout = []
GpuPipelineLayoutDescriptor = []
GpuPowerPreference = []
Expand All @@ -536,8 +538,7 @@ GpuRenderPassDepthStencilAttachment = []
GpuRenderPassDescriptor = []
GpuRenderPassEncoder = []
GpuRenderPassLayout = []
GpuRenderPassTimestampLocation = []
GpuRenderPassTimestampWrite = []
GpuRenderPassTimestampWrites = []
GpuRenderPipeline = []
GpuRenderPipelineDescriptor = []
GpuRequestAdapterOptions = []
Expand Down Expand Up @@ -1524,6 +1525,7 @@ WebglDrawBuffers = []
WebglLoseContext = []
WebglMultiDraw = []
WebrtcGlobalStatisticsReport = []
WgslLanguageFeatures = []
WheelEvent = ["Event", "MouseEvent", "UiEvent"]
WheelEventInit = []
WidevineCdmManifest = []
Expand Down
12 changes: 12 additions & 0 deletions crates/web-sys/src/features/gen_Gpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ extern "C" {
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub type Gpu;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "WgslLanguageFeatures")]
# [wasm_bindgen (structural , method , getter , js_class = "GPU" , js_name = wgslLanguageFeatures)]
#[doc = "Getter for the `wgslLanguageFeatures` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPU/wgslLanguageFeatures)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Gpu`, `WgslLanguageFeatures`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn wgsl_language_features(this: &Gpu) -> WgslLanguageFeatures;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuTextureFormat")]
# [wasm_bindgen (method , structural , js_class = "GPU" , js_name = getPreferredCanvasFormat)]
#[doc = "The `getPreferredCanvasFormat()` method."]
Expand Down
5 changes: 3 additions & 2 deletions crates/web-sys/src/features/gen_GpuComputePassDescriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,13 +46,14 @@ impl GpuComputePassDescriptor {
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuComputePassTimestampWrites")]
#[doc = "Change the `timestampWrites` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuComputePassDescriptor`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuComputePassDescriptor`, `GpuComputePassTimestampWrites`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn timestamp_writes(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
pub fn timestamp_writes(&mut self, val: &GpuComputePassTimestampWrites) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
Expand Down
12 changes: 8 additions & 4 deletions crates/web-sys/src/features/gen_GpuComputePassEncoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,11 @@ extern "C" {
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn set_bind_group(this: &GpuComputePassEncoder, index: u32, bind_group: &GpuBindGroup);
pub fn set_bind_group(
this: &GpuComputePassEncoder,
index: u32,
bind_group: Option<&GpuBindGroup>,
);
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuBindGroup")]
# [wasm_bindgen (method , structural , js_class = "GPUComputePassEncoder" , js_name = setBindGroup)]
Expand All @@ -161,7 +165,7 @@ extern "C" {
pub fn set_bind_group_with_u32_sequence(
this: &GpuComputePassEncoder,
index: u32,
bind_group: &GpuBindGroup,
bind_group: Option<&GpuBindGroup>,
dynamic_offsets: &::wasm_bindgen::JsValue,
);
#[cfg(web_sys_unstable_apis)]
Expand All @@ -178,7 +182,7 @@ extern "C" {
pub fn set_bind_group_with_u32_array_and_u32_and_dynamic_offsets_data_length(
this: &GpuComputePassEncoder,
index: u32,
bind_group: &GpuBindGroup,
bind_group: Option<&GpuBindGroup>,
dynamic_offsets_data: &[u32],
dynamic_offsets_data_start: u32,
dynamic_offsets_data_length: u32,
Expand All @@ -197,7 +201,7 @@ extern "C" {
pub fn set_bind_group_with_u32_array_and_f64_and_dynamic_offsets_data_length(
this: &GpuComputePassEncoder,
index: u32,
bind_group: &GpuBindGroup,
bind_group: Option<&GpuBindGroup>,
dynamic_offsets_data: &[u32],
dynamic_offsets_data_start: f64,
dynamic_offsets_data_length: u32,
Expand Down
16 changes: 0 additions & 16 deletions crates/web-sys/src/features/gen_GpuComputePassTimestampLocation.rs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -5,50 +5,43 @@ use wasm_bindgen::prelude::*;
#[cfg(web_sys_unstable_apis)]
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPURenderPassTimestampWrite)]
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUComputePassTimestampWrites)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `GpuRenderPassTimestampWrite` dictionary."]
#[doc = "The `GpuComputePassTimestampWrites` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuRenderPassTimestampWrite`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampWrites`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub type GpuRenderPassTimestampWrite;
pub type GpuComputePassTimestampWrites;
}
#[cfg(web_sys_unstable_apis)]
impl GpuRenderPassTimestampWrite {
#[cfg(all(feature = "GpuQuerySet", feature = "GpuRenderPassTimestampLocation",))]
#[doc = "Construct a new `GpuRenderPassTimestampWrite`."]
impl GpuComputePassTimestampWrites {
#[cfg(feature = "GpuQuerySet")]
#[doc = "Construct a new `GpuComputePassTimestampWrites`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuQuerySet`, `GpuRenderPassTimestampLocation`, `GpuRenderPassTimestampWrite`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampWrites`, `GpuQuerySet`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn new(
location: GpuRenderPassTimestampLocation,
query_index: u32,
query_set: &GpuQuerySet,
) -> Self {
pub fn new(query_set: &GpuQuerySet) -> Self {
#[allow(unused_mut)]
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret.location(location);
ret.query_index(query_index);
ret.query_set(query_set);
ret
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuRenderPassTimestampLocation")]
#[doc = "Change the `location` field of this object."]
#[doc = "Change the `beginningOfPassWriteIndex` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuRenderPassTimestampLocation`, `GpuRenderPassTimestampWrite`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampWrites`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn location(&mut self, val: GpuRenderPassTimestampLocation) -> &mut Self {
pub fn beginning_of_pass_write_index(&mut self, val: u32) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("location"),
&JsValue::from("beginningOfPassWriteIndex"),
&JsValue::from(val),
);
debug_assert!(
Expand All @@ -59,17 +52,17 @@ impl GpuRenderPassTimestampWrite {
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `queryIndex` field of this object."]
#[doc = "Change the `endOfPassWriteIndex` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuRenderPassTimestampWrite`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampWrites`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn query_index(&mut self, val: u32) -> &mut Self {
pub fn end_of_pass_write_index(&mut self, val: u32) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("queryIndex"),
&JsValue::from("endOfPassWriteIndex"),
&JsValue::from(val),
);
debug_assert!(
Expand All @@ -83,7 +76,7 @@ impl GpuRenderPassTimestampWrite {
#[cfg(feature = "GpuQuerySet")]
#[doc = "Change the `querySet` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuQuerySet`, `GpuRenderPassTimestampWrite`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuComputePassTimestampWrites`, `GpuQuerySet`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
Expand Down
12 changes: 9 additions & 3 deletions crates/web-sys/src/features/gen_GpuDepthStencilState.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,22 @@ extern "C" {
}
#[cfg(web_sys_unstable_apis)]
impl GpuDepthStencilState {
#[cfg(feature = "GpuTextureFormat")]
#[cfg(all(feature = "GpuCompareFunction", feature = "GpuTextureFormat",))]
#[doc = "Construct a new `GpuDepthStencilState`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`, `GpuTextureFormat`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCompareFunction`, `GpuDepthStencilState`, `GpuTextureFormat`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn new(format: GpuTextureFormat) -> Self {
pub fn new(
depth_compare: GpuCompareFunction,
depth_write_enabled: bool,
format: GpuTextureFormat,
) -> Self {
#[allow(unused_mut)]
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret.depth_compare(depth_compare);
ret.depth_write_enabled(depth_write_enabled);
ret.format(format);
ret
}
Expand Down
5 changes: 3 additions & 2 deletions crates/web-sys/src/features/gen_GpuDeviceLostInfo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,17 @@ extern "C" {
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub type GpuDeviceLostInfo;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuDeviceLostReason")]
# [wasm_bindgen (structural , method , getter , js_class = "GPUDeviceLostInfo" , js_name = reason)]
#[doc = "Getter for the `reason` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDeviceLostInfo/reason)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuDeviceLostInfo`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuDeviceLostInfo`, `GpuDeviceLostReason`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn reason(this: &GpuDeviceLostInfo) -> ::wasm_bindgen::JsValue;
pub fn reason(this: &GpuDeviceLostInfo) -> GpuDeviceLostReason;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (structural , method , getter , js_class = "GPUDeviceLostInfo" , js_name = message)]
#[doc = "Getter for the `message` field of this object."]
Expand Down
1 change: 1 addition & 0 deletions crates/web-sys/src/features/gen_GpuDeviceLostReason.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,6 @@ use wasm_bindgen::prelude::*;
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum GpuDeviceLostReason {
Unknown = "unknown",
Destroyed = "destroyed",
}
11 changes: 0 additions & 11 deletions crates/web-sys/src/features/gen_GpuExternalTexture.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,6 @@ extern "C" {
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub type GpuExternalTexture;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (structural , method , getter , js_class = "GPUExternalTexture" , js_name = expired)]
#[doc = "Getter for the `expired` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUExternalTexture/expired)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuExternalTexture`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn expired(this: &GpuExternalTexture) -> bool;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (structural , method , getter , js_class = "GPUExternalTexture" , js_name = label)]
#[doc = "Getter for the `label` field of this object."]
#[doc = ""]
Expand Down
10 changes: 4 additions & 6 deletions crates/web-sys/src/features/gen_GpuExternalTextureDescriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,13 @@ extern "C" {
}
#[cfg(web_sys_unstable_apis)]
impl GpuExternalTextureDescriptor {
#[cfg(feature = "HtmlVideoElement")]
#[doc = "Construct a new `GpuExternalTextureDescriptor`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuExternalTextureDescriptor`, `HtmlVideoElement`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuExternalTextureDescriptor`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn new(source: &HtmlVideoElement) -> Self {
pub fn new(source: &::js_sys::Object) -> Self {
#[allow(unused_mut)]
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret.source(source);
Expand All @@ -48,14 +47,13 @@ impl GpuExternalTextureDescriptor {
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "HtmlVideoElement")]
#[doc = "Change the `source` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuExternalTextureDescriptor`, `HtmlVideoElement`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuExternalTextureDescriptor`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn source(&mut self, val: &HtmlVideoElement) -> &mut Self {
pub fn source(&mut self, val: &::js_sys::Object) -> &mut Self {
use wasm_bindgen::JsValue;
let r =
::js_sys::Reflect::set(self.as_ref(), &JsValue::from("source"), &JsValue::from(val));
Expand Down
3 changes: 2 additions & 1 deletion crates/web-sys/src/features/gen_GpuFeatureName.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ pub enum GpuFeatureName {
TimestampQuery = "timestamp-query",
IndirectFirstInstance = "indirect-first-instance",
ShaderF16 = "shader-f16",
Bgra8unormStorage = "bgra8unorm-storage",
Rg11b10ufloatRenderable = "rg11b10ufloat-renderable",
Bgra8unormStorage = "bgra8unorm-storage",
Float32Filterable = "float32-filterable",
}
Loading

0 comments on commit e84fd83

Please sign in to comment.