diff --git a/crates/web-sys/Cargo.toml b/crates/web-sys/Cargo.toml index 54ca3348a61..4d9c7e42017 100644 --- a/crates/web-sys/Cargo.toml +++ b/crates/web-sys/Cargo.toml @@ -402,6 +402,7 @@ GetRootNodeOptions = [] GetUserMediaRequest = [] Gpu = [] GpuAdapter = [] +GpuAdapterFeatures = [] GpuAddressMode = [] GpuBindGroup = [] GpuBindGroupDescriptor = [] @@ -440,8 +441,8 @@ GpuDevice = ["EventTarget"] GpuDeviceDescriptor = [] GpuDeviceLostInfo = [] GpuErrorFilter = [] -GpuExtensionName = [] GpuExtent3dDict = [] +GpuFeatureName = [] GpuFence = [] GpuFenceDescriptor = [] GpuFilterMode = [] @@ -451,6 +452,7 @@ GpuIndexFormat = [] GpuInputStepMode = [] GpuLimits = [] GpuLoadOp = [] +GpuMapMode = [] GpuObjectDescriptorBase = [] GpuOrigin2dDict = [] GpuOrigin3dDict = [] @@ -632,7 +634,7 @@ IirFilterOptions = [] ImageBitmap = [] ImageBitmapFormat = [] ImageBitmapRenderingContext = [] -ImageCapture = ["EventTarget"] +ImageCapture = [] ImageCaptureError = [] ImageCaptureErrorEvent = ["Event"] ImageCaptureErrorEventInit = [] diff --git a/crates/web-sys/src/features/gen_GpuAdapter.rs b/crates/web-sys/src/features/gen_GpuAdapter.rs index cc7775ecacd..e3121c882b7 100644 --- a/crates/web-sys/src/features/gen_GpuAdapter.rs +++ b/crates/web-sys/src/features/gen_GpuAdapter.rs @@ -27,16 +27,17 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn name(this: &GpuAdapter) -> String; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (structural , method , getter , js_class = "GPUAdapter" , js_name = extensions)] - #[doc = "Getter for the `extensions` field of this object."] + #[cfg(feature = "GpuAdapterFeatures")] + # [wasm_bindgen (structural , method , getter , js_class = "GPUAdapter" , js_name = features)] + #[doc = "Getter for the `features` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/extensions)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/features)"] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuAdapter`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuAdapter`, `GpuAdapterFeatures`*"] #[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 extensions(this: &GpuAdapter) -> ::js_sys::Array; + pub fn features(this: &GpuAdapter) -> GpuAdapterFeatures; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUAdapter" , js_name = requestDevice)] #[doc = "The `requestDevice()` method."] diff --git a/crates/web-sys/src/features/gen_GpuAdapterFeatures.rs b/crates/web-sys/src/features/gen_GpuAdapterFeatures.rs new file mode 100644 index 00000000000..b5b74184f1c --- /dev/null +++ b/crates/web-sys/src/features/gen_GpuAdapterFeatures.rs @@ -0,0 +1,18 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUAdapterFeatures , typescript_type = "GPUAdapterFeatures")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `GpuAdapterFeatures` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapterFeatures)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuAdapterFeatures`*"] + #[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 GpuAdapterFeatures; +} diff --git a/crates/web-sys/src/features/gen_GpuBindGroupLayoutEntry.rs b/crates/web-sys/src/features/gen_GpuBindGroupLayoutEntry.rs index 4a17220c803..da0d529966a 100644 --- a/crates/web-sys/src/features/gen_GpuBindGroupLayoutEntry.rs +++ b/crates/web-sys/src/features/gen_GpuBindGroupLayoutEntry.rs @@ -95,27 +95,6 @@ impl GpuBindGroupLayoutEntry { self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `multisampled` field of this object."] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBindGroupLayoutEntry`*"] - #[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 multisampled(&mut self, val: bool) -> &mut Self { - use wasm_bindgen::JsValue; - let r = ::js_sys::Reflect::set( - self.as_ref(), - &JsValue::from("multisampled"), - &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 = "GpuTextureFormat")] #[doc = "Change the `storageTextureFormat` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuBindingType.rs b/crates/web-sys/src/features/gen_GpuBindingType.rs index 72bcd3ac1f7..93b0b7f4ac5 100644 --- a/crates/web-sys/src/features/gen_GpuBindingType.rs +++ b/crates/web-sys/src/features/gen_GpuBindingType.rs @@ -16,6 +16,7 @@ pub enum GpuBindingType { Sampler = "sampler", ComparisonSampler = "comparison-sampler", SampledTexture = "sampled-texture", + MultisampledTexture = "multisampled-texture", ReadonlyStorageTexture = "readonly-storage-texture", WriteonlyStorageTexture = "writeonly-storage-texture", } diff --git a/crates/web-sys/src/features/gen_GpuBuffer.rs b/crates/web-sys/src/features/gen_GpuBuffer.rs index 122eaedc909..046b43ff04f 100644 --- a/crates/web-sys/src/features/gen_GpuBuffer.rs +++ b/crates/web-sys/src/features/gen_GpuBuffer.rs @@ -49,27 +49,195 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn destroy(this: &GpuBuffer); #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = mapReadAsync)] - #[doc = "The `mapReadAsync()` method."] + # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] + #[doc = "The `getMappedRange()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapReadAsync)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"] #[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 map_read_async(this: &GpuBuffer) -> ::js_sys::Promise; + pub fn get_mapped_range(this: &GpuBuffer) -> ::js_sys::ArrayBuffer; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = mapWriteAsync)] - #[doc = "The `mapWriteAsync()` method."] + # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] + #[doc = "The `getMappedRange()` method."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapWriteAsync)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"] #[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 map_write_async(this: &GpuBuffer) -> ::js_sys::Promise; + pub fn get_mapped_range_with_u32(this: &GpuBuffer, offset: u32) -> ::js_sys::ArrayBuffer; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] + #[doc = "The `getMappedRange()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"] + #[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 get_mapped_range_with_f64(this: &GpuBuffer, offset: f64) -> ::js_sys::ArrayBuffer; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] + #[doc = "The `getMappedRange()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"] + #[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 get_mapped_range_with_u32_and_u32( + this: &GpuBuffer, + offset: u32, + size: u32, + ) -> ::js_sys::ArrayBuffer; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] + #[doc = "The `getMappedRange()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"] + #[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 get_mapped_range_with_f64_and_u32( + this: &GpuBuffer, + offset: f64, + size: u32, + ) -> ::js_sys::ArrayBuffer; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] + #[doc = "The `getMappedRange()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"] + #[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 get_mapped_range_with_u32_and_f64( + this: &GpuBuffer, + offset: u32, + size: f64, + ) -> ::js_sys::ArrayBuffer; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = getMappedRange)] + #[doc = "The `getMappedRange()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/getMappedRange)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"] + #[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 get_mapped_range_with_f64_and_f64( + this: &GpuBuffer, + offset: f64, + size: f64, + ) -> ::js_sys::ArrayBuffer; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = mapAsync)] + #[doc = "The `mapAsync()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapAsync)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"] + #[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 map_async(this: &GpuBuffer, mode: u32) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = mapAsync)] + #[doc = "The `mapAsync()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapAsync)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"] + #[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 map_async_with_u32(this: &GpuBuffer, mode: u32, offset: u32) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = mapAsync)] + #[doc = "The `mapAsync()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapAsync)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"] + #[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 map_async_with_f64(this: &GpuBuffer, mode: u32, offset: f64) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = mapAsync)] + #[doc = "The `mapAsync()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapAsync)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"] + #[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 map_async_with_u32_and_u32( + this: &GpuBuffer, + mode: u32, + offset: u32, + size: u32, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = mapAsync)] + #[doc = "The `mapAsync()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapAsync)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"] + #[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 map_async_with_f64_and_u32( + this: &GpuBuffer, + mode: u32, + offset: f64, + size: u32, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = mapAsync)] + #[doc = "The `mapAsync()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapAsync)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"] + #[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 map_async_with_u32_and_f64( + this: &GpuBuffer, + mode: u32, + offset: u32, + size: f64, + ) -> ::js_sys::Promise; + #[cfg(web_sys_unstable_apis)] + # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = mapAsync)] + #[doc = "The `mapAsync()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUBuffer/mapAsync)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`*"] + #[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 map_async_with_f64_and_f64( + this: &GpuBuffer, + mode: u32, + offset: f64, + size: f64, + ) -> ::js_sys::Promise; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = unmap)] #[doc = "The `unmap()` method."] diff --git a/crates/web-sys/src/features/gen_GpuBufferCopyView.rs b/crates/web-sys/src/features/gen_GpuBufferCopyView.rs index 6588d042ecc..d1f1afdf381 100644 --- a/crates/web-sys/src/features/gen_GpuBufferCopyView.rs +++ b/crates/web-sys/src/features/gen_GpuBufferCopyView.rs @@ -23,10 +23,9 @@ impl GpuBufferCopyView { #[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(bytes_per_row: u32, buffer: &GpuBuffer) -> Self { + pub fn new(buffer: &GpuBuffer) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.bytes_per_row(bytes_per_row); ret.buffer(buffer); ret } diff --git a/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs b/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs index 1136fde5ef4..cc677ecb5e9 100644 --- a/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuBufferDescriptor.rs @@ -47,6 +47,27 @@ impl GpuBufferDescriptor { self } #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `mappedAtCreation` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBufferDescriptor`*"] + #[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 mapped_at_creation(&mut self, val: bool) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("mappedAtCreation"), + &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 `size` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuBufferDescriptor`*"] diff --git a/crates/web-sys/src/features/gen_GpuDevice.rs b/crates/web-sys/src/features/gen_GpuDevice.rs index fd832b64693..2b2ce3b4065 100644 --- a/crates/web-sys/src/features/gen_GpuDevice.rs +++ b/crates/web-sys/src/features/gen_GpuDevice.rs @@ -28,16 +28,16 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn adapter(this: &GpuDevice) -> GpuAdapter; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (structural , method , getter , js_class = "GPUDevice" , js_name = extensions)] - #[doc = "Getter for the `extensions` field of this object."] + # [wasm_bindgen (structural , method , getter , js_class = "GPUDevice" , js_name = features)] + #[doc = "Getter for the `features` field of this object."] #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/extensions)"] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/features)"] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuDevice`*"] #[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 extensions(this: &GpuDevice) -> ::js_sys::Array; + pub fn features(this: &GpuDevice) -> ::js_sys::Array; #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (structural , method , getter , js_class = "GPUDevice" , js_name = limits)] #[doc = "Getter for the `limits` field of this object."] @@ -160,21 +160,6 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn create_buffer(this: &GpuDevice, descriptor: &GpuBufferDescriptor) -> GpuBuffer; #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "GpuBufferDescriptor")] - # [wasm_bindgen (method , structural , js_class = "GPUDevice" , js_name = createBufferMapped)] - #[doc = "The `createBufferMapped()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUDevice/createBufferMapped)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuBufferDescriptor`, `GpuDevice`*"] - #[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 create_buffer_mapped( - this: &GpuDevice, - descriptor: &GpuBufferDescriptor, - ) -> ::js_sys::Array; - #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuCommandEncoder")] # [wasm_bindgen (method , structural , js_class = "GPUDevice" , js_name = createCommandEncoder)] #[doc = "The `createCommandEncoder()` method."] diff --git a/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs b/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs index e77a90a6fe5..d4535cfb179 100644 --- a/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuDeviceDescriptor.rs @@ -45,17 +45,17 @@ impl GpuDeviceDescriptor { self } #[cfg(web_sys_unstable_apis)] - #[doc = "Change the `extensions` field of this object."] + #[doc = "Change the `features` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuDeviceDescriptor`*"] #[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 extensions(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + pub fn features(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { use wasm_bindgen::JsValue; let r = ::js_sys::Reflect::set( self.as_ref(), - &JsValue::from("extensions"), + &JsValue::from("features"), &JsValue::from(val), ); debug_assert!( diff --git a/crates/web-sys/src/features/gen_GpuExtent3dDict.rs b/crates/web-sys/src/features/gen_GpuExtent3dDict.rs index 8d0130a1eb0..773a4128139 100644 --- a/crates/web-sys/src/features/gen_GpuExtent3dDict.rs +++ b/crates/web-sys/src/features/gen_GpuExtent3dDict.rs @@ -22,12 +22,9 @@ impl GpuExtent3dDict { #[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: u32, height: u32, width: u32) -> Self { + pub fn new() -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.depth(depth); - ret.height(height); - ret.width(width); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuExtensionName.rs b/crates/web-sys/src/features/gen_GpuFeatureName.rs similarity index 76% rename from crates/web-sys/src/features/gen_GpuExtensionName.rs rename to crates/web-sys/src/features/gen_GpuFeatureName.rs index ea64260b80d..5ebc2785a6a 100644 --- a/crates/web-sys/src/features/gen_GpuExtensionName.rs +++ b/crates/web-sys/src/features/gen_GpuFeatureName.rs @@ -2,16 +2,18 @@ use wasm_bindgen::prelude::*; #[cfg(web_sys_unstable_apis)] #[wasm_bindgen] -#[doc = "The `GpuExtensionName` enum."] +#[doc = "The `GpuFeatureName` enum."] #[doc = ""] -#[doc = "*This API requires the following crate features to be activated: `GpuExtensionName`*"] +#[doc = "*This API requires the following crate features to be activated: `GpuFeatureName`*"] #[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)*"] #[derive(Debug, Clone, Copy, PartialEq, Eq)] -pub enum GpuExtensionName { - TextureCompressionBc = "texture-compression-bc", +pub enum GpuFeatureName { + DepthClamping = "depth-clamping", + Depth24unormStencil8 = "depth24unorm-stencil8", + Depth32floatStencil8 = "depth32float-stencil8", PipelineStatisticsQuery = "pipeline-statistics-query", + TextureCompressionBc = "texture-compression-bc", TimestampQuery = "timestamp-query", - DepthClamping = "depth-clamping", } diff --git a/crates/web-sys/src/features/gen_GpuLimits.rs b/crates/web-sys/src/features/gen_GpuLimits.rs index 5b993138fea..3327489a4f4 100644 --- a/crates/web-sys/src/features/gen_GpuLimits.rs +++ b/crates/web-sys/src/features/gen_GpuLimits.rs @@ -133,6 +133,27 @@ impl GpuLimits { self } #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `maxStorageBufferBindingSize` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuLimits`*"] + #[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 max_storage_buffer_binding_size(&mut self, val: u32) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("maxStorageBufferBindingSize"), + &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 `maxStorageBuffersPerShaderStage` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuLimits`*"] diff --git a/crates/web-sys/src/features/gen_GpuMapMode.rs b/crates/web-sys/src/features/gen_GpuMapMode.rs new file mode 100644 index 00000000000..7da1a45475b --- /dev/null +++ b/crates/web-sys/src/features/gen_GpuMapMode.rs @@ -0,0 +1,37 @@ +#![allow(unused_imports)] +use super::*; +use wasm_bindgen::prelude::*; +#[cfg(web_sys_unstable_apis)] +#[wasm_bindgen] +extern "C" { + # [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUMapMode , typescript_type = "GPUMapMode")] + #[derive(Debug, Clone, PartialEq, Eq)] + #[doc = "The `GpuMapMode` class."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUMapMode)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuMapMode`*"] + #[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 GpuMapMode; +} +#[cfg(web_sys_unstable_apis)] +impl GpuMapMode { + #[cfg(web_sys_unstable_apis)] + #[doc = "The `GPUMapMode.READ` const."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuMapMode`*"] + #[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 const READ: u32 = 1u64 as u32; + #[cfg(web_sys_unstable_apis)] + #[doc = "The `GPUMapMode.WRITE` const."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuMapMode`*"] + #[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 const WRITE: u32 = 2u64 as u32; +} diff --git a/crates/web-sys/src/features/gen_GpuQueue.rs b/crates/web-sys/src/features/gen_GpuQueue.rs index f5ab89b7f59..def12b22fcc 100644 --- a/crates/web-sys/src/features/gen_GpuQueue.rs +++ b/crates/web-sys/src/features/gen_GpuQueue.rs @@ -148,11 +148,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 write_buffer_with_u32( + pub fn write_buffer_with_u32_and_buffer_source( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: u32, - data: &::js_sys::ArrayBuffer, + data: &::js_sys::Object, ); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] @@ -165,11 +165,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 write_buffer_with_f64( + pub fn write_buffer_with_f64_and_buffer_source( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: f64, - data: &::js_sys::ArrayBuffer, + data: &::js_sys::Object, ); #[cfg(web_sys_unstable_apis)] #[cfg(feature = "GpuBuffer")] @@ -182,11 +182,45 @@ 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 write_buffer_with_u32_and_u32( + pub fn write_buffer_with_u32_and_u8_array( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: u32, - data: &::js_sys::ArrayBuffer, + data: &[u8], + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[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_buffer_with_f64_and_u8_array( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: f64, + data: &[u8], + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[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_buffer_with_u32_and_buffer_source_and_u32( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: u32, + data: &::js_sys::Object, data_offset: u32, ); #[cfg(web_sys_unstable_apis)] @@ -200,11 +234,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 write_buffer_with_f64_and_u32( + pub fn write_buffer_with_f64_and_buffer_source_and_u32( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: f64, - data: &::js_sys::ArrayBuffer, + data: &::js_sys::Object, data_offset: u32, ); #[cfg(web_sys_unstable_apis)] @@ -218,11 +252,47 @@ 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 write_buffer_with_u32_and_f64( + pub fn write_buffer_with_u32_and_u8_array_and_u32( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: u32, - data: &::js_sys::ArrayBuffer, + data: &[u8], + data_offset: u32, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[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_buffer_with_f64_and_u8_array_and_u32( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: f64, + data: &[u8], + data_offset: u32, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[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_buffer_with_u32_and_buffer_source_and_f64( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: u32, + data: &::js_sys::Object, data_offset: f64, ); #[cfg(web_sys_unstable_apis)] @@ -236,11 +306,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 write_buffer_with_f64_and_f64( + pub fn write_buffer_with_f64_and_buffer_source_and_f64( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: f64, - data: &::js_sys::ArrayBuffer, + data: &::js_sys::Object, data_offset: f64, ); #[cfg(web_sys_unstable_apis)] @@ -254,11 +324,66 @@ 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 write_buffer_with_u32_and_u32_and_u32( + pub fn write_buffer_with_u32_and_u8_array_and_f64( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: u32, - data: &::js_sys::ArrayBuffer, + data: &[u8], + data_offset: f64, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[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_buffer_with_f64_and_u8_array_and_f64( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: f64, + data: &[u8], + data_offset: f64, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[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_buffer_with_u32_and_buffer_source_and_u32_and_u32( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: u32, + data: &::js_sys::Object, + data_offset: u32, + size: u32, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[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_buffer_with_f64_and_buffer_source_and_u32_and_u32( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: f64, + data: &::js_sys::Object, data_offset: u32, size: u32, ); @@ -273,11 +398,30 @@ 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 write_buffer_with_f64_and_u32_and_u32( + pub fn write_buffer_with_u32_and_u8_array_and_u32_and_u32( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: u32, + data: &[u8], + data_offset: u32, + size: u32, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[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_buffer_with_f64_and_u8_array_and_u32_and_u32( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: f64, - data: &::js_sys::ArrayBuffer, + data: &[u8], data_offset: u32, size: u32, ); @@ -292,11 +436,49 @@ 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 write_buffer_with_u32_and_f64_and_u32( + pub fn write_buffer_with_u32_and_buffer_source_and_f64_and_u32( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: u32, + data: &::js_sys::Object, + data_offset: f64, + size: u32, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[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_buffer_with_f64_and_buffer_source_and_f64_and_u32( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: f64, + data: &::js_sys::Object, + data_offset: f64, + size: u32, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[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_buffer_with_u32_and_u8_array_and_f64_and_u32( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: u32, - data: &::js_sys::ArrayBuffer, + data: &[u8], data_offset: f64, size: u32, ); @@ -311,11 +493,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 write_buffer_with_f64_and_f64_and_u32( + pub fn write_buffer_with_f64_and_u8_array_and_f64_and_u32( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: f64, - data: &::js_sys::ArrayBuffer, + data: &[u8], data_offset: f64, size: u32, ); @@ -330,11 +512,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 write_buffer_with_u32_and_u32_and_f64( + pub fn write_buffer_with_u32_and_buffer_source_and_u32_and_f64( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: u32, - data: &::js_sys::ArrayBuffer, + data: &::js_sys::Object, data_offset: u32, size: f64, ); @@ -349,11 +531,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 write_buffer_with_f64_and_u32_and_f64( + pub fn write_buffer_with_f64_and_buffer_source_and_u32_and_f64( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: f64, - data: &::js_sys::ArrayBuffer, + data: &::js_sys::Object, data_offset: u32, size: f64, ); @@ -368,11 +550,49 @@ 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 write_buffer_with_u32_and_f64_and_f64( + pub fn write_buffer_with_u32_and_u8_array_and_u32_and_f64( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: u32, - data: &::js_sys::ArrayBuffer, + data: &[u8], + data_offset: u32, + size: f64, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[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_buffer_with_f64_and_u8_array_and_u32_and_f64( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: f64, + data: &[u8], + data_offset: u32, + size: f64, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[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_buffer_with_u32_and_buffer_source_and_f64_and_f64( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: u32, + data: &::js_sys::Object, data_offset: f64, size: f64, ); @@ -387,15 +607,71 @@ 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 write_buffer_with_f64_and_f64_and_f64( + pub fn write_buffer_with_f64_and_buffer_source_and_f64_and_f64( this: &GpuQueue, buffer: &GpuBuffer, buffer_offset: f64, - data: &::js_sys::ArrayBuffer, + data: &::js_sys::Object, data_offset: f64, size: f64, ); #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[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_buffer_with_u32_and_u8_array_and_f64_and_f64( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: u32, + data: &[u8], + data_offset: f64, + size: f64, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuBuffer")] + # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeBuffer)] + #[doc = "The `writeBuffer()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeBuffer)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuBuffer`, `GpuQueue`*"] + #[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_buffer_with_f64_and_u8_array_and_f64_and_f64( + this: &GpuQueue, + buffer: &GpuBuffer, + buffer_offset: f64, + data: &[u8], + data_offset: f64, + size: f64, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(all(feature = "GpuTextureCopyView", feature = "GpuTextureDataLayout",))] + # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeTexture)] + #[doc = "The `writeTexture()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeTexture)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuQueue`, `GpuTextureCopyView`, `GpuTextureDataLayout`*"] + #[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_texture_with_buffer_source_and_u32_sequence( + this: &GpuQueue, + destination: &GpuTextureCopyView, + data: &::js_sys::Object, + data_layout: &GpuTextureDataLayout, + size: &::wasm_bindgen::JsValue, + ); + #[cfg(web_sys_unstable_apis)] #[cfg(all(feature = "GpuTextureCopyView", feature = "GpuTextureDataLayout",))] # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeTexture)] #[doc = "The `writeTexture()` method."] @@ -406,10 +682,10 @@ 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 write_texture_with_u32_sequence( + pub fn write_texture_with_u8_array_and_u32_sequence( this: &GpuQueue, destination: &GpuTextureCopyView, - data: &::js_sys::ArrayBuffer, + data: &[u8], data_layout: &GpuTextureDataLayout, size: &::wasm_bindgen::JsValue, ); @@ -428,10 +704,32 @@ 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 write_texture_with_gpu_extent_3d_dict( + pub fn write_texture_with_buffer_source_and_gpu_extent_3d_dict( + this: &GpuQueue, + destination: &GpuTextureCopyView, + data: &::js_sys::Object, + data_layout: &GpuTextureDataLayout, + size: &GpuExtent3dDict, + ); + #[cfg(web_sys_unstable_apis)] + #[cfg(all( + feature = "GpuExtent3dDict", + feature = "GpuTextureCopyView", + feature = "GpuTextureDataLayout", + ))] + # [wasm_bindgen (method , structural , js_class = "GPUQueue" , js_name = writeTexture)] + #[doc = "The `writeTexture()` method."] + #[doc = ""] + #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUQueue/writeTexture)"] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuExtent3dDict`, `GpuQueue`, `GpuTextureCopyView`, `GpuTextureDataLayout`*"] + #[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_texture_with_u8_array_and_gpu_extent_3d_dict( this: &GpuQueue, destination: &GpuTextureCopyView, - data: &::js_sys::ArrayBuffer, + data: &[u8], data_layout: &GpuTextureDataLayout, size: &GpuExtent3dDict, ); diff --git a/crates/web-sys/src/features/gen_GpuTextureComponentType.rs b/crates/web-sys/src/features/gen_GpuTextureComponentType.rs index 9e354045fcf..1f3f3841322 100644 --- a/crates/web-sys/src/features/gen_GpuTextureComponentType.rs +++ b/crates/web-sys/src/features/gen_GpuTextureComponentType.rs @@ -13,4 +13,5 @@ pub enum GpuTextureComponentType { Float = "float", Sint = "sint", Uint = "uint", + DepthComparison = "depth-comparison", } diff --git a/crates/web-sys/src/features/gen_GpuTextureCopyView.rs b/crates/web-sys/src/features/gen_GpuTextureCopyView.rs index b9b928e6c51..362de62595a 100644 --- a/crates/web-sys/src/features/gen_GpuTextureCopyView.rs +++ b/crates/web-sys/src/features/gen_GpuTextureCopyView.rs @@ -30,6 +30,25 @@ impl GpuTextureCopyView { ret } #[cfg(web_sys_unstable_apis)] + #[cfg(feature = "GpuTextureAspect")] + #[doc = "Change the `aspect` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuTextureAspect`, `GpuTextureCopyView`*"] + #[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 aspect(&mut self, val: GpuTextureAspect) -> &mut Self { + use wasm_bindgen::JsValue; + let r = + ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("aspect"), &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 `mipLevel` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuTextureCopyView`*"] diff --git a/crates/web-sys/src/features/gen_GpuTextureDataLayout.rs b/crates/web-sys/src/features/gen_GpuTextureDataLayout.rs index aa73e2e03a0..fb4f2cfc3ad 100644 --- a/crates/web-sys/src/features/gen_GpuTextureDataLayout.rs +++ b/crates/web-sys/src/features/gen_GpuTextureDataLayout.rs @@ -22,10 +22,9 @@ impl GpuTextureDataLayout { #[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(bytes_per_row: u32) -> Self { + pub fn new() -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.bytes_per_row(bytes_per_row); ret } #[cfg(web_sys_unstable_apis)] diff --git a/crates/web-sys/src/features/gen_GpuTextureFormat.rs b/crates/web-sys/src/features/gen_GpuTextureFormat.rs index 8c6b4d0608a..4f4417971bc 100644 --- a/crates/web-sys/src/features/gen_GpuTextureFormat.rs +++ b/crates/web-sys/src/features/gen_GpuTextureFormat.rs @@ -34,8 +34,9 @@ pub enum GpuTextureFormat { Rgba8sint = "rgba8sint", Bgra8unorm = "bgra8unorm", Bgra8unormSrgb = "bgra8unorm-srgb", + Rgb9e5ufloat = "rgb9e5ufloat", Rgb10a2unorm = "rgb10a2unorm", - Rg11b10float = "rg11b10float", + Rg11b10ufloat = "rg11b10ufloat", Rg32uint = "rg32uint", Rg32sint = "rg32sint", Rg32float = "rg32float", @@ -45,9 +46,11 @@ pub enum GpuTextureFormat { Rgba32uint = "rgba32uint", Rgba32sint = "rgba32sint", Rgba32float = "rgba32float", - Depth32float = "depth32float", + Stencil8 = "stencil8", + Depth16unorm = "depth16unorm", Depth24plus = "depth24plus", Depth24plusStencil8 = "depth24plus-stencil8", + Depth32float = "depth32float", Bc1RgbaUnorm = "bc1-rgba-unorm", Bc1RgbaUnormSrgb = "bc1-rgba-unorm-srgb", Bc2RgbaUnorm = "bc2-rgba-unorm", @@ -59,7 +62,9 @@ pub enum GpuTextureFormat { Bc5RgUnorm = "bc5-rg-unorm", Bc5RgSnorm = "bc5-rg-snorm", Bc6hRgbUfloat = "bc6h-rgb-ufloat", - Bc6hRgbSfloat = "bc6h-rgb-sfloat", + Bc6hRgbFloat = "bc6h-rgb-float", Bc7RgbaUnorm = "bc7-rgba-unorm", Bc7RgbaUnormSrgb = "bc7-rgba-unorm-srgb", + Depth24unormStencil8 = "depth24unorm-stencil8", + Depth32floatStencil8 = "depth32float-stencil8", } diff --git a/crates/web-sys/src/features/gen_GpuTextureUsage.rs b/crates/web-sys/src/features/gen_GpuTextureUsage.rs index a1ae02ade74..2c878defd9f 100644 --- a/crates/web-sys/src/features/gen_GpuTextureUsage.rs +++ b/crates/web-sys/src/features/gen_GpuTextureUsage.rs @@ -51,11 +51,11 @@ impl GpuTextureUsage { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub const STORAGE: u32 = 8u64 as u32; #[cfg(web_sys_unstable_apis)] - #[doc = "The `GPUTextureUsage.OUTPUT_ATTACHMENT` const."] + #[doc = "The `GPUTextureUsage.RENDER_ATTACHMENT` const."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuTextureUsage`*"] #[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 const OUTPUT_ATTACHMENT: u32 = 16u64 as u32; + pub const RENDER_ATTACHMENT: u32 = 16u64 as u32; } diff --git a/crates/web-sys/src/features/mod.rs b/crates/web-sys/src/features/mod.rs index 732473b0dd2..8611ff5a3d2 100644 --- a/crates/web-sys/src/features/mod.rs +++ b/crates/web-sys/src/features/mod.rs @@ -2230,6 +2230,12 @@ mod gen_GpuAdapter; #[cfg(feature = "GpuAdapter")] pub use gen_GpuAdapter::*; +#[cfg(feature = "GpuAdapterFeatures")] +#[allow(non_snake_case)] +mod gen_GpuAdapterFeatures; +#[cfg(feature = "GpuAdapterFeatures")] +pub use gen_GpuAdapterFeatures::*; + #[cfg(feature = "GpuAddressMode")] #[allow(non_snake_case)] mod gen_GpuAddressMode; @@ -2458,18 +2464,18 @@ mod gen_GpuErrorFilter; #[cfg(feature = "GpuErrorFilter")] pub use gen_GpuErrorFilter::*; -#[cfg(feature = "GpuExtensionName")] -#[allow(non_snake_case)] -mod gen_GpuExtensionName; -#[cfg(feature = "GpuExtensionName")] -pub use gen_GpuExtensionName::*; - #[cfg(feature = "GpuExtent3dDict")] #[allow(non_snake_case)] mod gen_GpuExtent3dDict; #[cfg(feature = "GpuExtent3dDict")] pub use gen_GpuExtent3dDict::*; +#[cfg(feature = "GpuFeatureName")] +#[allow(non_snake_case)] +mod gen_GpuFeatureName; +#[cfg(feature = "GpuFeatureName")] +pub use gen_GpuFeatureName::*; + #[cfg(feature = "GpuFence")] #[allow(non_snake_case)] mod gen_GpuFence; @@ -2524,6 +2530,12 @@ mod gen_GpuLoadOp; #[cfg(feature = "GpuLoadOp")] pub use gen_GpuLoadOp::*; +#[cfg(feature = "GpuMapMode")] +#[allow(non_snake_case)] +mod gen_GpuMapMode; +#[cfg(feature = "GpuMapMode")] +pub use gen_GpuMapMode::*; + #[cfg(feature = "GpuObjectDescriptorBase")] #[allow(non_snake_case)] mod gen_GpuObjectDescriptorBase; diff --git a/crates/web-sys/webidls/unstable/WebGPU.webidl b/crates/web-sys/webidls/unstable/WebGPU.webidl index 65aad7925fa..004365fc99f 100644 --- a/crates/web-sys/webidls/unstable/WebGPU.webidl +++ b/crates/web-sys/webidls/unstable/WebGPU.webidl @@ -6,6 +6,23 @@ dictionary GPUObjectDescriptorBase { USVString label; }; +dictionary GPULimits { + GPUSize32 maxBindGroups = 4; + GPUSize32 maxDynamicUniformBuffersPerPipelineLayout = 8; + GPUSize32 maxDynamicStorageBuffersPerPipelineLayout = 4; + GPUSize32 maxSampledTexturesPerShaderStage = 16; + GPUSize32 maxSamplersPerShaderStage = 16; + GPUSize32 maxStorageBuffersPerShaderStage = 4; + GPUSize32 maxStorageTexturesPerShaderStage = 4; + GPUSize32 maxUniformBuffersPerShaderStage = 12; + GPUSize32 maxUniformBufferBindingSize = 16384; + GPUSize32 maxStorageBufferBindingSize = 134217728; +}; + +interface GPUAdapterFeatures { + readonly setlike; +}; + [Exposed=Window] partial interface Navigator { [SameObject] readonly attribute GPU gpu; @@ -32,46 +49,35 @@ enum GPUPowerPreference { interface GPUAdapter { readonly attribute DOMString name; - readonly attribute FrozenArray extensions; + [SameObject] readonly attribute GPUAdapterFeatures features; //readonly attribute GPULimits limits; Don’t expose higher limits for now. Promise requestDevice(optional GPUDeviceDescriptor descriptor = {}); }; dictionary GPUDeviceDescriptor : GPUObjectDescriptorBase { - sequence extensions = []; + sequence features = []; GPULimits limits = {}; }; -enum GPUExtensionName { - "texture-compression-bc", +enum GPUFeatureName { + "depth-clamping", + "depth24unorm-stencil8", + "depth32float-stencil8", "pipeline-statistics-query", + "texture-compression-bc", "timestamp-query", - "depth-clamping" -}; - -dictionary GPULimits { - GPUSize32 maxBindGroups = 4; - GPUSize32 maxDynamicUniformBuffersPerPipelineLayout = 8; - GPUSize32 maxDynamicStorageBuffersPerPipelineLayout = 4; - GPUSize32 maxSampledTexturesPerShaderStage = 16; - GPUSize32 maxSamplersPerShaderStage = 16; - GPUSize32 maxStorageBuffersPerShaderStage = 4; - GPUSize32 maxStorageTexturesPerShaderStage = 4; - GPUSize32 maxUniformBuffersPerShaderStage = 12; - GPUSize32 maxUniformBufferBindingSize = 16384; }; [Exposed=(Window, DedicatedWorker), Serializable] interface GPUDevice : EventTarget { [SameObject] readonly attribute GPUAdapter adapter; - readonly attribute FrozenArray extensions; + readonly attribute FrozenArray features; readonly attribute object limits; [SameObject] readonly attribute GPUQueue defaultQueue; GPUBuffer createBuffer(GPUBufferDescriptor descriptor); - GPUMappedBuffer createBufferMapped(GPUBufferDescriptor descriptor); GPUTexture createTexture(GPUTextureDescriptor descriptor); GPUSampler createSampler(optional GPUSamplerDescriptor descriptor = {}); @@ -94,8 +100,8 @@ GPUDevice includes GPUObjectBase; [Serializable] interface GPUBuffer { - Promise mapReadAsync(); - Promise mapWriteAsync(); + Promise mapAsync(GPUMapModeFlags mode, optional GPUSize64 offset = 0, optional GPUSize64 size); + ArrayBuffer getMappedRange(optional GPUSize64 offset = 0, optional GPUSize64 size); void unmap(); void destroy(); @@ -105,20 +111,27 @@ GPUBuffer includes GPUObjectBase; dictionary GPUBufferDescriptor : GPUObjectDescriptorBase { required GPUSize64 size; required GPUBufferUsageFlags usage; + boolean mappedAtCreation = false; }; typedef [EnforceRange] unsigned long GPUBufferUsageFlags; interface GPUBufferUsage { - const GPUBufferUsageFlags MAP_READ = 0x0001; - const GPUBufferUsageFlags MAP_WRITE = 0x0002; - const GPUBufferUsageFlags COPY_SRC = 0x0004; - const GPUBufferUsageFlags COPY_DST = 0x0008; - const GPUBufferUsageFlags INDEX = 0x0010; - const GPUBufferUsageFlags VERTEX = 0x0020; - const GPUBufferUsageFlags UNIFORM = 0x0040; - const GPUBufferUsageFlags STORAGE = 0x0080; - const GPUBufferUsageFlags INDIRECT = 0x0100; - const GPUBufferUsageFlags QUERY_RESOLVE = 0x0200; + const GPUFlagsConstant MAP_READ = 0x0001; + const GPUFlagsConstant MAP_WRITE = 0x0002; + const GPUFlagsConstant COPY_SRC = 0x0004; + const GPUFlagsConstant COPY_DST = 0x0008; + const GPUFlagsConstant INDEX = 0x0010; + const GPUFlagsConstant VERTEX = 0x0020; + const GPUFlagsConstant UNIFORM = 0x0040; + const GPUFlagsConstant STORAGE = 0x0080; + const GPUFlagsConstant INDIRECT = 0x0100; + const GPUFlagsConstant QUERY_RESOLVE = 0x0200; +}; + +typedef [EnforceRange] unsigned long GPUMapModeFlags; +interface GPUMapMode { + const GPUFlagsConstant READ = 0x0001; + const GPUFlagsConstant WRITE = 0x0002; }; [Serializable] @@ -146,11 +159,11 @@ enum GPUTextureDimension { typedef [EnforceRange] unsigned long GPUTextureUsageFlags; interface GPUTextureUsage { - const GPUTextureUsageFlags COPY_SRC = 0x01; - const GPUTextureUsageFlags COPY_DST = 0x02; - const GPUTextureUsageFlags SAMPLED = 0x04; - const GPUTextureUsageFlags STORAGE = 0x08; - const GPUTextureUsageFlags OUTPUT_ATTACHMENT = 0x10; + const GPUFlagsConstant COPY_SRC = 0x01; + const GPUFlagsConstant COPY_DST = 0x02; + const GPUFlagsConstant SAMPLED = 0x04; + const GPUFlagsConstant STORAGE = 0x08; + const GPUFlagsConstant RENDER_ATTACHMENT = 0x10; }; interface GPUTextureView { @@ -213,8 +226,9 @@ enum GPUTextureFormat { "bgra8unorm", "bgra8unorm-srgb", // Packed 32-bit formats + "rgb9e5ufloat", "rgb10a2unorm", - "rg11b10float", + "rg11b10ufloat", // 64-bit formats "rg32uint", @@ -230,9 +244,11 @@ enum GPUTextureFormat { "rgba32float", // Depth and stencil formats - "depth32float", + "stencil8", + "depth16unorm", "depth24plus", "depth24plus-stencil8", + "depth32float", // BC compressed formats usable if "texture-compression-bc" is both // supported by the device/user agent and enabled in requestDevice. @@ -247,15 +263,23 @@ enum GPUTextureFormat { "bc5-rg-unorm", "bc5-rg-snorm", "bc6h-rgb-ufloat", - "bc6h-rgb-sfloat", + "bc6h-rgb-float", "bc7-rgba-unorm", - "bc7-rgba-unorm-srgb" + "bc7-rgba-unorm-srgb", + + // "depth24unorm-stencil8" feature + "depth24unorm-stencil8", + + // "depth32float-stencil8" feature + "depth32float-stencil8", }; enum GPUTextureComponentType { "float", "sint", - "uint" + "uint", + // Texture is used with comparison sampling only. + "depth-comparison" }; interface GPUSampler { @@ -322,7 +346,6 @@ dictionary GPUBindGroupLayoutEntry { // Used for sampled texture bindings. Must be undefined for other binding types. GPUTextureComponentType textureComponentType; - boolean multisampled; // Used for storage texture bindings. Must be undefined for other binding types. GPUTextureFormat storageTextureFormat; @@ -330,9 +353,9 @@ dictionary GPUBindGroupLayoutEntry { typedef [EnforceRange] unsigned long GPUShaderStageFlags; interface GPUShaderStage { - const GPUShaderStageFlags VERTEX = 0x1; - const GPUShaderStageFlags FRAGMENT = 0x2; - const GPUShaderStageFlags COMPUTE = 0x4; + const GPUFlagsConstant VERTEX = 0x1; + const GPUFlagsConstant FRAGMENT = 0x2; + const GPUFlagsConstant COMPUTE = 0x4; }; enum GPUBindingType { @@ -342,6 +365,7 @@ enum GPUBindingType { "sampler", "comparison-sampler", "sampled-texture", + "multisampled-texture", "readonly-storage-texture", "writeonly-storage-texture" }; @@ -465,7 +489,7 @@ enum GPUPrimitiveTopology { dictionary GPURasterizationStateDescriptor { GPUFrontFace frontFace = "ccw"; GPUCullMode cullMode = "none"; - // Enable depth clamping (requires "depth-clamping" extension) + // Enable depth clamping (requires "depth-clamping" feature) boolean clampDepth = false; GPUDepthBias depthBias = 0; @@ -494,11 +518,11 @@ dictionary GPUColorStateDescriptor { typedef [EnforceRange] unsigned long GPUColorWriteFlags; interface GPUColorWrite { - const GPUColorWriteFlags RED = 0x1; - const GPUColorWriteFlags GREEN = 0x2; - const GPUColorWriteFlags BLUE = 0x4; - const GPUColorWriteFlags ALPHA = 0x8; - const GPUColorWriteFlags ALL = 0xF; + const GPUFlagsConstant RED = 0x1; + const GPUFlagsConstant GREEN = 0x2; + const GPUFlagsConstant BLUE = 0x4; + const GPUFlagsConstant ALPHA = 0x8; + const GPUFlagsConstant ALL = 0xF; }; dictionary GPUBlendDescriptor { @@ -606,7 +630,7 @@ enum GPUInputStepMode { }; dictionary GPUVertexStateDescriptor { - GPUIndexFormat indexFormat = "uint32"; + GPUIndexFormat indexFormat; sequence vertexBuffers = []; }; @@ -682,8 +706,8 @@ dictionary GPUCommandEncoderDescriptor : GPUObjectDescriptorBase { dictionary GPUTextureDataLayout { GPUSize64 offset = 0; - required GPUSize32 bytesPerRow; - GPUSize32 rowsPerImage = 0; + GPUSize32 bytesPerRow; + GPUSize32 rowsPerImage; }; dictionary GPUBufferCopyView : GPUTextureDataLayout { @@ -694,6 +718,7 @@ dictionary GPUTextureCopyView { required GPUTexture texture; GPUIntegerCoordinate mipLevel = 0; GPUOrigin3D origin = {}; + GPUTextureAspect aspect = "all"; }; dictionary GPUImageBitmapCopyView { @@ -840,13 +865,13 @@ interface GPUQueue { void writeBuffer( GPUBuffer buffer, GPUSize64 bufferOffset, - [AllowShared] ArrayBuffer data, + [AllowShared] BufferSource data, optional GPUSize64 dataOffset = 0, optional GPUSize64 size); void writeTexture( GPUTextureCopyView destination, - [AllowShared] ArrayBuffer data, + [AllowShared] BufferSource data, GPUTextureDataLayout dataLayout, GPUExtent3D size); @@ -901,7 +926,7 @@ interface GPUCanvasContext { dictionary GPUSwapChainDescriptor : GPUObjectDescriptorBase { required GPUDevice device; required GPUTextureFormat format; - GPUTextureUsageFlags usage = 0x10; // GPUTextureUsage.OUTPUT_ATTACHMENT + GPUTextureUsageFlags usage = 0x10; // GPUTextureUsage.RENDER_ATTACHMENT }; interface GPUSwapChain { @@ -970,6 +995,8 @@ typedef [EnforceRange] unsigned long GPUIndex32; typedef [EnforceRange] unsigned long GPUSize32; typedef [EnforceRange] long GPUSignedOffset32; +typedef unsigned long GPUFlagsConstant; + dictionary GPUColorDict { required double r; required double g; @@ -992,10 +1019,8 @@ dictionary GPUOrigin3DDict { typedef (sequence or GPUOrigin3DDict) GPUOrigin3D; dictionary GPUExtent3DDict { - required GPUIntegerCoordinate width; - required GPUIntegerCoordinate height; - required GPUIntegerCoordinate depth; + GPUIntegerCoordinate width = 1; + GPUIntegerCoordinate height = 1; + GPUIntegerCoordinate depth = 1; }; typedef (sequence or GPUExtent3DDict) GPUExtent3D; - -typedef sequence<(GPUBuffer or ArrayBuffer)> GPUMappedBuffer; diff --git a/crates/webidl/src/constants.rs b/crates/webidl/src/constants.rs index d11b4ac724b..d030f20cd93 100644 --- a/crates/webidl/src/constants.rs +++ b/crates/webidl/src/constants.rs @@ -84,6 +84,8 @@ lazy_static! { "send", // WebGPU "setBindGroup", + "writeBuffer", + "writeTexture", // TODO: Add another type's functions here. Leave a comment header with the type name ]); }