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

Update WebGPU API to draft 2024-11-22 #4290

Merged
merged 2 commits into from
Nov 28, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -32,6 +32,9 @@
* Added support for `no_std` to `link_to!`, `static_string` (via `thread_local_v2`) and `throw`.
[#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)
daxpedda marked this conversation as resolved.
Show resolved Hide resolved

### Changed

* String enums now generate private TypeScript types but only if used.
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 @@ -513,6 +513,8 @@ GpuComputePassEncoder = []
GpuComputePassTimestampWrites = []
GpuComputePipeline = []
GpuComputePipelineDescriptor = []
GpuCopyExternalImageDestInfo = []
GpuCopyExternalImageSourceInfo = []
GpuCullMode = []
GpuDepthStencilState = []
GpuDevice = ["EventTarget"]
Expand All @@ -529,11 +531,6 @@ GpuFeatureName = []
GpuFilterMode = []
GpuFragmentState = []
GpuFrontFace = []
GpuImageCopyBuffer = []
GpuImageCopyExternalImage = []
GpuImageCopyTexture = []
GpuImageCopyTextureTagged = []
GpuImageDataLayout = []
GpuIndexFormat = []
GpuInternalError = ["GpuError"]
GpuLoadOp = []
Expand Down Expand Up @@ -585,6 +582,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