Skip to content

Commit

Permalink
Update to latest WebGPU WebIDL (#2658)
Browse files Browse the repository at this point in the history
  • Loading branch information
grovesNL committed Aug 16, 2021
1 parent 2ccdbd9 commit 8f874c8
Show file tree
Hide file tree
Showing 13 changed files with 419 additions and 134 deletions.
7 changes: 4 additions & 3 deletions crates/web-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,8 @@ GpuBufferBindingType = []
GpuBufferDescriptor = []
GpuBufferUsage = []
GpuCanvasCompositingAlphaMode = []
GpuCanvasConfiguration = []
GpuCanvasContext = []
GpuColorDict = []
GpuColorTargetState = []
GpuColorWrite = []
Expand Down Expand Up @@ -457,7 +459,6 @@ GpuImageCopyTexture = []
GpuImageCopyTextureTagged = []
GpuImageDataLayout = []
GpuIndexFormat = []
GpuInputStepMode = []
GpuLoadOp = []
GpuMapMode = []
GpuMultisampleState = []
Expand All @@ -471,8 +472,6 @@ GpuPipelineLayoutDescriptor = []
GpuPipelineStatisticName = []
GpuPowerPreference = []
GpuPredefinedColorSpace = []
GpuPresentationConfiguration = []
GpuPresentationContext = []
GpuPrimitiveState = []
GpuPrimitiveTopology = []
GpuProgrammableStage = []
Expand All @@ -488,6 +487,7 @@ GpuRenderPassColorAttachment = []
GpuRenderPassDepthStencilAttachment = []
GpuRenderPassDescriptor = []
GpuRenderPassEncoder = []
GpuRenderPassLayout = []
GpuRenderPipeline = []
GpuRenderPipelineDescriptor = []
GpuRequestAdapterOptions = []
Expand Down Expand Up @@ -523,6 +523,7 @@ GpuVertexAttribute = []
GpuVertexBufferLayout = []
GpuVertexFormat = []
GpuVertexState = []
GpuVertexStepMode = []
GridDeclaration = []
GridTrackState = []
GroupedHistoryEventInit = []
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@ use wasm_bindgen::prelude::*;
#[cfg(web_sys_unstable_apis)]
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUPresentationConfiguration)]
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUCanvasConfiguration)]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `GpuPresentationConfiguration` dictionary."]
#[doc = "The `GpuCanvasConfiguration` dictionary."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuPresentationConfiguration`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"]
#[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 GpuPresentationConfiguration;
pub type GpuCanvasConfiguration;
}
#[cfg(web_sys_unstable_apis)]
impl GpuPresentationConfiguration {
impl GpuCanvasConfiguration {
#[cfg(all(feature = "GpuDevice", feature = "GpuTextureFormat",))]
#[doc = "Construct a new `GpuPresentationConfiguration`."]
#[doc = "Construct a new `GpuCanvasConfiguration`."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuDevice`, `GpuPresentationConfiguration`, `GpuTextureFormat`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuDevice`, `GpuTextureFormat`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
Expand All @@ -31,15 +31,20 @@ impl GpuPresentationConfiguration {
ret
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `label` field of this object."]
#[cfg(feature = "GpuPredefinedColorSpace")]
#[doc = "Change the `colorSpace` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuPresentationConfiguration`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuPredefinedColorSpace`*"]
#[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 label(&mut self, val: &str) -> &mut Self {
pub fn color_space(&mut self, val: GpuPredefinedColorSpace) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("label"), &JsValue::from(val));
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("colorSpace"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
Expand All @@ -51,7 +56,7 @@ impl GpuPresentationConfiguration {
#[cfg(feature = "GpuCanvasCompositingAlphaMode")]
#[doc = "Change the `compositingAlphaMode` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasCompositingAlphaMode`, `GpuPresentationConfiguration`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasCompositingAlphaMode`, `GpuCanvasConfiguration`*"]
#[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)*"]
Expand All @@ -73,7 +78,7 @@ impl GpuPresentationConfiguration {
#[cfg(feature = "GpuDevice")]
#[doc = "Change the `device` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuDevice`, `GpuPresentationConfiguration`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `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)*"]
Expand All @@ -92,7 +97,7 @@ impl GpuPresentationConfiguration {
#[cfg(feature = "GpuTextureFormat")]
#[doc = "Change the `format` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuPresentationConfiguration`, `GpuTextureFormat`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuTextureFormat`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
Expand All @@ -110,7 +115,7 @@ impl GpuPresentationConfiguration {
#[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: `GpuPresentationConfiguration`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"]
#[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)*"]
Expand All @@ -127,7 +132,7 @@ impl GpuPresentationConfiguration {
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `usage` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuPresentationConfiguration`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`*"]
#[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)*"]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,65 +4,73 @@ use wasm_bindgen::prelude::*;
#[cfg(web_sys_unstable_apis)]
#[wasm_bindgen]
extern "C" {
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUPresentationContext , typescript_type = "GPUPresentationContext")]
# [wasm_bindgen (extends = :: js_sys :: Object , js_name = GPUCanvasContext , typescript_type = "GPUCanvasContext")]
#[derive(Debug, Clone, PartialEq, Eq)]
#[doc = "The `GpuPresentationContext` class."]
#[doc = "The `GpuCanvasContext` class."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUPresentationContext)"]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCanvasContext)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuPresentationContext`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasContext`*"]
#[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 GpuPresentationContext;
pub type GpuCanvasContext;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuPresentationConfiguration")]
# [wasm_bindgen (method , structural , js_class = "GPUPresentationContext" , js_name = configure)]
# [wasm_bindgen (structural , method , getter , js_class = "GPUCanvasContext" , js_name = canvas)]
#[doc = "Getter for the `canvas` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCanvasContext/canvas)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasContext`*"]
#[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 canvas(this: &GpuCanvasContext) -> ::js_sys::Object;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuCanvasConfiguration")]
# [wasm_bindgen (method , structural , js_class = "GPUCanvasContext" , js_name = configure)]
#[doc = "The `configure()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUPresentationContext/configure)"]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCanvasContext/configure)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuPresentationConfiguration`, `GpuPresentationContext`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasConfiguration`, `GpuCanvasContext`*"]
#[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 configure(this: &GpuPresentationContext, configuration: &GpuPresentationConfiguration);
pub fn configure(this: &GpuCanvasContext, configuration: &GpuCanvasConfiguration);
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuTexture")]
# [wasm_bindgen (method , structural , js_class = "GPUPresentationContext" , js_name = getCurrentTexture)]
# [wasm_bindgen (method , structural , js_class = "GPUCanvasContext" , js_name = getCurrentTexture)]
#[doc = "The `getCurrentTexture()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUPresentationContext/getCurrentTexture)"]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCanvasContext/getCurrentTexture)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuPresentationContext`, `GpuTexture`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasContext`, `GpuTexture`*"]
#[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_current_texture(this: &GpuPresentationContext) -> GpuTexture;
pub fn get_current_texture(this: &GpuCanvasContext) -> GpuTexture;
#[cfg(web_sys_unstable_apis)]
#[cfg(all(feature = "GpuAdapter", feature = "GpuTextureFormat",))]
# [wasm_bindgen (method , structural , js_class = "GPUPresentationContext" , js_name = getPreferredFormat)]
# [wasm_bindgen (method , structural , js_class = "GPUCanvasContext" , js_name = getPreferredFormat)]
#[doc = "The `getPreferredFormat()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUPresentationContext/getPreferredFormat)"]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCanvasContext/getPreferredFormat)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuAdapter`, `GpuPresentationContext`, `GpuTextureFormat`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuAdapter`, `GpuCanvasContext`, `GpuTextureFormat`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn get_preferred_format(
this: &GpuPresentationContext,
adapter: &GpuAdapter,
) -> GpuTextureFormat;
pub fn get_preferred_format(this: &GpuCanvasContext, adapter: &GpuAdapter) -> GpuTextureFormat;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "GPUPresentationContext" , js_name = unconfigure)]
# [wasm_bindgen (method , structural , js_class = "GPUCanvasContext" , js_name = unconfigure)]
#[doc = "The `unconfigure()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUPresentationContext/unconfigure)"]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCanvasContext/unconfigure)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuPresentationContext`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuCanvasContext`*"]
#[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 unconfigure(this: &GpuPresentationContext);
pub fn unconfigure(this: &GpuCanvasContext);
}
Original file line number Diff line number Diff line change
Expand Up @@ -109,4 +109,46 @@ impl GpuRenderBundleEncoderDescriptor {
let _ = r;
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `depthReadOnly` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleEncoderDescriptor`*"]
#[doc = ""]
#[doc = "*This API is unstable and requires `--cfg=web_sys_unstable_apis` to be activated, as"]
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn depth_read_only(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("depthReadOnly"),
&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 `stencilReadOnly` field of this object."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuRenderBundleEncoderDescriptor`*"]
#[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 stencil_read_only(&mut self, val: bool) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("stencilReadOnly"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
);
let _ = r;
self
}
}
Loading

0 comments on commit 8f874c8

Please sign in to comment.