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 the WebGPU IDL and regenerate web-sys #2906

Merged
merged 1 commit into from
May 24, 2022
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
24 changes: 16 additions & 8 deletions crates/web-sys/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -426,6 +426,7 @@ GetUserMediaRequest = []
Gpu = []
GpuAdapter = []
GpuAddressMode = []
GpuAutoLayoutMode = []
GpuBindGroup = []
GpuBindGroupDescriptor = []
GpuBindGroupEntry = []
Expand All @@ -441,13 +442,11 @@ GpuBufferBinding = []
GpuBufferBindingLayout = []
GpuBufferBindingType = []
GpuBufferDescriptor = []
GpuBufferUsage = []
GpuCanvasCompositingAlphaMode = []
GpuCanvasConfiguration = []
GpuCanvasContext = []
GpuColorDict = []
GpuColorTargetState = []
GpuColorWrite = []
GpuCommandBuffer = []
GpuCommandBufferDescriptor = []
GpuCommandEncoder = []
Expand All @@ -458,6 +457,8 @@ GpuCompilationMessage = []
GpuCompilationMessageType = []
GpuComputePassDescriptor = []
GpuComputePassEncoder = []
GpuComputePassTimestampLocation = []
GpuComputePassTimestampWrite = []
GpuComputePipeline = []
GpuComputePipelineDescriptor = []
GpuCullMode = []
Expand All @@ -466,6 +467,7 @@ GpuDevice = ["EventTarget"]
GpuDeviceDescriptor = []
GpuDeviceLostInfo = []
GpuDeviceLostReason = []
GpuError = []
GpuErrorFilter = []
GpuExtent3dDict = []
GpuExternalTexture = []
Expand All @@ -482,16 +484,15 @@ GpuImageCopyTextureTagged = []
GpuImageDataLayout = []
GpuIndexFormat = []
GpuLoadOp = []
GpuMapMode = []
GpuMipmapFilterMode = []
GpuMultisampleState = []
GpuObjectDescriptorBase = []
GpuOrigin2dDict = []
GpuOrigin3dDict = []
GpuOutOfMemoryError = []
GpuOutOfMemoryError = ["GpuError"]
GpuPipelineDescriptorBase = []
GpuPipelineLayout = []
GpuPipelineLayoutDescriptor = []
GpuPipelineStatisticName = []
GpuPowerPreference = []
GpuPredefinedColorSpace = []
GpuPrimitiveState = []
Expand All @@ -501,6 +502,7 @@ GpuQuerySet = []
GpuQuerySetDescriptor = []
GpuQueryType = []
GpuQueue = []
GpuQueueDescriptor = []
GpuRenderBundle = []
GpuRenderBundleDescriptor = []
GpuRenderBundleEncoder = []
Expand All @@ -510,6 +512,8 @@ GpuRenderPassDepthStencilAttachment = []
GpuRenderPassDescriptor = []
GpuRenderPassEncoder = []
GpuRenderPassLayout = []
GpuRenderPassTimestampLocation = []
GpuRenderPassTimestampWrite = []
GpuRenderPipeline = []
GpuRenderPipelineDescriptor = []
GpuRequestAdapterOptions = []
Expand All @@ -518,8 +522,8 @@ GpuSamplerBindingLayout = []
GpuSamplerBindingType = []
GpuSamplerDescriptor = []
GpuShaderModule = []
GpuShaderModuleCompilationHint = []
GpuShaderModuleDescriptor = []
GpuShaderStage = []
GpuStencilFaceState = []
GpuStencilOperation = []
GpuStorageTextureAccess = []
Expand All @@ -534,13 +538,12 @@ GpuTextureDescriptor = []
GpuTextureDimension = []
GpuTextureFormat = []
GpuTextureSampleType = []
GpuTextureUsage = []
GpuTextureView = []
GpuTextureViewDescriptor = []
GpuTextureViewDimension = []
GpuUncapturedErrorEvent = ["Event"]
GpuUncapturedErrorEventInit = []
GpuValidationError = []
GpuValidationError = ["GpuError"]
GpuVertexAttribute = []
GpuVertexBufferLayout = []
GpuVertexFormat = []
Expand Down Expand Up @@ -1503,3 +1506,8 @@ XrWebGlLayerInit = []
XsltProcessor = []
console = []
css = []
gpu_buffer_usage = []
gpu_color_write = []
gpu_map_mode = []
gpu_shader_stage = []
gpu_texture_usage = []
12 changes: 12 additions & 0 deletions crates/web-sys/src/features/gen_Gpu.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,18 @@ extern "C" {
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub type Gpu;
#[cfg(web_sys_unstable_apis)]
#[cfg(feature = "GpuTextureFormat")]
# [wasm_bindgen (method , structural , js_class = "GPU" , js_name = getPreferredCanvasFormat)]
#[doc = "The `getPreferredCanvasFormat()` method."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPU/getPreferredCanvasFormat)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `Gpu`, `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_canvas_format(this: &Gpu) -> GpuTextureFormat;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "GPU" , js_name = requestAdapter)]
#[doc = "The `requestAdapter()` method."]
#[doc = ""]
Expand Down
8 changes: 4 additions & 4 deletions crates/web-sys/src/features/gen_GpuAdapter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,16 +51,16 @@ extern "C" {
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub fn limits(this: &GpuAdapter) -> GpuSupportedLimits;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (structural , method , getter , js_class = "GPUAdapter" , js_name = isSoftware)]
#[doc = "Getter for the `isSoftware` field of this object."]
# [wasm_bindgen (structural , method , getter , js_class = "GPUAdapter" , js_name = isFallbackAdapter)]
#[doc = "Getter for the `isFallbackAdapter` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/isSoftware)"]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/isFallbackAdapter)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuAdapter`*"]
#[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 is_software(this: &GpuAdapter) -> bool;
pub fn is_fallback_adapter(this: &GpuAdapter) -> bool;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "GPUAdapter" , js_name = requestDevice)]
#[doc = "The `requestDevice()` method."]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,13 @@
use wasm_bindgen::prelude::*;
#[cfg(web_sys_unstable_apis)]
#[wasm_bindgen]
#[doc = "The `GpuPipelineStatisticName` enum."]
#[doc = "The `GpuAutoLayoutMode` enum."]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuPipelineStatisticName`*"]
#[doc = "*This API requires the following crate features to be activated: `GpuAutoLayoutMode`*"]
#[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 GpuPipelineStatisticName {
VertexShaderInvocations = "vertex-shader-invocations",
ClipperInvocations = "clipper-invocations",
ClipperPrimitivesOut = "clipper-primitives-out",
FragmentShaderInvocations = "fragment-shader-invocations",
ComputeShaderInvocations = "compute-shader-invocations",
pub enum GpuAutoLayoutMode {
Auto = "auto",
}
4 changes: 2 additions & 2 deletions crates/web-sys/src/features/gen_GpuBindGroup.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ 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 label(this: &GpuBindGroup) -> Option<String>;
pub fn label(this: &GpuBindGroup) -> String;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (structural , method , setter , js_class = "GPUBindGroup" , js_name = label)]
#[doc = "Setter for the `label` field of this object."]
Expand All @@ -36,5 +36,5 @@ 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 set_label(this: &GpuBindGroup, value: Option<&str>);
pub fn set_label(this: &GpuBindGroup, value: &str);
}
4 changes: 2 additions & 2 deletions crates/web-sys/src/features/gen_GpuBindGroupLayout.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ 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 label(this: &GpuBindGroupLayout) -> Option<String>;
pub fn label(this: &GpuBindGroupLayout) -> String;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (structural , method , setter , js_class = "GPUBindGroupLayout" , js_name = label)]
#[doc = "Setter for the `label` field of this object."]
Expand All @@ -36,5 +36,5 @@ 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 set_label(this: &GpuBindGroupLayout, value: Option<&str>);
pub fn set_label(this: &GpuBindGroupLayout, value: &str);
}
4 changes: 2 additions & 2 deletions crates/web-sys/src/features/gen_GpuBuffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ 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 label(this: &GpuBuffer) -> Option<String>;
pub fn label(this: &GpuBuffer) -> String;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (structural , method , setter , js_class = "GPUBuffer" , js_name = label)]
#[doc = "Setter for the `label` field of this object."]
Expand All @@ -36,7 +36,7 @@ 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 set_label(this: &GpuBuffer, value: Option<&str>);
pub fn set_label(this: &GpuBuffer, value: &str);
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "GPUBuffer" , js_name = destroy)]
#[doc = "The `destroy()` method."]
Expand Down
16 changes: 10 additions & 6 deletions crates/web-sys/src/features/gen_GpuCanvasConfiguration.rs
Original file line number Diff line number Diff line change
Expand Up @@ -113,15 +113,15 @@ impl GpuCanvasConfiguration {
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `size` field of this object."]
#[doc = "Change the `usage` field of this object."]
#[doc = ""]
#[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 fn size(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
pub fn usage(&mut self, val: u32) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("size"), &JsValue::from(val));
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("usage"), &JsValue::from(val));
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
Expand All @@ -130,15 +130,19 @@ impl GpuCanvasConfiguration {
self
}
#[cfg(web_sys_unstable_apis)]
#[doc = "Change the `usage` field of this object."]
#[doc = "Change the `viewFormats` field of this object."]
#[doc = ""]
#[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 fn usage(&mut self, val: u32) -> &mut Self {
pub fn view_formats(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self {
use wasm_bindgen::JsValue;
let r = ::js_sys::Reflect::set(self.as_ref(), &JsValue::from("usage"), &JsValue::from(val));
let r = ::js_sys::Reflect::set(
self.as_ref(),
&JsValue::from("viewFormats"),
&JsValue::from(val),
);
debug_assert!(
r.is_ok(),
"setting properties should never fail on our dictionary objects"
Expand Down
12 changes: 0 additions & 12 deletions crates/web-sys/src/features/gen_GpuCanvasContext.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,18 +51,6 @@ extern "C" {
#[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: &GpuCanvasContext) -> GpuTexture;
#[cfg(web_sys_unstable_apis)]
#[cfg(all(feature = "GpuAdapter", feature = "GpuTextureFormat",))]
# [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/GPUCanvasContext/getPreferredFormat)"]
#[doc = ""]
#[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: &GpuCanvasContext, adapter: &GpuAdapter) -> GpuTextureFormat;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (method , structural , js_class = "GPUCanvasContext" , js_name = unconfigure)]
#[doc = "The `unconfigure()` method."]
#[doc = ""]
Expand Down
15 changes: 2 additions & 13 deletions crates/web-sys/src/features/gen_GpuCommandBuffer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,17 +16,6 @@ extern "C" {
#[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"]
pub type GpuCommandBuffer;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (structural , method , getter , js_class = "GPUCommandBuffer" , js_name = executionTime)]
#[doc = "Getter for the `executionTime` field of this object."]
#[doc = ""]
#[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandBuffer/executionTime)"]
#[doc = ""]
#[doc = "*This API requires the following crate features to be activated: `GpuCommandBuffer`*"]
#[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 execution_time(this: &GpuCommandBuffer) -> ::js_sys::Promise;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (structural , method , getter , js_class = "GPUCommandBuffer" , js_name = label)]
#[doc = "Getter for the `label` field of this object."]
#[doc = ""]
Expand All @@ -36,7 +25,7 @@ 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 label(this: &GpuCommandBuffer) -> Option<String>;
pub fn label(this: &GpuCommandBuffer) -> String;
#[cfg(web_sys_unstable_apis)]
# [wasm_bindgen (structural , method , setter , js_class = "GPUCommandBuffer" , js_name = label)]
#[doc = "Setter for the `label` field of this object."]
Expand All @@ -47,5 +36,5 @@ 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 set_label(this: &GpuCommandBuffer, value: Option<&str>);
pub fn set_label(this: &GpuCommandBuffer, value: &str);
}
Loading