diff --git a/CHANGELOG.md b/CHANGELOG.md index da0f386a3c5..3d7c633bfc7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -28,6 +28,9 @@ * Deprecate `wasm_bindgen_test_configure!`s `run_in_worker` in favor of `run_in_dedicated_worker`. [#3804](https://github.com/rustwasm/wasm-bindgen/pull/3804) +* Updated the WebGPU WebIDL to the current draft as of 2024-01-30. Note that this retains the previous update's workaround for `GPUPipelineError`, and holds back an update to the `buffer` argument of the `GPUQueue.{writeBuffer,writeTexture}` methods. + [#3816](https://github.com/rustwasm/wasm-bindgen/pull/3816) + ### Fixed * Fixed UB when freeing strings received from JS if not using the default allocator. diff --git a/crates/web-sys/src/features/gen_GpuAdapter.rs b/crates/web-sys/src/features/gen_GpuAdapter.rs index 47d9b96b106..760614c78ef 100644 --- a/crates/web-sys/src/features/gen_GpuAdapter.rs +++ b/crates/web-sys/src/features/gen_GpuAdapter.rs @@ -63,20 +63,6 @@ extern "C" { #[doc = "[described in the `wasm-bindgen` guide](https://rustwasm.github.io/docs/wasm-bindgen/web-sys/unstable-apis.html)*"] pub fn request_adapter_info(this: &GpuAdapter) -> ::js_sys::Promise; #[cfg(web_sys_unstable_apis)] - # [wasm_bindgen (method , structural , js_class = "GPUAdapter" , js_name = requestAdapterInfo)] - #[doc = "The `requestAdapterInfo()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUAdapter/requestAdapterInfo)"] - #[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 request_adapter_info_with_unmask_hints( - this: &GpuAdapter, - unmask_hints: &::wasm_bindgen::JsValue, - ) -> ::js_sys::Promise; - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUAdapter" , js_name = requestDevice)] #[doc = "The `requestDevice()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuCommandEncoder.rs b/crates/web-sys/src/features/gen_GpuCommandEncoder.rs index bc9e5860e8e..5e8deb5d8e7 100644 --- a/crates/web-sys/src/features/gen_GpuCommandEncoder.rs +++ b/crates/web-sys/src/features/gen_GpuCommandEncoder.rs @@ -515,18 +515,6 @@ extern "C" { destination_offset: f64, ); #[cfg(web_sys_unstable_apis)] - #[cfg(feature = "GpuQuerySet")] - # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = writeTimestamp)] - #[doc = "The `writeTimestamp()` method."] - #[doc = ""] - #[doc = "[MDN Documentation](https://developer.mozilla.org/en-US/docs/Web/API/GPUCommandEncoder/writeTimestamp)"] - #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCommandEncoder`, `GpuQuerySet`*"] - #[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_timestamp(this: &GpuCommandEncoder, query_set: &GpuQuerySet, query_index: u32); - #[cfg(web_sys_unstable_apis)] # [wasm_bindgen (method , structural , js_class = "GPUCommandEncoder" , js_name = insertDebugMarker)] #[doc = "The `insertDebugMarker()` method."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuDepthStencilState.rs b/crates/web-sys/src/features/gen_GpuDepthStencilState.rs index 19454864785..8869e1ce387 100644 --- a/crates/web-sys/src/features/gen_GpuDepthStencilState.rs +++ b/crates/web-sys/src/features/gen_GpuDepthStencilState.rs @@ -17,22 +17,16 @@ extern "C" { } #[cfg(web_sys_unstable_apis)] impl GpuDepthStencilState { - #[cfg(all(feature = "GpuCompareFunction", feature = "GpuTextureFormat",))] + #[cfg(feature = "GpuTextureFormat")] #[doc = "Construct a new `GpuDepthStencilState`."] #[doc = ""] - #[doc = "*This API requires the following crate features to be activated: `GpuCompareFunction`, `GpuDepthStencilState`, `GpuTextureFormat`*"] + #[doc = "*This API requires the following crate features to be activated: `GpuDepthStencilState`, `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 new( - depth_compare: GpuCompareFunction, - depth_write_enabled: bool, - format: GpuTextureFormat, - ) -> Self { + pub fn new(format: GpuTextureFormat) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.depth_compare(depth_compare); - ret.depth_write_enabled(depth_write_enabled); ret.format(format); ret } diff --git a/crates/web-sys/src/features/gen_GpuFragmentState.rs b/crates/web-sys/src/features/gen_GpuFragmentState.rs index 01045694c41..4b2fe1e5080 100644 --- a/crates/web-sys/src/features/gen_GpuFragmentState.rs +++ b/crates/web-sys/src/features/gen_GpuFragmentState.rs @@ -24,14 +24,9 @@ impl GpuFragmentState { #[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( - entry_point: &str, - module: &GpuShaderModule, - targets: &::wasm_bindgen::JsValue, - ) -> Self { + pub fn new(module: &GpuShaderModule, targets: &::wasm_bindgen::JsValue) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.entry_point(entry_point); ret.module(module); ret.targets(targets); ret diff --git a/crates/web-sys/src/features/gen_GpuProgrammableStage.rs b/crates/web-sys/src/features/gen_GpuProgrammableStage.rs index c36ee597e27..7934d6afdc1 100644 --- a/crates/web-sys/src/features/gen_GpuProgrammableStage.rs +++ b/crates/web-sys/src/features/gen_GpuProgrammableStage.rs @@ -24,10 +24,9 @@ impl GpuProgrammableStage { #[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(entry_point: &str, module: &GpuShaderModule) -> Self { + pub fn new(module: &GpuShaderModule) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.entry_point(entry_point); ret.module(module); ret } diff --git a/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs b/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs index e02f53ad529..513ba98d251 100644 --- a/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs +++ b/crates/web-sys/src/features/gen_GpuRenderPassColorAttachment.rs @@ -58,6 +58,27 @@ impl GpuRenderPassColorAttachment { self } #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `depthSlice` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuRenderPassColorAttachment`*"] + #[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_slice(&mut self, val: u32) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("depthSlice"), + &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 = "GpuLoadOp")] #[doc = "Change the `loadOp` field of this object."] #[doc = ""] diff --git a/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs b/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs index f33ce1b1db4..1793d68dcbf 100644 --- a/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs +++ b/crates/web-sys/src/features/gen_GpuShaderModuleCompilationHint.rs @@ -23,12 +23,34 @@ impl GpuShaderModuleCompilationHint { #[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() -> Self { + pub fn new(entry_point: &str) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); + ret.entry_point(entry_point); ret } #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `entryPoint` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleCompilationHint`*"] + #[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 entry_point(&mut self, val: &str) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("entryPoint"), + &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 `layout` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleCompilationHint`*"] @@ -47,9 +69,3 @@ impl GpuShaderModuleCompilationHint { self } } -#[cfg(web_sys_unstable_apis)] -impl Default for GpuShaderModuleCompilationHint { - fn default() -> Self { - Self::new() - } -} diff --git a/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs b/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs index 73fe9f040ee..74255136180 100644 --- a/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs +++ b/crates/web-sys/src/features/gen_GpuShaderModuleDescriptor.rs @@ -64,6 +64,27 @@ impl GpuShaderModuleDescriptor { self } #[cfg(web_sys_unstable_apis)] + #[doc = "Change the `compilationHints` field of this object."] + #[doc = ""] + #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleDescriptor`*"] + #[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 compilation_hints(&mut self, val: &::wasm_bindgen::JsValue) -> &mut Self { + use wasm_bindgen::JsValue; + let r = ::js_sys::Reflect::set( + self.as_ref(), + &JsValue::from("compilationHints"), + &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 `sourceMap` field of this object."] #[doc = ""] #[doc = "*This API requires the following crate features to be activated: `GpuShaderModuleDescriptor`*"] diff --git a/crates/web-sys/src/features/gen_GpuStorageTextureAccess.rs b/crates/web-sys/src/features/gen_GpuStorageTextureAccess.rs index e68ce7b3ca9..e0069d0992f 100644 --- a/crates/web-sys/src/features/gen_GpuStorageTextureAccess.rs +++ b/crates/web-sys/src/features/gen_GpuStorageTextureAccess.rs @@ -12,4 +12,6 @@ use wasm_bindgen::prelude::*; #[derive(Debug, Clone, Copy, PartialEq, Eq)] pub enum GpuStorageTextureAccess { WriteOnly = "write-only", + ReadOnly = "read-only", + ReadWrite = "read-write", } diff --git a/crates/web-sys/src/features/gen_GpuTextureFormat.rs b/crates/web-sys/src/features/gen_GpuTextureFormat.rs index cc2be609a29..5b67dce2fdf 100644 --- a/crates/web-sys/src/features/gen_GpuTextureFormat.rs +++ b/crates/web-sys/src/features/gen_GpuTextureFormat.rs @@ -36,6 +36,7 @@ pub enum GpuTextureFormat { Bgra8unorm = "bgra8unorm", Bgra8unormSrgb = "bgra8unorm-srgb", Rgb9e5ufloat = "rgb9e5ufloat", + Rgb10a2uint = "rgb10a2uint", Rgb10a2unorm = "rgb10a2unorm", Rg11b10ufloat = "rg11b10ufloat", Rg32uint = "rg32uint", diff --git a/crates/web-sys/src/features/gen_GpuVertexFormat.rs b/crates/web-sys/src/features/gen_GpuVertexFormat.rs index 509357ff20c..783adc5387f 100644 --- a/crates/web-sys/src/features/gen_GpuVertexFormat.rs +++ b/crates/web-sys/src/features/gen_GpuVertexFormat.rs @@ -41,4 +41,5 @@ pub enum GpuVertexFormat { Sint32x2 = "sint32x2", Sint32x3 = "sint32x3", Sint32x4 = "sint32x4", + Unorm1010102 = "unorm10-10-10-2", } diff --git a/crates/web-sys/src/features/gen_GpuVertexState.rs b/crates/web-sys/src/features/gen_GpuVertexState.rs index a551e1c49a3..aa0259bd31d 100644 --- a/crates/web-sys/src/features/gen_GpuVertexState.rs +++ b/crates/web-sys/src/features/gen_GpuVertexState.rs @@ -24,10 +24,9 @@ impl GpuVertexState { #[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(entry_point: &str, module: &GpuShaderModule) -> Self { + pub fn new(module: &GpuShaderModule) -> Self { #[allow(unused_mut)] let mut ret: Self = ::wasm_bindgen::JsCast::unchecked_into(::js_sys::Object::new()); - ret.entry_point(entry_point); ret.module(module); ret } diff --git a/crates/web-sys/webidls/unstable/WebGPU.webidl b/crates/web-sys/webidls/unstable/WebGPU.webidl index 05dd50203d5..32397b6e27b 100644 --- a/crates/web-sys/webidls/unstable/WebGPU.webidl +++ b/crates/web-sys/webidls/unstable/WebGPU.webidl @@ -3,10 +3,10 @@ interface mixin GPUObjectBase { }; dictionary GPUObjectDescriptorBase { - USVString label; + USVString label = ""; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUSupportedLimits { readonly attribute unsigned long maxTextureDimension1D; readonly attribute unsigned long maxTextureDimension2D; @@ -42,17 +42,17 @@ interface GPUSupportedLimits { readonly attribute unsigned long maxComputeWorkgroupsPerDimension; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUSupportedFeatures { readonly setlike; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface WGSLLanguageFeatures { readonly setlike; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUAdapterInfo { readonly attribute DOMString vendor; readonly attribute DOMString architecture; @@ -66,7 +66,7 @@ interface mixin NavigatorGPU { Navigator includes NavigatorGPU; WorkerNavigator includes NavigatorGPU; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPU { Promise requestAdapter(optional GPURequestAdapterOptions options = {}); GPUTextureFormat getPreferredCanvasFormat(); @@ -83,14 +83,14 @@ enum GPUPowerPreference { "high-performance", }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUAdapter { [SameObject] readonly attribute GPUSupportedFeatures features; [SameObject] readonly attribute GPUSupportedLimits limits; readonly attribute boolean isFallbackAdapter; Promise requestDevice(optional GPUDeviceDescriptor descriptor = {}); - Promise requestAdapterInfo(optional sequence unmaskHints = []); + Promise requestAdapterInfo(); }; dictionary GPUDeviceDescriptor @@ -114,7 +114,7 @@ enum GPUFeatureName { "float32-filterable", }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUDevice : EventTarget { [SameObject] readonly attribute GPUSupportedFeatures features; [SameObject] readonly attribute GPUSupportedLimits limits; @@ -145,7 +145,7 @@ interface GPUDevice : EventTarget { }; GPUDevice includes GPUObjectBase; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUBuffer { readonly attribute GPUSize64Out size; readonly attribute GPUFlagsConstant usage; @@ -174,7 +174,7 @@ dictionary GPUBufferDescriptor }; typedef [EnforceRange] unsigned long GPUBufferUsageFlags; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] namespace GPUBufferUsage { const GPUFlagsConstant MAP_READ = 0x0001; const GPUFlagsConstant MAP_WRITE = 0x0002; @@ -189,13 +189,13 @@ namespace GPUBufferUsage { }; typedef [EnforceRange] unsigned long GPUMapModeFlags; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] namespace GPUMapMode { const GPUFlagsConstant READ = 0x0001; const GPUFlagsConstant WRITE = 0x0002; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUTexture { GPUTextureView createView(optional GPUTextureViewDescriptor descriptor = {}); @@ -230,7 +230,7 @@ enum GPUTextureDimension { }; typedef [EnforceRange] unsigned long GPUTextureUsageFlags; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] namespace GPUTextureUsage { const GPUFlagsConstant COPY_SRC = 0x01; const GPUFlagsConstant COPY_DST = 0x02; @@ -239,7 +239,7 @@ namespace GPUTextureUsage { const GPUFlagsConstant RENDER_ATTACHMENT = 0x10; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUTextureView { }; GPUTextureView includes GPUObjectBase; @@ -302,6 +302,7 @@ enum GPUTextureFormat { "bgra8unorm-srgb", // Packed 32-bit formats "rgb9e5ufloat", + "rgb10a2uint", "rgb10a2unorm", "rg11b10ufloat", @@ -390,7 +391,7 @@ enum GPUTextureFormat { "astc-12x12-unorm-srgb", }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUExternalTexture { }; GPUExternalTexture includes GPUObjectBase; @@ -401,7 +402,7 @@ dictionary GPUExternalTextureDescriptor PredefinedColorSpace colorSpace = "srgb"; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUSampler { }; GPUSampler includes GPUObjectBase; @@ -447,7 +448,7 @@ enum GPUCompareFunction { "always", }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUBindGroupLayout { }; GPUBindGroupLayout includes GPUObjectBase; @@ -469,7 +470,7 @@ dictionary GPUBindGroupLayoutEntry { }; typedef [EnforceRange] unsigned long GPUShaderStageFlags; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] namespace GPUShaderStage { const GPUFlagsConstant VERTEX = 0x1; const GPUFlagsConstant FRAGMENT = 0x2; @@ -514,6 +515,8 @@ dictionary GPUTextureBindingLayout { enum GPUStorageTextureAccess { "write-only", + "read-only", + "read-write", }; dictionary GPUStorageTextureBindingLayout { @@ -525,7 +528,7 @@ dictionary GPUStorageTextureBindingLayout { dictionary GPUExternalTextureBindingLayout { }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUBindGroup { }; GPUBindGroup includes GPUObjectBase; @@ -549,7 +552,7 @@ dictionary GPUBufferBinding { GPUSize64 size; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUPipelineLayout { }; GPUPipelineLayout includes GPUObjectBase; @@ -559,7 +562,7 @@ dictionary GPUPipelineLayoutDescriptor required sequence bindGroupLayouts; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUShaderModule { Promise getCompilationInfo(); }; @@ -569,10 +572,11 @@ dictionary GPUShaderModuleDescriptor : GPUObjectDescriptorBase { required USVString code; object sourceMap; - record hints; + sequence compilationHints = []; }; dictionary GPUShaderModuleCompilationHint { + required USVString entryPoint; (GPUPipelineLayout or GPUAutoLayoutMode) layout; }; @@ -582,7 +586,7 @@ enum GPUCompilationMessageType { "info", }; -[Exposed=(Window, DedicatedWorker), Serializable, SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), Serializable, SecureContext] interface GPUCompilationMessage { readonly attribute DOMString message; readonly attribute GPUCompilationMessageType type; @@ -592,12 +596,12 @@ interface GPUCompilationMessage { readonly attribute unsigned long long length; }; -[Exposed=(Window, DedicatedWorker), Serializable, SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), Serializable, SecureContext] interface GPUCompilationInfo { readonly attribute FrozenArray messages; }; -[Exposed=(Window, DedicatedWorker), SecureContext, Serializable] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext, Serializable] interface GPUPipelineError : DOMException { constructor(DOMString message, GPUPipelineErrorInit options); readonly attribute GPUPipelineErrorReason reason; @@ -627,13 +631,13 @@ interface mixin GPUPipelineBase { dictionary GPUProgrammableStage { required GPUShaderModule module; - required USVString entryPoint; + USVString entryPoint; record constants; }; -typedef double GPUPipelineConstantValue; // May represent WGSL’s bool, f32, i32, u32, and f16 if enabled. +typedef double GPUPipelineConstantValue; // May represent WGSL's bool, f32, i32, u32, and f16 if enabled. -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUComputePipeline { }; GPUComputePipeline includes GPUObjectBase; @@ -644,7 +648,7 @@ dictionary GPUComputePipelineDescriptor required GPUProgrammableStage compute; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPURenderPipeline { }; GPURenderPipeline includes GPUObjectBase; @@ -712,7 +716,7 @@ dictionary GPUBlendState { }; typedef [EnforceRange] unsigned long GPUColorWriteFlags; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] namespace GPUColorWrite { const GPUFlagsConstant RED = 0x1; const GPUFlagsConstant GREEN = 0x2; @@ -754,8 +758,8 @@ enum GPUBlendOperation { dictionary GPUDepthStencilState { required GPUTextureFormat format; - required boolean depthWriteEnabled; - required GPUCompareFunction depthCompare; + boolean depthWriteEnabled; + GPUCompareFunction depthCompare; GPUStencilFaceState stencilFront = {}; GPUStencilFaceState stencilBack = {}; @@ -822,6 +826,7 @@ enum GPUVertexFormat { "sint32x2", "sint32x3", "sint32x4", + "unorm10-10-10-2", }; enum GPUVertexStepMode { @@ -871,13 +876,21 @@ dictionary GPUImageCopyTextureTagged boolean premultipliedAlpha = false; }; +typedef (ImageBitmap or + ImageData or + HTMLImageElement or + HTMLVideoElement or + VideoFrame or + HTMLCanvasElement or + OffscreenCanvas) GPUImageCopyExternalImageSource; + dictionary GPUImageCopyExternalImage { - required (ImageBitmap or HTMLVideoElement or HTMLCanvasElement or OffscreenCanvas) source; + required GPUImageCopyExternalImageSource source; GPUOrigin2D origin = {}; boolean flipY = false; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUCommandBuffer { }; GPUCommandBuffer includes GPUObjectBase; @@ -889,7 +902,7 @@ dictionary GPUCommandBufferDescriptor interface mixin GPUCommandsMixin { }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUCommandEncoder { GPURenderPassEncoder beginRenderPass(GPURenderPassDescriptor descriptor); GPUComputePassEncoder beginComputePass(optional GPUComputePassDescriptor descriptor = {}); @@ -921,8 +934,6 @@ interface GPUCommandEncoder { optional GPUSize64 offset = 0, optional GPUSize64 size); - undefined writeTimestamp(GPUQuerySet querySet, GPUSize32 queryIndex); - undefined resolveQuerySet( GPUQuerySet querySet, GPUSize32 firstQuery, @@ -956,7 +967,7 @@ interface mixin GPUDebugCommandsMixin { undefined insertDebugMarker(USVString markerLabel); }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUComputePassEncoder { undefined setPipeline(GPUComputePipeline pipeline); undefined dispatchWorkgroups(GPUSize32 workgroupCountX, optional GPUSize32 workgroupCountY = 1, optional GPUSize32 workgroupCountZ = 1); @@ -980,7 +991,7 @@ dictionary GPUComputePassDescriptor GPUComputePassTimestampWrites timestampWrites; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPURenderPassEncoder { undefined setViewport(float x, float y, float width, float height, @@ -1021,6 +1032,7 @@ dictionary GPURenderPassDescriptor dictionary GPURenderPassColorAttachment { required GPUTextureView view; + GPUIntegerCoordinate depthSlice; GPUTextureView resolveTarget; GPUColor clearValue; @@ -1076,7 +1088,7 @@ interface mixin GPURenderCommandsMixin { undefined drawIndexedIndirect(GPUBuffer indirectBuffer, GPUSize64 indirectOffset); }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPURenderBundle { }; GPURenderBundle includes GPUObjectBase; @@ -1085,7 +1097,7 @@ dictionary GPURenderBundleDescriptor : GPUObjectDescriptorBase { }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPURenderBundleEncoder { GPURenderBundle finish(optional GPURenderBundleDescriptor descriptor = {}); }; @@ -1105,7 +1117,7 @@ dictionary GPUQueueDescriptor : GPUObjectDescriptorBase { }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUQueue { undefined submit(sequence commandBuffers); @@ -1131,7 +1143,7 @@ interface GPUQueue { }; GPUQueue includes GPUObjectBase; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUQuerySet { undefined destroy(); @@ -1151,7 +1163,7 @@ enum GPUQueryType { "timestamp", }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUCanvasContext { readonly attribute (HTMLCanvasElement or OffscreenCanvas) canvas; @@ -1180,7 +1192,7 @@ enum GPUDeviceLostReason { "destroyed", }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUDeviceLostInfo { readonly attribute GPUDeviceLostReason reason; readonly attribute DOMString message; @@ -1190,24 +1202,24 @@ partial interface GPUDevice { readonly attribute Promise lost; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUError { readonly attribute DOMString message; }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUValidationError : GPUError { constructor(DOMString message); }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUOutOfMemoryError : GPUError { constructor(DOMString message); }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUInternalError : GPUError { constructor(DOMString message); @@ -1224,7 +1236,7 @@ partial interface GPUDevice { Promise popErrorScope(); }; -[Exposed=(Window, DedicatedWorker), SecureContext] +[Exposed=(Window, DedicatedWorker, ServiceWorker), SecureContext] interface GPUUncapturedErrorEvent : Event { constructor( DOMString type, @@ -1238,7 +1250,7 @@ dictionary GPUUncapturedErrorEventInit : EventInit { }; partial interface GPUDevice { - [Exposed=(Window, DedicatedWorker)] + [Exposed=(Window, DedicatedWorker, ServiceWorker)] attribute EventHandler onuncapturederror; };