Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore(webgpu)!: update to latest WebGPU IDL as of 2024-01-30 #3816

Merged
merged 1 commit into from
Jan 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@
* Deprecate `wasm_bindgen_test_configure!`s `run_in_worker` in favor of `run_in_dedicated_worker`.
[#3804](https://github.com/rustwasm/wasm-bindgen/pull/3804)

* Updated the WebGPU WebIDL to the current draft as of 2024-01-30. Note that this retains the previous update's workaround for `GPUPipelineError`, and holds back an update to the `buffer` argument of the `GPUQueue.{writeBuffer,writeTexture}` methods.
[#3816](https://github.com/rustwasm/wasm-bindgen/pull/3816)

### Fixed

* Fixed UB when freeing strings received from JS if not using the default allocator.
Expand Down
14 changes: 0 additions & 14 deletions crates/web-sys/src/features/gen_GpuAdapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,20 +63,6 @@ extern "C" {
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn request_adapter_info(this: &GpuAdapter) -> ::js_sys::Promise;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "GPUAdapter" , js_name = requestAdapterInfo)]
#[doc = "The `requestAdapterInfo()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/requestAdapterInfo)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuAdapter`*"]
#[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 request_adapter_info_with_unmask_hints(
this: &GpuAdapter,
unmask_hints: &::wasm_bindgen::JsValue,
) -> ::js_sys::Promise;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "GPUAdapter" , js_name = requestDevice)]
#[doc = "The `requestDevice()` method."]
#[doc = ""]
Expand Down
12 changes: 0 additions & 12 deletions crates/web-sys/src/features/gen_GpuCommandEncoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -515,18 +515,6 @@ extern "C" {
destination_offset: f64,
);
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuQuerySet")]
# [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = writeTimestamp)]
#[doc = "The `writeTimestamp()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/writeTimestamp)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `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 write_timestamp(this: &GpuCommandEncoder, query_set: &GpuQuerySet, query_index: u32);
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = insertDebugMarker)]
#[doc = "The `insertDebugMarker()` method."]
#[doc = ""]
Expand Down
12 changes: 3 additions & 9 deletions crates/web-sys/src/features/gen_GpuDepthStencilState.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,16 @@ extern "C" {
}
#[cfg(web_sys_unstable_apis)]
impl GpuDepthStencilState {
#[cfg(all(feature = "GpuCompareFunction", feature = "GpuTextureFormat",))]
#[cfg(feature = "GpuTextureFormat")]
#[doc = "Construct a new `GpuDepthStencilState`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuCompareFunction`, `GpuDepthStencilState`, `GpuTextureFormat`*"]
#[doc = "*This API requires the following crate features to be activated: `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(
depth_compare: GpuCompareFunction,
depth_write_enabled: bool,
format: GpuTextureFormat,
) -> Self {
pub fn new(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
7 changes: 1 addition & 6 deletions crates/web-sys/src/features/gen_GpuFragmentState.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,9 @@ impl GpuFragmentState {
#[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(
entry_point: &str,
module: &GpuShaderModule,
targets: &::wasm_bindgen::JsValue,
) -> Self {
pub fn new(module: &GpuShaderModule, targets: &::wasm_bindgen::JsValue) -> Self {
#[allow(unused_mut)]
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret.entry_point(entry_point);
ret.module(module);
ret.targets(targets);
ret
Expand Down
3 changes: 1 addition & 2 deletions crates/web-sys/src/features/gen_GpuProgrammableStage.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ impl GpuProgrammableStage {
#[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(entry_point: &str, module: &GpuShaderModule) -> Self {
pub fn new(module: &GpuShaderModule) -> Self {
#[allow(unused_mut)]
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret.entry_point(entry_point);
ret.module(module);
ret
}
Expand Down
21 changes: 21 additions & 0 deletions crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,27 @@ impl GpuRenderPassColorAttachment {
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `depthSlice` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`*"]
#[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 depth_slice(&mut self, val: u32) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("depthSlice"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuLoadOp")]
#[doc = "Change the `loadOp` field of this object."]
#[doc = ""]
Expand Down
30 changes: 23 additions & 7 deletions crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,34 @@ impl GpuShaderModuleCompilationHint {
#[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() -> Self {
pub fn new(entry_point: &str) -> Self {
#[allow(unused_mut)]
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret.entry_point(entry_point);
ret
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `entryPoint` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleCompilationHint`*"]
#[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 entry_point(&mut self, val: &str) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("entryPoint"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `layout` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleCompilationHint`*"]
Expand All @@ -47,9 +69,3 @@ impl GpuShaderModuleCompilationHint {
self
}
}
#[cfg(web_sys_unstable_apis)]
impl Default for GpuShaderModuleCompilationHint {
fn default() -> Self {
Self::new()
}
}
21 changes: 21 additions & 0 deletions crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,27 @@ impl GpuShaderModuleDescriptor {
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `compilationHints` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleDescriptor`*"]
#[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 compilation_hints(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("compilationHints"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `sourceMap` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleDescriptor`*"]
Expand Down
2 changes: 2 additions & 0 deletions crates/web-sys/src/features/gen_GpuStorageTextureAccess.rs
Original file line number Diff line number Diff line change
Expand Up @@ -12,4 +12,6 @@ use wasm_bindgen::prelude::*;
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum GpuStorageTextureAccess {
WriteOnly = "write-only",
ReadOnly = "read-only",
ReadWrite = "read-write",
}
1 change: 1 addition & 0 deletions crates/web-sys/src/features/gen_GpuTextureFormat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ pub enum GpuTextureFormat {
Bgra8unorm = "bgra8unorm",
Bgra8unormSrgb = "bgra8unorm-srgb",
Rgb9e5ufloat = "rgb9e5ufloat",
Rgb10a2uint = "rgb10a2uint",
Rgb10a2unorm = "rgb10a2unorm",
Rg11b10ufloat = "rg11b10ufloat",
Rg32uint = "rg32uint",
Expand Down
1 change: 1 addition & 0 deletions crates/web-sys/src/features/gen_GpuVertexFormat.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,4 +41,5 @@ pub enum GpuVertexFormat {
Sint32x2 = "sint32x2",
Sint32x3 = "sint32x3",
Sint32x4 = "sint32x4",
Unorm1010102 = "unorm10-10-10-2",
}
3 changes: 1 addition & 2 deletions crates/web-sys/src/features/gen_GpuVertexState.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,9 @@ impl GpuVertexState {
#[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(entry_point: &str, module: &GpuShaderModule) -> Self {
pub fn new(module: &GpuShaderModule) -> Self {
#[allow(unused_mut)]
let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new());
ret.entry_point(entry_point);
ret.module(module);
ret
}
Expand Down
Loading
Loading