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 to latest WebGPU WebIDL #2353

Merged
merged 1 commit into from
Nov 12, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions crates/web-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -402,6 +402,7 @@ GetRootNodeOptions = []
GetUserMediaRequest = []
Gpu = []
GpuAdapter = []
GpuAdapterFeatures = []
GpuAddressMode = []
GpuBindGroup = []
GpuBindGroupDescriptor = []
Expand Down Expand Up @@ -440,8 +441,8 @@ GpuDevice = ["EventTarget"]
GpuDeviceDescriptor = []
GpuDeviceLostInfo = []
GpuErrorFilter = []
GpuExtensionName = []
GpuExtent3dDict = []
GpuFeatureName = []
GpuFence = []
GpuFenceDescriptor = []
GpuFilterMode = []
Expand All @@ -451,6 +452,7 @@ GpuIndexFormat = []
GpuInputStepMode = []
GpuLimits = []
GpuLoadOp = []
GpuMapMode = []
GpuObjectDescriptorBase = []
GpuOrigin2dDict = []
GpuOrigin3dDict = []
Expand Down Expand Up @@ -632,7 +634,7 @@ IirFilterOptions = []
ImageBitmap = []
ImageBitmapFormat = []
ImageBitmapRenderingContext = []
ImageCapture = ["EventTarget"]
ImageCapture = []
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(this wasn't related to the WebGPU changes, but it was removed when I regenerated the bindings)

ImageCaptureError = []
ImageCaptureErrorEvent = ["Event"]
ImageCaptureErrorEventInit = []
Expand Down
11 changes: 6 additions & 5 deletions crates/web-sys/src/features/gen_GpuAdapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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."]
Expand Down
18 changes: 18 additions & 0 deletions crates/web-sys/src/features/gen_GpuAdapterFeatures.rs
Original file line number Diff line number Diff line change
@@ -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;
}
21 changes: 0 additions & 21 deletions crates/web-sys/src/features/gen_GpuBindGroupLayoutEntry.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""]
Expand Down
1 change: 1 addition & 0 deletions crates/web-sys/src/features/gen_GpuBindingType.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
}
184 changes: 176 additions & 8 deletions crates/web-sys/src/features/gen_GpuBuffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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."]
Expand Down
3 changes: 1 addition & 2 deletions crates/web-sys/src/features/gen_GpuBufferCopyView.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
21 changes: 21 additions & 0 deletions crates/web-sys/src/features/gen_GpuBufferDescriptor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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`*"]
Expand Down
Loading