Skip to content

Commit

Permalink
Update WebGPU API to draft 2024-11-22 (#4290)
Browse files Browse the repository at this point in the history
  • Loading branch information
nolanderc authored Nov 28, 2024
1 parent ee7a6b5 commit a955368
Show file tree
Hide file tree
Showing 15 changed files with 332 additions and 254 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,9 @@
* Deprecated `#[wasm_bindgen(thread_local)]` in favor of `#[wasm_bindgen(thread_local_v2)]`, which creates a `wasm_bindgen::JsThreadLocal`. It is similar to `std::thread::LocalKey` but supports `no_std`.
[#4277](https://github.com/rustwasm/wasm-bindgen/pull/4277)

* Updated the WebGPU API to the current draft as of 2024-11-22.
[#4290](https://github.com/rustwasm/wasm-bindgen/pull/4290)

### Fixed

* Fixed methods with `self: &Self` consuming the object.
Expand Down
10 changes: 5 additions & 5 deletions crates/web-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -520,6 +520,8 @@ GpuComputePassEncoder = []
GpuComputePassTimestampWrites = []
GpuComputePipeline = []
GpuComputePipelineDescriptor = []
GpuCopyExternalImageDestInfo = []
GpuCopyExternalImageSourceInfo = []
GpuCullMode = []
GpuDepthStencilState = []
GpuDevice = ["EventTarget"]
Expand All @@ -536,11 +538,6 @@ GpuFeatureName = []
GpuFilterMode = []
GpuFragmentState = []
GpuFrontFace = []
GpuImageCopyBuffer = []
GpuImageCopyExternalImage = []
GpuImageCopyTexture = []
GpuImageCopyTextureTagged = []
GpuImageDataLayout = []
GpuIndexFormat = []
GpuInternalError = ["GpuError"]
GpuLoadOp = []
Expand Down Expand Up @@ -592,6 +589,9 @@ GpuStorageTextureBindingLayout = []
GpuStoreOp = []
GpuSupportedFeatures = []
GpuSupportedLimits = []
GpuTexelCopyBufferInfo = []
GpuTexelCopyBufferLayout = []
GpuTexelCopyTextureInfo = []
GpuTexture = []
GpuTextureAspect = []
GpuTextureBindingLayout = []
Expand Down
90 changes: 48 additions & 42 deletions crates/web-sys/src/features/gen_GpuCommandEncoder.rs
Original file line number Diff line number Diff line change
Expand Up @@ -189,7 +189,7 @@ extern "C" {
);
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuBuffer")]
# [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)]
# [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)]
#[doc = "The `copyBufferToBuffer()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)"]
Expand All @@ -205,10 +205,10 @@ extern "C" {
destination: &GpuBuffer,
destination_offset: u32,
size: u32,
);
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuBuffer")]
# [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)]
# [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)]
#[doc = "The `copyBufferToBuffer()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)"]
Expand All @@ -224,10 +224,10 @@ extern "C" {
destination: &GpuBuffer,
destination_offset: u32,
size: u32,
);
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuBuffer")]
# [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)]
# [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)]
#[doc = "The `copyBufferToBuffer()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)"]
Expand All @@ -243,10 +243,10 @@ extern "C" {
destination: &GpuBuffer,
destination_offset: f64,
size: u32,
);
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuBuffer")]
# [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)]
# [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)]
#[doc = "The `copyBufferToBuffer()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)"]
Expand All @@ -262,10 +262,10 @@ extern "C" {
destination: &GpuBuffer,
destination_offset: f64,
size: u32,
);
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuBuffer")]
# [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)]
# [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)]
#[doc = "The `copyBufferToBuffer()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)"]
Expand All @@ -281,10 +281,10 @@ extern "C" {
destination: &GpuBuffer,
destination_offset: u32,
size: f64,
);
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuBuffer")]
# [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)]
# [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)]
#[doc = "The `copyBufferToBuffer()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)"]
Expand All @@ -300,10 +300,10 @@ extern "C" {
destination: &GpuBuffer,
destination_offset: u32,
size: f64,
);
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuBuffer")]
# [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)]
# [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)]
#[doc = "The `copyBufferToBuffer()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)"]
Expand All @@ -319,10 +319,10 @@ extern "C" {
destination: &GpuBuffer,
destination_offset: f64,
size: f64,
);
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuBuffer")]
# [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)]
# [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToBuffer)]
#[doc = "The `copyBufferToBuffer()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToBuffer)"]
Expand All @@ -338,115 +338,121 @@ extern "C" {
destination: &GpuBuffer,
destination_offset: f64,
size: f64,
);
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(all(feature = "GpuImageCopyBuffer", feature = "GpuImageCopyTexture",))]
#[cfg(all(
feature = "GpuTexelCopyBufferInfo",
feature = "GpuTexelCopyTextureInfo",
))]
# [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToTexture)]
#[doc = "The `copyBufferToTexture()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToTexture)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuImageCopyBuffer`, `GpuImageCopyTexture`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuTexelCopyBufferInfo`, `GpuTexelCopyTextureInfo`*"]
#[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 copy_buffer_to_texture_with_u32_sequence(
this: &GpuCommandEncoder,
source: &GpuImageCopyBuffer,
destination: &GpuImageCopyTexture,
source: &GpuTexelCopyBufferInfo,
destination: &GpuTexelCopyTextureInfo,
copy_size: &::wasm_bindgen::JsValue,
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(all(
feature = "GpuExtent3dDict",
feature = "GpuImageCopyBuffer",
feature = "GpuImageCopyTexture",
feature = "GpuTexelCopyBufferInfo",
feature = "GpuTexelCopyTextureInfo",
))]
# [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyBufferToTexture)]
#[doc = "The `copyBufferToTexture()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyBufferToTexture)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuExtent3dDict`, `GpuImageCopyBuffer`, `GpuImageCopyTexture`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuExtent3dDict`, `GpuTexelCopyBufferInfo`, `GpuTexelCopyTextureInfo`*"]
#[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 copy_buffer_to_texture_with_gpu_extent_3d_dict(
this: &GpuCommandEncoder,
source: &GpuImageCopyBuffer,
destination: &GpuImageCopyTexture,
source: &GpuTexelCopyBufferInfo,
destination: &GpuTexelCopyTextureInfo,
copy_size: &GpuExtent3dDict,
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(all(feature = "GpuImageCopyBuffer", feature = "GpuImageCopyTexture",))]
#[cfg(all(
feature = "GpuTexelCopyBufferInfo",
feature = "GpuTexelCopyTextureInfo",
))]
# [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyTextureToBuffer)]
#[doc = "The `copyTextureToBuffer()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyTextureToBuffer)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuImageCopyBuffer`, `GpuImageCopyTexture`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuTexelCopyBufferInfo`, `GpuTexelCopyTextureInfo`*"]
#[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 copy_texture_to_buffer_with_u32_sequence(
this: &GpuCommandEncoder,
source: &GpuImageCopyTexture,
destination: &GpuImageCopyBuffer,
source: &GpuTexelCopyTextureInfo,
destination: &GpuTexelCopyBufferInfo,
copy_size: &::wasm_bindgen::JsValue,
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(all(
feature = "GpuExtent3dDict",
feature = "GpuImageCopyBuffer",
feature = "GpuImageCopyTexture",
feature = "GpuTexelCopyBufferInfo",
feature = "GpuTexelCopyTextureInfo",
))]
# [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyTextureToBuffer)]
#[doc = "The `copyTextureToBuffer()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyTextureToBuffer)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuExtent3dDict`, `GpuImageCopyBuffer`, `GpuImageCopyTexture`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuExtent3dDict`, `GpuTexelCopyBufferInfo`, `GpuTexelCopyTextureInfo`*"]
#[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 copy_texture_to_buffer_with_gpu_extent_3d_dict(
this: &GpuCommandEncoder,
source: &GpuImageCopyTexture,
destination: &GpuImageCopyBuffer,
source: &GpuTexelCopyTextureInfo,
destination: &GpuTexelCopyBufferInfo,
copy_size: &GpuExtent3dDict,
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuImageCopyTexture")]
#[cfg(feature = "GpuTexelCopyTextureInfo")]
# [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyTextureToTexture)]
#[doc = "The `copyTextureToTexture()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyTextureToTexture)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuImageCopyTexture`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuTexelCopyTextureInfo`*"]
#[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 copy_texture_to_texture_with_u32_sequence(
this: &GpuCommandEncoder,
source: &GpuImageCopyTexture,
destination: &GpuImageCopyTexture,
source: &GpuTexelCopyTextureInfo,
destination: &GpuTexelCopyTextureInfo,
copy_size: &::wasm_bindgen::JsValue,
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
#[cfg(all(feature = "GpuExtent3dDict", feature = "GpuImageCopyTexture",))]
#[cfg(all(feature = "GpuExtent3dDict", feature = "GpuTexelCopyTextureInfo",))]
# [wasm_bindgen (catch , method , structural , js_class = "GPUCommandEncoder" , js_name = copyTextureToTexture)]
#[doc = "The `copyTextureToTexture()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/copyTextureToTexture)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuExtent3dDict`, `GpuImageCopyTexture`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuExtent3dDict`, `GpuTexelCopyTextureInfo`*"]
#[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 copy_texture_to_texture_with_gpu_extent_3d_dict(
this: &GpuCommandEncoder,
source: &GpuImageCopyTexture,
destination: &GpuImageCopyTexture,
source: &GpuTexelCopyTextureInfo,
destination: &GpuTexelCopyTextureInfo,
copy_size: &GpuExtent3dDict,
) -> Result<(), JsValue>;
#[cfg(web_sys_unstable_apis)]
Expand Down
Loading

0 comments on commit a955368

Please sign in to comment.