From 41fb222726d0786edb3b2d162e39f2d6c7e1f04f Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Thu, 30 Nov 2023 15:29:30 +0100 Subject: [PATCH] update deno (#4801) --- .github/workflows/ci.yml | 2 +- Cargo.lock | 146 +-- Cargo.toml | 10 +- README.md | 2 +- cts_runner/src/main.rs | 2 - deno_webgpu/01_webgpu.js | 2398 ++++++++++++++++------------------ rust-toolchain.toml | 2 +- wgpu-hal/src/gles/adapter.rs | 2 +- 8 files changed, 1158 insertions(+), 1406 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b37f535f06..9b30e6248d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -14,7 +14,7 @@ env: RUST_LOG: info RUST_BACKTRACE: full # This is the MSRV used by `wgpu` itself and all surrounding infrastructure. - REPO_MSRV: "1.70" + REPO_MSRV: "1.71" # This is the MSRV used by the `wgpu-core`, `wgpu-hal`, and `wgpu-types` crates, # to ensure that they can be used with firefox. CORE_MSRV: "1.65" diff --git a/Cargo.lock b/Cargo.lock index 1d5d47c3b3..48e9c91757 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -945,53 +945,28 @@ dependencies = [ "uuid", ] -[[package]] -name = "deno-proc-macro-rules" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3c65c2ffdafc1564565200967edc4851c7b55422d3913466688907efd05ea26f" -dependencies = [ - "deno-proc-macro-rules-macros", - "proc-macro2", - "syn 2.0.39", -] - -[[package]] -name = "deno-proc-macro-rules-macros" -version = "0.3.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3047b312b7451e3190865713a4dd6e1f821aed614ada219766ebc3024a690435" -dependencies = [ - "once_cell", - "proc-macro2", - "quote", - "syn 2.0.39", -] - [[package]] name = "deno_console" -version = "0.119.0" +version = "0.125.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "106305c29d87aaa8030a472486074ba780dccc75c909a4f55bbac4376d8425a3" +checksum = "92543d4f4d82f2350123bd4b60e97a73aba1a9bbca8c931e827459096dedabba" dependencies = [ "deno_core", ] [[package]] name = "deno_core" -version = "0.214.0" +version = "0.232.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "be0af76effe9a766f7c9a253171ab10b9adfaf4b10c6eb0b9f005f9dd0ba2948" +checksum = "229ffd108e028b148a1a5a6122f771bc7c37094170226f44b8b93b3a9b79d114" dependencies = [ "anyhow", "bytes", "deno_ops", "deno_unsync", "futures", - "indexmap", "libc", "log", - "once_cell", "parking_lot", "pin-project", "serde", @@ -1006,18 +981,13 @@ dependencies = [ [[package]] name = "deno_ops" -version = "0.90.0" +version = "0.108.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "568aba570695e05f08c2181bcd6cd3579684af42f489b9ae42712348044b4af7" +checksum = "f7dde627916f8539f3f0d2e754dda40810c8ca4d655f2eaac1ef54785a12fd27" dependencies = [ - "deno-proc-macro-rules", - "lazy-regex", - "once_cell", - "pmutil", - "proc-macro-crate 1.3.1", + "proc-macro-rules", "proc-macro2", "quote", - "regex", "strum", "strum_macros", "syn 2.0.39", @@ -1026,18 +996,18 @@ dependencies = [ [[package]] name = "deno_unsync" -version = "0.2.1" +version = "0.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0720e562455d6374a5292baec3fc895ed8bfed0937428e3245e50979924e5b15" +checksum = "f8a8f3722afd50e566ecfc783cc8a3a046bc4dd5eb45007431dfb2776aeb8993" dependencies = [ "tokio", ] [[package]] name = "deno_url" -version = "0.119.0" +version = "0.125.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "df3885daa41f0236c622801aa7e7b6efdff1e253fbaa941eb5087ec3e7339114" +checksum = "25ec92af225230fe4a429de0b5891f35b1ba5f143f8c1605bb7b9d1cb767ac73" dependencies = [ "deno_core", "serde", @@ -1046,9 +1016,9 @@ dependencies = [ [[package]] name = "deno_web" -version = "0.150.0" +version = "0.156.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "227c8b22e230c85a7cbc5632a6ce81959d277deabd2dfc015dda332c33b1a20d" +checksum = "3aeef7522f46b3442e24a750ef914ca54aade2110d6540a66e4ea17b4eb68bb7" dependencies = [ "async-trait", "base64-simd", @@ -1078,9 +1048,9 @@ dependencies = [ [[package]] name = "deno_webidl" -version = "0.119.0" +version = "0.125.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26983f124cb3d641d940eb2636a103f4907f02b4cd3b52e3acd8365f20a33c08" +checksum = "74b1a86e9a1dec0dc5d4dc132faee72ac50297f41e30f7cab57dd52dda380eed" dependencies = [ "deno_core", ] @@ -1273,7 +1243,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", - "libz-ng-sys", "miniz_oxide", ] @@ -1900,29 +1869,6 @@ dependencies = [ "bitflags 1.3.2", ] -[[package]] -name = "lazy-regex" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5d12be4595afdf58bd19e4a9f4e24187da2a66700786ff660a418e9059937a4c" -dependencies = [ - "lazy-regex-proc_macros", - "once_cell", - "regex", -] - -[[package]] -name = "lazy-regex-proc_macros" -version = "3.1.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "44bcd58e6c97a7fcbaffcdc95728b393b8d98933bfadad49ed4097845b57ef0b" -dependencies = [ - "proc-macro2", - "quote", - "regex", - "syn 2.0.39", -] - [[package]] name = "lazy_static" version = "1.4.0" @@ -1988,16 +1934,6 @@ dependencies = [ "threadpool", ] -[[package]] -name = "libz-ng-sys" -version = "1.1.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3dd9f43e75536a46ee0f92b758f6b63846e594e86638c61a9251338a65baea63" -dependencies = [ - "cmake", - "libc", -] - [[package]] name = "linux-raw-sys" version = "0.4.11" @@ -2689,17 +2625,6 @@ dependencies = [ "plotters-backend", ] -[[package]] -name = "pmutil" -version = "0.6.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52a40bc70c2c58040d2d8b167ba9a5ff59fc9dab7ad44771cfde3dcfde7a09c6" -dependencies = [ - "proc-macro2", - "quote", - "syn 2.0.39", -] - [[package]] name = "png" version = "0.17.10" @@ -2767,6 +2692,29 @@ dependencies = [ "toml_edit 0.20.7", ] +[[package]] +name = "proc-macro-rules" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07c277e4e643ef00c1233393c673f655e3672cf7eb3ba08a00bdd0ea59139b5f" +dependencies = [ + "proc-macro-rules-macros", + "proc-macro2", + "syn 2.0.39", +] + +[[package]] +name = "proc-macro-rules-macros" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "207fffb0fe655d1d47f6af98cc2793405e85929bdbc420d685554ff07be27ac7" +dependencies = [ + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.39", +] + [[package]] name = "proc-macro2" version = "1.0.69" @@ -3085,15 +3033,6 @@ dependencies = [ "serde_derive", ] -[[package]] -name = "serde_bytes" -version = "0.11.12" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ab33ec92f677585af6d88c65593ae2375adde54efdbf16d597f2cbc7a6d368ff" -dependencies = [ - "serde", -] - [[package]] name = "serde_derive" version = "1.0.193" @@ -3119,15 +3058,14 @@ dependencies = [ [[package]] name = "serde_v8" -version = "0.123.0" +version = "0.141.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc3e1c4d2b20f6983e86077c66b25b8d768f2e102e09659af2af034ac47ae709" +checksum = "bc689cb316d67b200e9f7449ce76cceb7e483e0f828d1a9c3d057c4367b6c26e" dependencies = [ "bytes", "derive_more", "num-bigint", "serde", - "serde_bytes", "smallvec", "thiserror", "v8", @@ -3704,9 +3642,9 @@ dependencies = [ [[package]] name = "v8" -version = "0.76.0" +version = "0.81.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d4e8ae7ef8b4e852e728e343cb6bb471a0424dfefa22585ea0c14a61252d73f" +checksum = "b75f5f378b9b54aff3b10da8170d26af4cfd217f644cf671badcd13af5db4beb" dependencies = [ "bitflags 1.3.2", "fslock", diff --git a/Cargo.toml b/Cargo.toml index 3b9ddf008b..928d7dd86a 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -165,11 +165,11 @@ web-time = "0.2.3" web-sys = "0.3.66" # deno dependencies -deno_console = "0.119.0" -deno_core = "0.214.0" -deno_url = "0.119.0" -deno_web = "0.150.0" -deno_webidl = "0.119.0" +deno_console = "0.125.0" +deno_core = "0.232.0" +deno_url = "0.125.0" +deno_web = "0.156.0" +deno_webidl = "0.125.0" deno_webgpu = { version = "0.85.0", path = "./deno_webgpu" } tokio = "1.34.0" termcolor = "1.4.0" diff --git a/README.md b/README.md index 29f5d32493..62596b4634 100644 --- a/README.md +++ b/README.md @@ -122,7 +122,7 @@ On Linux, you can point to them using `LD_LIBRARY_PATH` environment. Due to complex dependants, we have two MSRV policies: - `d3d12`, `naga`, `wgpu-core`, `wgpu-hal`, and `wgpu-types`'s MSRV is **1.65**. - - The rest of the workspace has the MSRV of **1.70**. + - The rest of the workspace has the MSRV of **1.71**. It is enforced on CI (in "/.github/workflows/ci.yml") with `CORE_MSRV` and `REPO_MSRV` variable. This version can only be upgraded in breaking releases, though we release a breaking version every 3 months. diff --git a/cts_runner/src/main.rs b/cts_runner/src/main.rs index 37185e9cc4..700fe3b3ef 100644 --- a/cts_runner/src/main.rs +++ b/cts_runner/src/main.rs @@ -160,8 +160,6 @@ mod native { fn allow_hrtime(&mut self) -> bool { false } - - fn check_unstable(&self, _state: &deno_core::OpState, _api_name: &'static str) {} } } diff --git a/deno_webgpu/01_webgpu.js b/deno_webgpu/01_webgpu.js index 0e38aee70d..92157e5490 100644 --- a/deno_webgpu/01_webgpu.js +++ b/deno_webgpu/01_webgpu.js @@ -12,6 +12,7 @@ const primordials = globalThis.__bootstrap.primordials; import * as webidl from "ext:deno_webidl/00_webidl.js"; import { EventTarget } from "ext:deno_web/02_event.js"; import DOMException from "ext:deno_web/01_dom_exception.js"; +import { createFilteredInspectProxy } from "ext:deno_console/01_console.js"; const { ArrayBuffer, ArrayBufferIsView, @@ -77,10 +78,11 @@ const _count = Symbol("[[count]]"); /** * @param {any} self - * @param {{prefix: string, context: string}} opts + * @param {string} prefix + * @param {string} context * @returns {InnerGPUDevice & {rid: number}} */ -function assertDevice(self, { prefix, context }) { +function assertDevice(self, prefix, context) { const device = self[_device]; const deviceRid = device?.rid; if (deviceRid === undefined) { @@ -103,10 +105,7 @@ function assertDeviceMatch( resource, { prefix, resourceContext, selfContext }, ) { - const resourceDevice = assertDevice(resource, { - prefix, - context: resourceContext, - }); + const resourceDevice = assertDevice(resource, prefix, resourceContext); if (resourceDevice.rid !== self.rid) { throw new DOMException( `${prefix}: ${resourceContext} belongs to a diffent device than ${selfContext}.`, @@ -118,10 +117,11 @@ function assertDeviceMatch( /** * @param {any} self - * @param {{prefix: string, context: string}} opts + * @param {string} prefix + * @param {string} context * @returns {number} */ -function assertResource(self, { prefix, context }) { +function assertResource(self, prefix, context) { const rid = self[_rid]; if (rid === undefined) { throw new DOMException( @@ -207,11 +207,8 @@ class GPUValidationError extends GPUError { /** @param {string} message */ constructor(message) { const prefix = "Failed to construct 'GPUValidationError'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - message = webidl.converters.DOMString(message, { - prefix, - context: "Argument 1", - }); + webidl.requiredArguments(arguments.length, 1, prefix); + message = webidl.converters.DOMString(message, prefix, "Argument 1"); super(illegalConstructorKey); this[webidl.brand] = webidl.brand; this[_message] = message; @@ -223,11 +220,8 @@ class GPUOutOfMemoryError extends GPUError { name = "GPUOutOfMemoryError"; constructor(message) { const prefix = "Failed to construct 'GPUOutOfMemoryError'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - message = webidl.converters.DOMString(message, { - prefix, - context: "Argument 1", - }); + webidl.requiredArguments(arguments.length, 1, prefix); + message = webidl.converters.DOMString(message, prefix, "Argument 1"); super(illegalConstructorKey); this[webidl.brand] = webidl.brand; this[_message] = message; @@ -247,10 +241,11 @@ class GPU { */ async requestAdapter(options = {}) { webidl.assertBranded(this, GPUPrototype); - options = webidl.converters.GPURequestAdapterOptions(options, { - prefix: "Failed to execute 'requestAdapter' on 'GPU'", - context: "Argument 1", - }); + options = webidl.converters.GPURequestAdapterOptions( + options, + "Failed to execute 'requestAdapter' on 'GPU'", + "Argument 1", + ); const { err, ...data } = await core.opAsync( "op_webgpu_request_adapter", @@ -265,8 +260,8 @@ class GPU { } } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${inspect({})}`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return `${this.constructor.name} ${inspect({}, inspectOptions)}`; } } const GPUPrototype = GPU.prototype; @@ -310,6 +305,8 @@ class GPUAdapter { } /** @returns {boolean} */ get isFallbackAdapter() { + webidl.assertBranded(this, GPUAdapterPrototype); + webidl.assertBranded(this, GPUAdapterPrototype); return this[_adapter].isFallbackAdapter; } @@ -324,14 +321,17 @@ class GPUAdapter { async requestDevice(descriptor = {}) { webidl.assertBranded(this, GPUAdapterPrototype); const prefix = "Failed to execute 'requestDevice' on 'GPUAdapter'"; - descriptor = webidl.converters.GPUDeviceDescriptor(descriptor, { + descriptor = webidl.converters.GPUDeviceDescriptor( + descriptor, prefix, - context: "Argument 1", - }); + "Argument 1", + ); const requiredFeatures = descriptor.requiredFeatures ?? []; for (let i = 0; i < requiredFeatures.length; ++i) { const feature = requiredFeatures[i]; - if (!SetPrototypeHas(this[_adapter].features[webidl.setlikeInner], feature)) { + if ( + !SetPrototypeHas(this[_adapter].features[webidl.setlikeInner], feature) + ) { throw new TypeError( `${prefix}: requiredFeatures must be a subset of the adapter features.`, ); @@ -366,10 +366,11 @@ class GPUAdapter { async requestAdapterInfo(unmaskHints = []) { webidl.assertBranded(this, GPUAdapterPrototype); const prefix = "Failed to execute 'requestAdapterInfo' on 'GPUAdapter'"; - unmaskHints = webidl.converters["sequence"](unmaskHints, { + unmaskHints = webidl.converters["sequence"]( + unmaskHints, prefix, - context: "Argument 1", - }); + "Argument 1", + ); const { vendor, @@ -393,13 +394,19 @@ class GPUAdapter { return adapterInfo; } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - features: this.features, - limits: this.limits, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPUAdapterPrototype, this), + keys: [ + "features", + "limits", + "isFallbackAdapter", + ], + }), + inspectOptions, + ); } } const GPUAdapterPrototype = GPUAdapter.prototype; @@ -437,15 +444,20 @@ class GPUAdapterInfo { return this[_description]; } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - vendor: this.vendor, - architecture: this.architecture, - device: this.device, - description: this.description, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPUAdapterInfoPrototype, this), + keys: [ + "vendor", + "architecture", + "device", + "description", + ], + }), + inspectOptions, + ); } } const GPUAdapterInfoPrototype = GPUAdapterInfo.prototype; @@ -607,8 +619,44 @@ class GPUSupportedLimits { return this[_limits].maxComputeWorkgroupsPerDimension; } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${inspect(this[_limits])}`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPUSupportedLimitsPrototype, this), + keys: [ + "maxTextureDimension1D", + "maxTextureDimension2D", + "maxTextureDimension3D", + "maxTextureArrayLayers", + "maxBindGroups", + "maxBindingsPerBindGroup", + "maxBufferSize", + "maxDynamicUniformBuffersPerPipelineLayout", + "maxDynamicStorageBuffersPerPipelineLayout", + "maxSampledTexturesPerShaderStage", + "maxSamplersPerShaderStage", + "maxStorageBuffersPerShaderStage", + "maxStorageTexturesPerShaderStage", + "maxUniformBuffersPerShaderStage", + "maxUniformBufferBindingSize", + "maxStorageBufferBindingSize", + "minUniformBufferOffsetAlignment", + "minStorageBufferOffsetAlignment", + "maxVertexBuffers", + "maxVertexAttributes", + "maxVertexBufferArrayStride", + "maxInterStageShaderComponents", + "maxComputeWorkgroupStorageSize", + "maxComputeInvocationsPerWorkgroup", + "maxComputeWorkgroupSizeX", + "maxComputeWorkgroupSizeY", + "maxComputeWorkgroupSizeZ", + "maxComputeWorkgroupsPerDimension", + ], + }), + inspectOptions, + ); } } const GPUSupportedLimitsPrototype = GPUSupportedLimits.prototype; @@ -629,29 +677,33 @@ class GPUSupportedFeatures { constructor() { webidl.illegalConstructor(); } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect([...new SafeArrayIterator(this.values())]) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + if (ObjectPrototypeIsPrototypeOf(GPUSupportedFeaturesPrototype, this)) { + return `${this.constructor.name} ${ + // deno-lint-ignore prefer-primordials + inspect([...this], inspectOptions) + }`; + } else { + return `${this.constructor.name} ${inspect({}, inspectOptions)}`; + } } -} -const GPUSupportedFeaturesPrototype = GPUSupportedFeatures.prototype; + const GPUSupportedFeaturesPrototype = GPUSupportedFeatures.prototype; -/** - * @param {string | undefined} reason - * @param {string} message - * @returns {GPUDeviceLostInfo} - */ -function createGPUDeviceLostInfo(reason, message) { - /** @type {GPUDeviceLostInfo} */ - const deviceLostInfo = webidl.createBranded(GPUDeviceLostInfo); - deviceLostInfo[_reason] = reason ?? "unknown"; - deviceLostInfo[_message] = message; - return deviceLostInfo; -} + /** + * @param {string | undefined} reason + * @param {string} message + * @returns {GPUDeviceLostInfo} + */ + function createGPUDeviceLostInfo(reason, message) { + /** @type {GPUDeviceLostInfo} */ + const deviceLostInfo = webidl.createBranded(GPUDeviceLostInfo); + deviceLostInfo[_reason] = reason ?? "unknown"; + deviceLostInfo[_message] = message; + return deviceLostInfo; + } -class GPUDeviceLostInfo { + class GPUDeviceLostInfo { /** @type {string} */ [_reason]; /** @type {string} */ @@ -670,10 +722,18 @@ class GPUDeviceLostInfo { return this[_message]; } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ reason: this[_reason], message: this[_message] }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPUDeviceLostInfoPrototype, this), + keys: [ + "reason", + "message", + ], + }), + inspectOptions, + ); } } @@ -698,10 +758,11 @@ function GPUObjectBaseMixin(name, type) { */ set(label) { webidl.assertBranded(this, type.prototype); - label = webidl.converters["UVString?"](label, { - prefix: `Failed to set 'label' on '${name}'`, - context: "Argument 1", - }); + label = webidl.converters["UVString?"]( + label, + `Failed to set 'label' on '${name}'`, + "Argument 1", + ); this[_label] = label; }, }); @@ -908,12 +969,13 @@ class GPUDevice extends EventTarget { createBuffer(descriptor) { webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createBuffer' on 'GPUDevice'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - descriptor = webidl.converters.GPUBufferDescriptor(descriptor, { + webidl.requiredArguments(arguments.length, 1, prefix); + descriptor = webidl.converters.GPUBufferDescriptor( + descriptor, prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); + "Argument 1", + ); + const device = assertDevice(this, prefix, "this"); const { rid, err } = ops.op_webgpu_create_buffer( device.rid, descriptor.label, @@ -958,12 +1020,13 @@ class GPUDevice extends EventTarget { createTexture(descriptor) { webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createTexture' on 'GPUDevice'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - descriptor = webidl.converters.GPUTextureDescriptor(descriptor, { + webidl.requiredArguments(arguments.length, 1, prefix); + descriptor = webidl.converters.GPUTextureDescriptor( + descriptor, prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); + "Argument 1", + ); + const device = assertDevice(this, prefix, "this"); const { rid, err } = ops.op_webgpu_create_texture({ deviceRid: device.rid, ...descriptor, @@ -987,11 +1050,12 @@ class GPUDevice extends EventTarget { createSampler(descriptor = {}) { webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createSampler' on 'GPUDevice'"; - descriptor = webidl.converters.GPUSamplerDescriptor(descriptor, { + descriptor = webidl.converters.GPUSamplerDescriptor( + descriptor, prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); + "Argument 1", + ); + const device = assertDevice(this, prefix, "this"); const { rid, err } = ops.op_webgpu_create_sampler({ deviceRid: device.rid, ...descriptor, @@ -1014,12 +1078,13 @@ class GPUDevice extends EventTarget { createBindGroupLayout(descriptor) { webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createBindGroupLayout' on 'GPUDevice'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - descriptor = webidl.converters.GPUBindGroupLayoutDescriptor(descriptor, { + webidl.requiredArguments(arguments.length, 1, prefix); + descriptor = webidl.converters.GPUBindGroupLayoutDescriptor( + descriptor, prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); + "Argument 1", + ); + const device = assertDevice(this, prefix, "this"); for (let i = 0; i < descriptor.entries.length; ++i) { const entry = descriptor.entries[i]; @@ -1057,17 +1122,18 @@ class GPUDevice extends EventTarget { createPipelineLayout(descriptor) { webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createPipelineLayout' on 'GPUDevice'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - descriptor = webidl.converters.GPUPipelineLayoutDescriptor(descriptor, { + webidl.requiredArguments(arguments.length, 1, prefix); + descriptor = webidl.converters.GPUPipelineLayoutDescriptor( + descriptor, prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); + "Argument 1", + ); + const device = assertDevice(this, prefix, "this"); const bindGroupLayouts = ArrayPrototypeMap( descriptor.bindGroupLayouts, (layout, i) => { const context = `bind group layout ${i + 1}`; - const rid = assertResource(layout, { prefix, context }); + const rid = assertResource(layout, prefix, context); assertDeviceMatch(device, layout, { prefix, selfContext: "this", @@ -1099,16 +1165,14 @@ class GPUDevice extends EventTarget { createBindGroup(descriptor) { webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createBindGroup' on 'GPUDevice'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - descriptor = webidl.converters.GPUBindGroupDescriptor(descriptor, { - prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const layout = assertResource(descriptor.layout, { + webidl.requiredArguments(arguments.length, 1, prefix); + descriptor = webidl.converters.GPUBindGroupDescriptor( + descriptor, prefix, - context: "layout", - }); + "Argument 1", + ); + const device = assertDevice(this, prefix, "this"); + const layout = assertResource(descriptor.layout, prefix, "layout"); assertDeviceMatch(device, descriptor.layout, { prefix, resourceContext: "layout", @@ -1118,10 +1182,7 @@ class GPUDevice extends EventTarget { const context = `entry ${i + 1}`; const resource = entry.resource; if (ObjectPrototypeIsPrototypeOf(GPUSamplerPrototype, resource)) { - const rid = assertResource(resource, { - prefix, - context, - }); + const rid = assertResource(resource, prefix, context); assertDeviceMatch(device, resource, { prefix, resourceContext: context, @@ -1135,14 +1196,8 @@ class GPUDevice extends EventTarget { } else if ( ObjectPrototypeIsPrototypeOf(GPUTextureViewPrototype, resource) ) { - const rid = assertResource(resource, { - prefix, - context, - }); - assertResource(resource[_texture], { - prefix, - context, - }); + const rid = assertResource(resource, prefix, context); + assertResource(resource[_texture], prefix, context); assertDeviceMatch(device, resource[_texture], { prefix, resourceContext: context, @@ -1154,7 +1209,7 @@ class GPUDevice extends EventTarget { resource: rid, }; } else { - const rid = assertResource(resource.buffer, { prefix, context }); + const rid = assertResource(resource.buffer, prefix, context); assertDeviceMatch(device, resource.buffer, { prefix, resourceContext: context, @@ -1193,12 +1248,13 @@ class GPUDevice extends EventTarget { createShaderModule(descriptor) { webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createShaderModule' on 'GPUDevice'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - descriptor = webidl.converters.GPUShaderModuleDescriptor(descriptor, { + webidl.requiredArguments(arguments.length, 1, prefix); + descriptor = webidl.converters.GPUShaderModuleDescriptor( + descriptor, prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); + "Argument 1", + ); + const device = assertDevice(this, prefix, "this"); const { rid, err } = ops.op_webgpu_create_shader_module( device.rid, descriptor.label, @@ -1222,26 +1278,28 @@ class GPUDevice extends EventTarget { createComputePipeline(descriptor) { webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createComputePipeline' on 'GPUDevice'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - descriptor = webidl.converters.GPUComputePipelineDescriptor(descriptor, { + webidl.requiredArguments(arguments.length, 1, prefix); + descriptor = webidl.converters.GPUComputePipelineDescriptor( + descriptor, prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); + "Argument 1", + ); + const device = assertDevice(this, prefix, "this"); let layout = descriptor.layout; if (typeof descriptor.layout !== "string") { const context = "layout"; - layout = assertResource(descriptor.layout, { prefix, context }); + layout = assertResource(descriptor.layout, prefix, context); assertDeviceMatch(device, descriptor.layout, { prefix, resourceContext: context, selfContext: "this", }); } - const module = assertResource(descriptor.compute.module, { + const module = assertResource( + descriptor.compute.module, prefix, - context: "compute shader module", - }); + "compute shader module", + ); assertDeviceMatch(device, descriptor.compute.module, { prefix, resourceContext: "compute shader module", @@ -1276,26 +1334,28 @@ class GPUDevice extends EventTarget { createRenderPipeline(descriptor) { webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createRenderPipeline' on 'GPUDevice'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - descriptor = webidl.converters.GPURenderPipelineDescriptor(descriptor, { + webidl.requiredArguments(arguments.length, 1, prefix); + descriptor = webidl.converters.GPURenderPipelineDescriptor( + descriptor, prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); + "Argument 1", + ); + const device = assertDevice(this, prefix, "this"); let layout = descriptor.layout; if (typeof descriptor.layout !== "string") { const context = "layout"; - layout = assertResource(descriptor.layout, { prefix, context }); + layout = assertResource(descriptor.layout, prefix, context); assertDeviceMatch(device, descriptor.layout, { prefix, resourceContext: context, selfContext: "this", }); } - const module = assertResource(descriptor.vertex.module, { + const module = assertResource( + descriptor.vertex.module, prefix, - context: "vertex shader module", - }); + "vertex shader module", + ); assertDeviceMatch(device, descriptor.vertex.module, { prefix, resourceContext: "vertex shader module", @@ -1303,10 +1363,11 @@ class GPUDevice extends EventTarget { }); let fragment = undefined; if (descriptor.fragment) { - const module = assertResource(descriptor.fragment.module, { + const module = assertResource( + descriptor.fragment.module, prefix, - context: "fragment shader module", - }); + "fragment shader module", + ); assertDeviceMatch(device, descriptor.fragment.module, { prefix, resourceContext: "fragment shader module", @@ -1361,11 +1422,12 @@ class GPUDevice extends EventTarget { createCommandEncoder(descriptor = {}) { webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createCommandEncoder' on 'GPUDevice'"; - descriptor = webidl.converters.GPUCommandEncoderDescriptor(descriptor, { + descriptor = webidl.converters.GPUCommandEncoderDescriptor( + descriptor, prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); + "Argument 1", + ); + const device = assertDevice(this, prefix, "this"); const { rid, err } = ops.op_webgpu_create_command_encoder( device.rid, descriptor.label, @@ -1392,12 +1454,10 @@ class GPUDevice extends EventTarget { webidl.requiredArguments(arguments.length, 1, { prefix }); descriptor = webidl.converters.GPURenderBundleEncoderDescriptor( descriptor, - { - prefix, - context: "Argument 1", - }, + prefix, + "Argument 1", ); - const device = assertDevice(this, { prefix, context: "this" }); + const device = assertDevice(this, prefix, "this"); const { rid, err } = ops.op_webgpu_create_render_bundle_encoder({ deviceRid: device.rid, ...descriptor, @@ -1420,15 +1480,13 @@ class GPUDevice extends EventTarget { createQuerySet(descriptor) { webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'createQuerySet' on 'GPUDevice'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); + webidl.requiredArguments(arguments.length, 1, prefix); descriptor = webidl.converters.GPUQuerySetDescriptor( descriptor, - { - prefix, - context: "Argument 1", - }, + prefix, + "Argument 1", ); - const device = assertDevice(this, { prefix, context: "this" }); + const device = assertDevice(this, prefix, "this"); const { rid, err } = ops.op_webgpu_create_query_set({ deviceRid: device.rid, ...descriptor, @@ -1463,12 +1521,9 @@ class GPUDevice extends EventTarget { pushErrorScope(filter) { webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'pushErrorScope' on 'GPUDevice'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - filter = webidl.converters.GPUErrorFilter(filter, { - prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); + webidl.requiredArguments(arguments.length, 1, prefix); + filter = webidl.converters.GPUErrorFilter(filter, prefix, "Argument 1"); + const device = assertDevice(this, prefix, "this"); ArrayPrototypePush(device.errorScopeStack, { filter, operations: [] }); } @@ -1479,7 +1534,7 @@ class GPUDevice extends EventTarget { async popErrorScope() { webidl.assertBranded(this, GPUDevicePrototype); const prefix = "Failed to execute 'popErrorScope' on 'GPUDevice'"; - const device = assertDevice(this, { prefix, context: "this" }); + const device = assertDevice(this, prefix, "this"); if (device.isLost) { throw new DOMException("Device has been lost.", "OperationError"); } @@ -1498,15 +1553,23 @@ class GPUDevice extends EventTarget { ); } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - features: this.features, - label: this.label, - limits: this.limits, - queue: this.queue, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPUDevicePrototype, this), + keys: [ + "features", + "label", + "limits", + "lost", + "queue", + // TODO(lucacasonato): emit an UncapturedErrorEvent + // "onuncapturederror" + ], + }), + inspectOptions, + ); } } GPUObjectBaseMixin("GPUDevice", GPUDevice); @@ -1544,14 +1607,15 @@ class GPUQueue { }); commandBuffers = webidl.converters["sequence"]( commandBuffers, - { prefix, context: "Argument 1" }, + prefix, + "Argument 1", ); - const device = assertDevice(this, { prefix, context: "this" }); + const device = assertDevice(this, prefix, "this"); const commandBufferRids = ArrayPrototypeMap( commandBuffers, (buffer, i) => { const context = `command buffer ${i + 1}`; - const rid = assertResource(buffer, { prefix, context }); + const rid = assertResource(buffer, prefix, context); assertDeviceMatch(device, buffer, { prefix, selfContext: "this", @@ -1582,32 +1646,24 @@ class GPUQueue { writeBuffer(buffer, bufferOffset, data, dataOffset = 0, size) { webidl.assertBranded(this, GPUQueuePrototype); const prefix = "Failed to execute 'writeBuffer' on 'GPUQueue'"; - webidl.requiredArguments(arguments.length, 3, { prefix }); - buffer = webidl.converters["GPUBuffer"](buffer, { - prefix, - context: "Argument 1", - }); - bufferOffset = webidl.converters["GPUSize64"](bufferOffset, { - prefix, - context: "Argument 2", - }); - data = webidl.converters.BufferSource(data, { - prefix, - context: "Argument 3", - }); - dataOffset = webidl.converters["GPUSize64"](dataOffset, { + webidl.requiredArguments(arguments.length, 3, prefix); + buffer = webidl.converters["GPUBuffer"](buffer, prefix, "Argument 1"); + bufferOffset = webidl.converters["GPUSize64"]( + bufferOffset, prefix, - context: "Argument 4", - }); - size = size === undefined ? undefined : webidl.converters.GPUSize64(size, { - prefix, - context: "Argument 5", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const bufferRid = assertResource(buffer, { + "Argument 2", + ); + data = webidl.converters.BufferSource(data, prefix, "Argument 3"); + dataOffset = webidl.converters["GPUSize64"]( + dataOffset, prefix, - context: "Argument 1", - }); + "Argument 4", + ); + size = size === undefined + ? undefined + : webidl.converters.GPUSize64(size, prefix, "Argument 5"); + const device = assertDevice(this, prefix, "this"); + const bufferRid = assertResource(buffer, prefix, "Argument 1"); assertDeviceMatch(device, buffer, { prefix, selfContext: "this", @@ -1633,28 +1689,21 @@ class GPUQueue { writeTexture(destination, data, dataLayout, size) { webidl.assertBranded(this, GPUQueuePrototype); const prefix = "Failed to execute 'writeTexture' on 'GPUQueue'"; - webidl.requiredArguments(arguments.length, 4, { prefix }); - destination = webidl.converters.GPUImageCopyTexture(destination, { - prefix, - context: "Argument 1", - }); - data = webidl.converters.BufferSource(data, { - prefix, - context: "Argument 2", - }); - dataLayout = webidl.converters.GPUImageDataLayout(dataLayout, { - prefix, - context: "Argument 3", - }); - size = webidl.converters.GPUExtent3D(size, { + webidl.requiredArguments(arguments.length, 4, prefix); + destination = webidl.converters.GPUImageCopyTexture( + destination, prefix, - context: "Argument 4", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const textureRid = assertResource(destination.texture, { + "Argument 1", + ); + data = webidl.converters.BufferSource(data, prefix, "Argument 2"); + dataLayout = webidl.converters.GPUImageDataLayout( + dataLayout, prefix, - context: "texture", - }); + "Argument 3", + ); + size = webidl.converters.GPUExtent3D(size, prefix, "Argument 4"); + const device = assertDevice(this, prefix, "this"); + const textureRid = assertResource(destination.texture, prefix, "texture"); assertDeviceMatch(device, destination.texture, { prefix, selfContext: "this", @@ -1677,12 +1726,17 @@ class GPUQueue { device.pushError(err); } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - label: this.label, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPUQueuePrototype, this), + keys: [ + "label", + ], + }), + inspectOptions, + ); } } GPUObjectBaseMixin("GPUQueue", GPUQueue); @@ -1788,21 +1842,14 @@ class GPUBuffer { async mapAsync(mode, offset = 0, size) { webidl.assertBranded(this, GPUBufferPrototype); const prefix = "Failed to execute 'mapAsync' on 'GPUBuffer'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - mode = webidl.converters.GPUMapModeFlags(mode, { - prefix, - context: "Argument 1", - }); - offset = webidl.converters.GPUSize64(offset, { - prefix, - context: "Argument 2", - }); - size = size === undefined ? undefined : webidl.converters.GPUSize64(size, { - prefix, - context: "Argument 3", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const bufferRid = assertResource(this, { prefix, context: "this" }); + webidl.requiredArguments(arguments.length, 1, prefix); + mode = webidl.converters.GPUMapModeFlags(mode, prefix, "Argument 1"); + offset = webidl.converters.GPUSize64(offset, prefix, "Argument 2"); + size = size === undefined + ? undefined + : webidl.converters.GPUSize64(size, prefix, "Argument 3"); + const device = assertDevice(this, prefix, "this"); + const bufferRid = assertResource(this, prefix, "this"); /** @type {number} */ let rangeSize; if (size === undefined) { @@ -1886,18 +1933,12 @@ class GPUBuffer { getMappedRange(offset = 0, size) { webidl.assertBranded(this, GPUBufferPrototype); const prefix = "Failed to execute 'getMappedRange' on 'GPUBuffer'"; - offset = webidl.converters.GPUSize64(offset, { - prefix, - context: "Argument 1", - }); + offset = webidl.converters.GPUSize64(offset, prefix, "Argument 1"); if (size !== undefined) { - size = webidl.converters.GPUSize64(size, { - prefix, - context: "Argument 2", - }); + size = webidl.converters.GPUSize64(size, prefix, "Argument 2"); } - assertDevice(this, { prefix, context: "this" }); - const bufferRid = assertResource(this, { prefix, context: "this" }); + assertDevice(this, prefix, "this"); + const bufferRid = assertResource(this, prefix, "this"); /** @type {number} */ let rangeSize; if (size === undefined) { @@ -1941,8 +1982,8 @@ class GPUBuffer { unmap() { webidl.assertBranded(this, GPUBufferPrototype); const prefix = "Failed to execute 'unmap' on 'GPUBuffer'"; - const device = assertDevice(this, { prefix, context: "this" }); - const bufferRid = assertResource(this, { prefix, context: "this" }); + const device = assertDevice(this, prefix, "this"); + const bufferRid = assertResource(this, prefix, "this"); if (this[_state] === "unmapped" || this[_state] === "destroyed") { throw new DOMException( `${prefix}: buffer is not ready to be unmapped.`, @@ -2001,12 +2042,20 @@ class GPUBuffer { this[_cleanup](); } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - label: this.label, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPUBufferPrototype, this), + keys: [ + "label", + "mapState", + "size", + "usage", + ], + }), + inspectOptions, + ); } } GPUObjectBaseMixin("GPUBuffer", GPUBuffer); @@ -2137,13 +2186,14 @@ class GPUTexture { createView(descriptor = {}) { webidl.assertBranded(this, GPUTexturePrototype); const prefix = "Failed to execute 'createView' on 'GPUTexture'"; - webidl.requiredArguments(arguments.length, 0, { prefix }); - descriptor = webidl.converters.GPUTextureViewDescriptor(descriptor, { + webidl.requiredArguments(arguments.length, 0, prefix); + descriptor = webidl.converters.GPUTextureViewDescriptor( + descriptor, prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const textureRid = assertResource(this, { prefix, context: "this" }); + "Argument 1", + ); + const device = assertDevice(this, prefix, "this"); + const textureRid = assertResource(this, prefix, "this"); const { rid, err } = ops.op_webgpu_create_texture_view({ textureRid, ...descriptor, @@ -2204,12 +2254,25 @@ class GPUTexture { return this[_usage]; } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - label: this.label, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPUTexturePrototype, this), + keys: [ + "label", + "width", + "height", + "depthOrArrayLayers", + "mipLevelCount", + "sampleCount", + "dimension", + "format", + "usage", + ], + }), + inspectOptions, + ); } } GPUObjectBaseMixin("GPUTexture", GPUTexture); @@ -2270,12 +2333,17 @@ class GPUTextureView { webidl.illegalConstructor(); } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - label: this.label, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPUTextureViewPrototype, this), + keys: [ + "label", + ], + }), + inspectOptions, + ); } } GPUObjectBaseMixin("GPUTextureView", GPUTextureView); @@ -2356,16 +2424,21 @@ class GPUBindGroupLayout { webidl.illegalConstructor(); } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - label: this.label, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPUBindGroupLayoutPrototype, this), + keys: [ + "label", + ], + }), + inspectOptions, + ); } } GPUObjectBaseMixin("GPUBindGroupLayout", GPUBindGroupLayout); - +const GPUBindGroupLayoutPrototype = GPUBindGroupLayout.prototype; /** * @param {string | null} label * @param {InnerGPUDevice} device @@ -2399,15 +2472,22 @@ class GPUPipelineLayout { webidl.illegalConstructor(); } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - label: this.label, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPUPipelineLayoutPrototype, this), + keys: [ + "label", + ], + }), + inspectOptions, + ); } } GPUObjectBaseMixin("GPUPipelineLayout", GPUPipelineLayout); +const GPUPipelineLayoutPrototype = GPUPipelineLayout.prototype; + /** * @param {string | null} label @@ -2442,16 +2522,21 @@ class GPUBindGroup { webidl.illegalConstructor(); } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - label: this.label, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPUBindGroupPrototype, this), + keys: [ + "label", + ], + }), + inspectOptions, + ); } } GPUObjectBaseMixin("GPUBindGroup", GPUBindGroup); - +const GPUBindGroupPrototype = GPUBindGroup.prototype; /** * @param {string | null} label * @param {InnerGPUDevice} device @@ -2485,16 +2570,21 @@ class GPUShaderModule { webidl.illegalConstructor(); } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - label: this.label, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPUShaderModulePrototype, this), + keys: [ + "label", + ], + }), + inspectOptions, + ); } } GPUObjectBaseMixin("GPUShaderModule", GPUShaderModule); - +const GPUShaderModulePrototype = GPUShaderModule.prototype; class GPUShaderStage { constructor() { webidl.illegalConstructor(); @@ -2555,17 +2645,11 @@ class GPUComputePipeline { const prefix = "Failed to execute 'getBindGroupLayout' on 'GPUComputePipeline'"; webidl.requiredArguments(arguments.length, 1, { prefix }); - index = webidl.converters["unsigned long"](index, { - prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const computePipelineRid = assertResource(this, { - prefix, - context: "this", - }); - const { rid, label, err } = - ops.op_webgpu_compute_pipeline_get_bind_group_layout( + index = webidl.converters["unsigned long"](index, prefix, "Argument 1"); + const device = assertDevice(this, prefix, "this"); + const computePipelineRid = assertResource(this, prefix, "this"); + const { rid, label, err } = ops + .op_webgpu_compute_pipeline_get_bind_group_layout( computePipelineRid, index, ); @@ -2580,12 +2664,17 @@ class GPUComputePipeline { return bindGroupLayout; } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - label: this.label, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPUComputePipelinePrototype, this), + keys: [ + "label", + ], + }), + inspectOptions, + ); } } GPUObjectBaseMixin("GPUComputePipeline", GPUComputePipeline); @@ -2631,18 +2720,12 @@ class GPURenderPipeline { webidl.assertBranded(this, GPURenderPipelinePrototype); const prefix = "Failed to execute 'getBindGroupLayout' on 'GPURenderPipeline'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - index = webidl.converters["unsigned long"](index, { - prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const renderPipelineRid = assertResource(this, { - prefix, - context: "this", - }); - const { rid, label, err } = - ops.op_webgpu_render_pipeline_get_bind_group_layout( + webidl.requiredArguments(arguments.length, 1, prefix); + index = webidl.converters["unsigned long"](index, prefix, "Argument 1"); + const device = assertDevice(this, prefix, "this"); + const renderPipelineRid = assertResource(this, prefix, "this"); + const { rid, label, err } = ops + .op_webgpu_render_pipeline_get_bind_group_layout( renderPipelineRid, index, ); @@ -2657,12 +2740,17 @@ class GPURenderPipeline { return bindGroupLayout; } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - label: this.label, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPURenderPipelinePrototype, this), + keys: [ + "label", + ], + }), + inspectOptions, + ); } } GPUObjectBaseMixin("GPURenderPipeline", GPURenderPipeline); @@ -2740,16 +2828,14 @@ class GPUCommandEncoder { beginRenderPass(descriptor) { webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'beginRenderPass' on 'GPUCommandEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - descriptor = webidl.converters.GPURenderPassDescriptor(descriptor, { - prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const commandEncoderRid = assertResource(this, { + webidl.requiredArguments(arguments.length, 1, prefix); + descriptor = webidl.converters.GPURenderPassDescriptor( + descriptor, prefix, - context: "this", - }); + "Argument 1", + ); + const device = assertDevice(this, prefix, "this"); + const commandEncoderRid = assertResource(this, prefix, "this"); if (this[_rid] === undefined) { throw new DOMException( @@ -2760,19 +2846,23 @@ class GPUCommandEncoder { let depthStencilAttachment; if (descriptor.depthStencilAttachment) { - if (descriptor.depthStencilAttachment.depthLoadOp === "clear" && !("depthClearValue" in descriptor.depthStencilAttachment)) { + if ( + descriptor.depthStencilAttachment.depthLoadOp === "clear" && + !("depthClearValue" in descriptor.depthStencilAttachment) + ) { throw webidl.makeException( TypeError, - "`depthClearValue` must be specified when `depthLoadOp` is \"clear\"", + '`depthClearValue` must be specified when `depthLoadOp` is "clear"', prefix, "Argument 1", ); } - const view = assertResource(descriptor.depthStencilAttachment.view, { + const view = assertResource( + descriptor.depthStencilAttachment.view, prefix, - context: "texture view for depth stencil attachment", - }); + "texture view for depth stencil attachment", + ); assertDeviceMatch( device, descriptor.depthStencilAttachment.view[_texture], @@ -2792,14 +2882,16 @@ class GPUCommandEncoder { descriptor.colorAttachments, (colorAttachment, i) => { const context = `color attachment ${i + 1}`; - const view = assertResource(colorAttachment.view, { + const view = assertResource( + colorAttachment.view, prefix, - context: `texture view for ${context}`, - }); - assertResource(colorAttachment.view[_texture], { + `texture view for ${context}`, + ); + assertResource( + colorAttachment.view[_texture], prefix, - context: `texture backing texture view for ${context}`, - }); + `texture backing texture view for ${context}`, + ); assertDeviceMatch( device, colorAttachment.view[_texture], @@ -2813,16 +2905,10 @@ class GPUCommandEncoder { if (colorAttachment.resolveTarget) { resolveTarget = assertResource( colorAttachment.resolveTarget, - { - prefix, - context: `resolve target texture view for ${context}`, - }, - ); - assertResource(colorAttachment.resolveTarget[_texture], { prefix, - context: - `texture backing resolve target texture view for ${context}`, - }); + `resolve target texture view for ${context}`, + ); + assertResource(colorAttachment.resolveTarget[_texture], prefix, `texture backing resolve target texture view for ${context}`); assertDeviceMatch( device, colorAttachment.resolveTarget[_texture], @@ -2843,26 +2929,25 @@ class GPUCommandEncoder { }, ); - const occlusionQuerySet = assertResource( + let occlusionQuerySet; + + if (descriptor.occlusionQuerySet) { + occlusionQuerySet = assertResource( descriptor.occlusionQuerySet, - { - prefix, - context: "occlusionQuerySet", - }, - ); + prefix, + "occlusionQuerySet", + ); + } let timestampWrites = null; if (descriptor.timestampWrites) { - const querySet = assertResource(descriptor.querySet, { - prefix, - context: "querySet", - }); + const querySet = assertResource(descriptor.timestampWrites.querySet, prefix, "querySet"); timestampWrites = { querySet, - beginningOfPassWriteIndex: descriptor.beginningOfPassWriteIndex, - endOfPassWriteIndex: descriptor.endOfPassWriteIndex, - } + beginningOfPassWriteIndex: descriptor.timestampWrites.beginningOfPassWriteIndex, + endOfPassWriteIndex: descriptor.timestampWrites.endOfPassWriteIndex, + }; } const { rid } = ops.op_webgpu_command_encoder_begin_render_pass( @@ -2890,29 +2975,24 @@ class GPUCommandEncoder { webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'beginComputePass' on 'GPUCommandEncoder'"; - descriptor = webidl.converters.GPUComputePassDescriptor(descriptor, { + descriptor = webidl.converters.GPUComputePassDescriptor( + descriptor, prefix, - context: "Argument 1", - }); + "Argument 1", + ); - assertDevice(this, { prefix, context: "this" }); - const commandEncoderRid = assertResource(this, { - prefix, - context: "this", - }); + assertDevice(this, prefix, "this"); + const commandEncoderRid = assertResource(this, prefix, "this"); let timestampWrites = null; if (descriptor.timestampWrites) { - const querySet = assertResource(descriptor.querySet, { - prefix, - context: "querySet", - }); + const querySet = assertResource(descriptor.timestampWrites.querySet, prefix, "querySet"); timestampWrites = { querySet, - beginningOfPassWriteIndex: descriptor.beginningOfPassWriteIndex, - endOfPassWriteIndex: descriptor.endOfPassWriteIndex, - } + beginningOfPassWriteIndex: descriptor.timestampWrites.beginningOfPassWriteIndex, + endOfPassWriteIndex: descriptor.timestampWrites.endOfPassWriteIndex, + }; } const { rid } = ops.op_webgpu_command_encoder_begin_compute_pass( @@ -2947,45 +3027,33 @@ class GPUCommandEncoder { webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'copyBufferToBuffer' on 'GPUCommandEncoder'"; - webidl.requiredArguments(arguments.length, 5, { prefix }); - source = webidl.converters.GPUBuffer(source, { - prefix, - context: "Argument 1", - }); - sourceOffset = webidl.converters.GPUSize64(sourceOffset, { - prefix, - context: "Argument 2", - }); - destination = webidl.converters.GPUBuffer(destination, { - prefix, - context: "Argument 3", - }); - destinationOffset = webidl.converters.GPUSize64(destinationOffset, { - prefix, - context: "Argument 4", - }); - size = webidl.converters.GPUSize64(size, { + webidl.requiredArguments(arguments.length, 5, prefix); + source = webidl.converters.GPUBuffer(source, prefix, "Argument 1"); + sourceOffset = webidl.converters.GPUSize64( + sourceOffset, prefix, - context: "Argument 5", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const commandEncoderRid = assertResource(this, { + "Argument 2", + ); + destination = webidl.converters.GPUBuffer( + destination, prefix, - context: "this", - }); - const sourceRid = assertResource(source, { + "Argument 3", + ); + destinationOffset = webidl.converters.GPUSize64( + destinationOffset, prefix, - context: "Argument 1", - }); + "Argument 4", + ); + size = webidl.converters.GPUSize64(size, prefix, "Argument 5"); + const device = assertDevice(this, prefix, "this"); + const commandEncoderRid = assertResource(this, prefix, "this"); + const sourceRid = assertResource(source, prefix, "Argument 1"); assertDeviceMatch(device, source, { prefix, resourceContext: "Argument 1", selfContext: "this", }); - const destinationRid = assertResource(destination, { - prefix, - context: "Argument 3", - }); + const destinationRid = assertResource(destination, prefix, "Argument 3"); assertDeviceMatch(device, destination, { prefix, resourceContext: "Argument 3", @@ -3012,37 +3080,31 @@ class GPUCommandEncoder { webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'copyBufferToTexture' on 'GPUCommandEncoder'"; - webidl.requiredArguments(arguments.length, 3, { prefix }); - source = webidl.converters.GPUImageCopyBuffer(source, { - prefix, - context: "Argument 1", - }); - destination = webidl.converters.GPUImageCopyTexture(destination, { - prefix, - context: "Argument 2", - }); - copySize = webidl.converters.GPUExtent3D(copySize, { + webidl.requiredArguments(arguments.length, 3, prefix); + source = webidl.converters.GPUImageCopyBuffer(source, prefix, "Argument 1"); + destination = webidl.converters.GPUImageCopyTexture( + destination, prefix, - context: "Argument 3", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const commandEncoderRid = assertResource(this, { - prefix, - context: "this", - }); - const sourceBufferRid = assertResource(source.buffer, { + "Argument 2", + ); + copySize = webidl.converters.GPUExtent3D(copySize, prefix, "Argument 3"); + const device = assertDevice(this, prefix, "this"); + const commandEncoderRid = assertResource(this, prefix, "this"); + const sourceBufferRid = assertResource( + source.buffer, prefix, - context: "source in Argument 1", - }); + "source in Argument 1", + ); assertDeviceMatch(device, source.buffer, { prefix, resourceContext: "source in Argument 1", selfContext: "this", }); - const destinationTextureRid = assertResource(destination.texture, { + const destinationTextureRid = assertResource( + destination.texture, prefix, - context: "texture in Argument 2", - }); + "texture in Argument 2", + ); assertDeviceMatch(device, destination.texture, { prefix, resourceContext: "texture in Argument 2", @@ -3077,37 +3139,35 @@ class GPUCommandEncoder { webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'copyTextureToBuffer' on 'GPUCommandEncoder'"; - webidl.requiredArguments(arguments.length, 3, { prefix }); - source = webidl.converters.GPUImageCopyTexture(source, { - prefix, - context: "Argument 1", - }); - destination = webidl.converters.GPUImageCopyBuffer(destination, { - prefix, - context: "Argument 2", - }); - copySize = webidl.converters.GPUExtent3D(copySize, { + webidl.requiredArguments(arguments.length, 3, prefix); + source = webidl.converters.GPUImageCopyTexture( + source, prefix, - context: "Argument 3", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const commandEncoderRid = assertResource(this, { + "Argument 1", + ); + destination = webidl.converters.GPUImageCopyBuffer( + destination, prefix, - context: "this", - }); - const sourceTextureRid = assertResource(source.texture, { + "Argument 2", + ); + copySize = webidl.converters.GPUExtent3D(copySize, prefix, "Argument 3"); + const device = assertDevice(this, prefix, "this"); + const commandEncoderRid = assertResource(this, prefix, "this"); + const sourceTextureRid = assertResource( + source.texture, prefix, - context: "texture in Argument 1", - }); + "texture in Argument 1", + ); assertDeviceMatch(device, source.texture, { prefix, resourceContext: "texture in Argument 1", selfContext: "this", }); - const destinationBufferRid = assertResource(destination.buffer, { + const destinationBufferRid = assertResource( + destination.buffer, prefix, - context: "buffer in Argument 2", - }); + "buffer in Argument 2", + ); assertDeviceMatch(device, destination.buffer, { prefix, resourceContext: "buffer in Argument 2", @@ -3118,9 +3178,7 @@ class GPUCommandEncoder { { texture: sourceTextureRid, mipLevel: source.mipLevel, - origin: source.origin - ? normalizeGPUOrigin3D(source.origin) - : undefined, + origin: source.origin ? normalizeGPUOrigin3D(source.origin) : undefined, aspect: source.aspect, }, { @@ -3141,37 +3199,35 @@ class GPUCommandEncoder { webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'copyTextureToTexture' on 'GPUCommandEncoder'"; - webidl.requiredArguments(arguments.length, 3, { prefix }); - source = webidl.converters.GPUImageCopyTexture(source, { - prefix, - context: "Argument 1", - }); - destination = webidl.converters.GPUImageCopyTexture(destination, { + webidl.requiredArguments(arguments.length, 3, prefix); + source = webidl.converters.GPUImageCopyTexture( + source, prefix, - context: "Argument 2", - }); - copySize = webidl.converters.GPUExtent3D(copySize, { - prefix, - context: "Argument 3", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const commandEncoderRid = assertResource(this, { + "Argument 1", + ); + destination = webidl.converters.GPUImageCopyTexture( + destination, prefix, - context: "this", - }); - const sourceTextureRid = assertResource(source.texture, { + "Argument 2", + ); + copySize = webidl.converters.GPUExtent3D(copySize, prefix, "Argument 3"); + const device = assertDevice(this, prefix, "this"); + const commandEncoderRid = assertResource(this, prefix, "this"); + const sourceTextureRid = assertResource( + source.texture, prefix, - context: "texture in Argument 1", - }); + "texture in Argument 1", + ); assertDeviceMatch(device, source.texture, { prefix, resourceContext: "texture in Argument 1", selfContext: "this", }); - const destinationTextureRid = assertResource(destination.texture, { + const destinationTextureRid = assertResource( + destination.texture, prefix, - context: "texture in Argument 2", - }); + "texture in Argument 2", + ); assertDeviceMatch(device, destination.texture, { prefix, resourceContext: "texture in Argument 2", @@ -3182,9 +3238,7 @@ class GPUCommandEncoder { { texture: sourceTextureRid, mipLevel: source.mipLevel, - origin: source.origin - ? normalizeGPUOrigin3D(source.origin) - : undefined, + origin: source.origin ? normalizeGPUOrigin3D(source.origin) : undefined, aspect: source.aspect, }, { @@ -3208,28 +3262,13 @@ class GPUCommandEncoder { clearBuffer(buffer, offset = 0, size = undefined) { webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'clearBuffer' on 'GPUCommandEncoder'"; - webidl.requiredArguments(arguments.length, 3, { prefix }); - buffer = webidl.converters.GPUBuffer(buffer, { - prefix, - context: "Argument 1", - }); - offset = webidl.converters.GPUSize64(offset, { - prefix, - context: "Argument 2", - }); - size = webidl.converters.GPUSize64(size, { - prefix, - context: "Argument 3", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const commandEncoderRid = assertResource(this, { - prefix, - context: "this", - }); - const bufferRid = assertResource(buffer, { - prefix, - context: "Argument 1", - }); + webidl.requiredArguments(arguments.length, 3, prefix); + buffer = webidl.converters.GPUBuffer(buffer, prefix, "Argument 1"); + offset = webidl.converters.GPUSize64(offset, prefix, "Argument 2"); + size = webidl.converters.GPUSize64(size, prefix, "Argument 3"); + const device = assertDevice(this, prefix, "this"); + const commandEncoderRid = assertResource(this, prefix, "this"); + const bufferRid = assertResource(buffer, prefix, "Argument 1"); const { err } = ops.op_webgpu_command_encoder_clear_buffer( commandEncoderRid, bufferRid, @@ -3245,16 +3284,10 @@ class GPUCommandEncoder { pushDebugGroup(groupLabel) { webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'pushDebugGroup' on 'GPUCommandEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - groupLabel = webidl.converters.USVString(groupLabel, { - prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const commandEncoderRid = assertResource(this, { - prefix, - context: "this", - }); + webidl.requiredArguments(arguments.length, 1, prefix); + groupLabel = webidl.converters.USVString(groupLabel, prefix, "Argument 1"); + const device = assertDevice(this, prefix, "this"); + const commandEncoderRid = assertResource(this, prefix, "this"); const { err } = ops.op_webgpu_command_encoder_push_debug_group( commandEncoderRid, groupLabel, @@ -3265,11 +3298,8 @@ class GPUCommandEncoder { popDebugGroup() { webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'popDebugGroup' on 'GPUCommandEncoder'"; - const device = assertDevice(this, { prefix, context: "this" }); - const commandEncoderRid = assertResource(this, { - prefix, - context: "this", - }); + const device = assertDevice(this, prefix, "this"); + const commandEncoderRid = assertResource(this, prefix, "this"); const { err } = ops.op_webgpu_command_encoder_pop_debug_group( commandEncoderRid, ); @@ -3283,16 +3313,14 @@ class GPUCommandEncoder { webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'insertDebugMarker' on 'GPUCommandEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - markerLabel = webidl.converters.USVString(markerLabel, { - prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const commandEncoderRid = assertResource(this, { + webidl.requiredArguments(arguments.length, 1, prefix); + markerLabel = webidl.converters.USVString( + markerLabel, prefix, - context: "this", - }); + "Argument 1", + ); + const device = assertDevice(this, prefix, "this"); + const commandEncoderRid = assertResource(this, prefix, "this"); const { err } = ops.op_webgpu_command_encoder_insert_debug_marker( commandEncoderRid, markerLabel, @@ -3307,24 +3335,12 @@ class GPUCommandEncoder { writeTimestamp(querySet, queryIndex) { webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'writeTimestamp' on 'GPUCommandEncoder'"; - webidl.requiredArguments(arguments.length, 2, { prefix }); - querySet = webidl.converters.GPUQuerySet(querySet, { - prefix, - context: "Argument 1", - }); - queryIndex = webidl.converters.GPUSize32(queryIndex, { - prefix, - context: "Argument 2", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const commandEncoderRid = assertResource(this, { - prefix, - context: "this", - }); - const querySetRid = assertResource(querySet, { - prefix, - context: "Argument 1", - }); + webidl.requiredArguments(arguments.length, 2, prefix); + querySet = webidl.converters.GPUQuerySet(querySet, prefix, "Argument 1"); + queryIndex = webidl.converters.GPUSize32(queryIndex, prefix, "Argument 2"); + const device = assertDevice(this, prefix, "this"); + const commandEncoderRid = assertResource(this, prefix, "this"); + const querySetRid = assertResource(querySet, prefix, "Argument 1"); assertDeviceMatch(device, querySet, { prefix, resourceContext: "Argument 1", @@ -3355,44 +3371,28 @@ class GPUCommandEncoder { webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'resolveQuerySet' on 'GPUCommandEncoder'"; webidl.requiredArguments(arguments.length, 5, { prefix }); - querySet = webidl.converters.GPUQuerySet(querySet, { - prefix, - context: "Argument 1", - }); - firstQuery = webidl.converters.GPUSize32(firstQuery, { - prefix, - context: "Argument 2", - }); - queryCount = webidl.converters.GPUSize32(queryCount, { - prefix, - context: "Argument 3", - }); - destination = webidl.converters.GPUBuffer(destination, { + querySet = webidl.converters.GPUQuerySet(querySet, prefix, "Argument 1"); + firstQuery = webidl.converters.GPUSize32(firstQuery, prefix, "Argument 2"); + queryCount = webidl.converters.GPUSize32(queryCount, prefix, "Argument 3"); + destination = webidl.converters.GPUBuffer( + destination, prefix, - context: "Argument 4", - }); - destinationOffset = webidl.converters.GPUSize64(destinationOffset, { - prefix, - context: "Argument 5", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const commandEncoderRid = assertResource(this, { - prefix, - context: "this", - }); - const querySetRid = assertResource(querySet, { + "Argument 4", + ); + destinationOffset = webidl.converters.GPUSize64( + destinationOffset, prefix, - context: "Argument 1", - }); + "Argument 5", + ); + const device = assertDevice(this, prefix, "this"); + const commandEncoderRid = assertResource(this, prefix, "this"); + const querySetRid = assertResource(querySet, prefix, "Argument 1"); assertDeviceMatch(device, querySet, { prefix, resourceContext: "Argument 1", selfContext: "this", }); - const destinationRid = assertResource(destination, { - prefix, - context: "Argument 3", - }); + const destinationRid = assertResource(destination, prefix, "Argument 3"); assertDeviceMatch(device, destination, { prefix, resourceContext: "Argument 3", @@ -3416,15 +3416,13 @@ class GPUCommandEncoder { finish(descriptor = {}) { webidl.assertBranded(this, GPUCommandEncoderPrototype); const prefix = "Failed to execute 'finish' on 'GPUCommandEncoder'"; - descriptor = webidl.converters.GPUCommandBufferDescriptor(descriptor, { - prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const commandEncoderRid = assertResource(this, { + descriptor = webidl.converters.GPUCommandBufferDescriptor( + descriptor, prefix, - context: "this", - }); + "Argument 1", + ); + const device = assertDevice(this, prefix, "this"); + const commandEncoderRid = assertResource(this, prefix, "this"); const { rid, err } = ops.op_webgpu_command_encoder_finish( commandEncoderRid, descriptor.label, @@ -3442,12 +3440,17 @@ class GPUCommandEncoder { return commandBuffer; } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - label: this.label, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPUCommandEncoderPrototype, this), + keys: [ + "label", + ], + }), + inspectOptions, + ); } } GPUObjectBaseMixin("GPUCommandEncoder", GPUCommandEncoder); @@ -3499,30 +3502,15 @@ class GPURenderPassEncoder { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'setViewport' on 'GPUComputePassEncoder'"; webidl.requiredArguments(arguments.length, 6, { prefix }); - x = webidl.converters.float(x, { prefix, context: "Argument 1" }); - y = webidl.converters.float(y, { prefix, context: "Argument 2" }); - width = webidl.converters.float(width, { prefix, context: "Argument 3" }); - height = webidl.converters.float(height, { - prefix, - context: "Argument 4", - }); - minDepth = webidl.converters.float(minDepth, { - prefix, - context: "Argument 5", - }); - maxDepth = webidl.converters.float(maxDepth, { - prefix, - context: "Argument 6", - }); - assertDevice(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); + x = webidl.converters.float(x, prefix, "Argument 1"); + y = webidl.converters.float(y, prefix, "Argument 2"); + width = webidl.converters.float(width, prefix, "Argument 3"); + height = webidl.converters.float(height, prefix, "Argument 4"); + minDepth = webidl.converters.float(minDepth, prefix, "Argument 5"); + maxDepth = webidl.converters.float(maxDepth, prefix, "Argument 6"); + assertDevice(this[_encoder], prefix, "encoder referenced by this"); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const renderPassRid = assertResource(this, prefix, "this"); ops.op_webgpu_render_pass_set_viewport({ renderPassRid, x, @@ -3544,32 +3532,18 @@ class GPURenderPassEncoder { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'setScissorRect' on 'GPUComputePassEncoder'"; - webidl.requiredArguments(arguments.length, 4, { prefix }); - x = webidl.converters.GPUIntegerCoordinate(x, { - prefix, - context: "Argument 1", - }); - y = webidl.converters.GPUIntegerCoordinate(y, { - prefix, - context: "Argument 2", - }); - width = webidl.converters.GPUIntegerCoordinate(width, { - prefix, - context: "Argument 3", - }); - height = webidl.converters.GPUIntegerCoordinate(height, { - prefix, - context: "Argument 4", - }); - assertDevice(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { + webidl.requiredArguments(arguments.length, 4, prefix); + x = webidl.converters.GPUIntegerCoordinate(x, prefix, "Argument 1"); + y = webidl.converters.GPUIntegerCoordinate(y, prefix, "Argument 2"); + width = webidl.converters.GPUIntegerCoordinate(width, prefix, "Argument 3"); + height = webidl.converters.GPUIntegerCoordinate( + height, prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); + "Argument 4", + ); + assertDevice(this[_encoder], prefix, "encoder referenced by this"); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const renderPassRid = assertResource(this, prefix, "this"); ops.op_webgpu_render_pass_set_scissor_rect( renderPassRid, x, @@ -3586,20 +3560,11 @@ class GPURenderPassEncoder { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'setBlendConstant' on 'GPUComputePassEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - color = webidl.converters.GPUColor(color, { - prefix, - context: "Argument 1", - }); - assertDevice(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); + webidl.requiredArguments(arguments.length, 1, prefix); + color = webidl.converters.GPUColor(color, prefix, "Argument 1"); + assertDevice(this[_encoder], prefix, "encoder referenced by this"); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const renderPassRid = assertResource(this, prefix, "this"); ops.op_webgpu_render_pass_set_blend_constant( renderPassRid, normalizeGPUColor(color), @@ -3613,20 +3578,15 @@ class GPURenderPassEncoder { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'setStencilReference' on 'GPUComputePassEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - reference = webidl.converters.GPUStencilValue(reference, { - prefix, - context: "Argument 1", - }); - assertDevice(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { + webidl.requiredArguments(arguments.length, 1, prefix); + reference = webidl.converters.GPUStencilValue( + reference, prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); + "Argument 1", + ); + assertDevice(this[_encoder], prefix, "encoder referenced by this"); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const renderPassRid = assertResource(this, prefix, "this"); ops.op_webgpu_render_pass_set_stencil_reference( renderPassRid, reference, @@ -3640,20 +3600,11 @@ class GPURenderPassEncoder { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'beginOcclusionQuery' on 'GPUComputePassEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - queryIndex = webidl.converters.GPUSize32(queryIndex, { - prefix, - context: "Argument 1", - }); - assertDevice(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); + webidl.requiredArguments(arguments.length, 1, prefix); + queryIndex = webidl.converters.GPUSize32(queryIndex, prefix, "Argument 1"); + assertDevice(this[_encoder], prefix, "encoder referenced by this"); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const renderPassRid = assertResource(this, prefix, "this"); ops.op_webgpu_render_pass_begin_occlusion_query( renderPassRid, queryIndex, @@ -3664,15 +3615,9 @@ class GPURenderPassEncoder { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'endOcclusionQuery' on 'GPUComputePassEncoder'"; - assertDevice(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); + assertDevice(this[_encoder], prefix, "encoder referenced by this"); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const renderPassRid = assertResource(this, prefix, "this"); ops.op_webgpu_render_pass_end_occlusion_query(renderPassRid); } @@ -3683,23 +3628,22 @@ class GPURenderPassEncoder { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'executeBundles' on 'GPURenderPassEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - bundles = webidl.converters["sequence"](bundles, { - prefix, - context: "Argument 1", - }); - const device = assertDevice(this[_encoder], { + webidl.requiredArguments(arguments.length, 1, prefix); + bundles = webidl.converters["sequence"]( + bundles, prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { + "Argument 1", + ); + const device = assertDevice( + this[_encoder], prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); + "encoder referenced by this", + ); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const renderPassRid = assertResource(this, prefix, "this"); const bundleRids = ArrayPrototypeMap(bundles, (bundle, i) => { const context = `bundle ${i + 1}`; - const rid = assertResource(bundle, { prefix, context }); + const rid = assertResource(bundle, prefix, context); assertDeviceMatch(device, bundle, { prefix, resourceContext: context, @@ -3713,15 +3657,17 @@ class GPURenderPassEncoder { end() { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'end' on 'GPURenderPassEncoder'"; - const device = assertDevice(this[_encoder], { + const device = assertDevice( + this[_encoder], prefix, - context: "encoder referenced by this", - }); - const commandEncoderRid = assertResource(this[_encoder], { + "encoder referenced by this", + ); + const commandEncoderRid = assertResource( + this[_encoder], prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); + "encoder referenced by this", + ); + const renderPassRid = assertResource(this, prefix, "this"); const { err } = ops.op_webgpu_render_pass_end( commandEncoderRid, renderPassRid, @@ -3740,19 +3686,14 @@ class GPURenderPassEncoder { ) { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'setBindGroup' on 'GPURenderPassEncoder'"; - const device = assertDevice(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); - const bindGroupRid = assertResource(bindGroup, { + const device = assertDevice( + this[_encoder], prefix, - context: "Argument 2", - }); + "encoder referenced by this", + ); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const renderPassRid = assertResource(this, prefix, "this"); + const bindGroupRid = assertResource(bindGroup, prefix, "Argument 2"); assertDeviceMatch(device, bindGroup, { prefix, resourceContext: "Argument 2", @@ -3785,20 +3726,11 @@ class GPURenderPassEncoder { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'pushDebugGroup' on 'GPURenderPassEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - groupLabel = webidl.converters.USVString(groupLabel, { - prefix, - context: "Argument 1", - }); - assertDevice(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); + webidl.requiredArguments(arguments.length, 1, prefix); + groupLabel = webidl.converters.USVString(groupLabel, prefix, "Argument 1"); + assertDevice(this[_encoder], prefix, "encoder referenced by this"); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const renderPassRid = assertResource(this, prefix, "this"); ops.op_webgpu_render_pass_push_debug_group(renderPassRid, groupLabel); } @@ -3806,15 +3738,9 @@ class GPURenderPassEncoder { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'popDebugGroup' on 'GPURenderPassEncoder'"; - assertDevice(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); + assertDevice(this[_encoder], prefix, "encoder referenced by this"); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const renderPassRid = assertResource(this, prefix, "this"); ops.op_webgpu_render_pass_pop_debug_group(renderPassRid); } @@ -3825,20 +3751,15 @@ class GPURenderPassEncoder { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'insertDebugMarker' on 'GPURenderPassEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - markerLabel = webidl.converters.USVString(markerLabel, { - prefix, - context: "Argument 1", - }); - assertDevice(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { + webidl.requiredArguments(arguments.length, 1, prefix); + markerLabel = webidl.converters.USVString( + markerLabel, prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); + "Argument 1", + ); + assertDevice(this[_encoder], prefix, "encoder referenced by this"); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const renderPassRid = assertResource(this, prefix, "this"); ops.op_webgpu_render_pass_insert_debug_marker(renderPassRid, markerLabel); } @@ -3848,24 +3769,20 @@ class GPURenderPassEncoder { setPipeline(pipeline) { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'setPipeline' on 'GPURenderPassEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - pipeline = webidl.converters.GPURenderPipeline(pipeline, { - prefix, - context: "Argument 1", - }); - const device = assertDevice(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { + webidl.requiredArguments(arguments.length, 1, prefix); + pipeline = webidl.converters.GPURenderPipeline( + pipeline, prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); - const pipelineRid = assertResource(pipeline, { + "Argument 1", + ); + const device = assertDevice( + this[_encoder], prefix, - context: "Argument 1", - }); + "encoder referenced by this", + ); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const renderPassRid = assertResource(this, prefix, "this"); + const pipelineRid = assertResource(pipeline, prefix, "Argument 1"); assertDeviceMatch(device, pipeline, { prefix, resourceContext: "Argument 1", @@ -3884,38 +3801,25 @@ class GPURenderPassEncoder { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'setIndexBuffer' on 'GPURenderPassEncoder'"; - webidl.requiredArguments(arguments.length, 2, { prefix }); - buffer = webidl.converters.GPUBuffer(buffer, { - prefix, - context: "Argument 1", - }); - indexFormat = webidl.converters.GPUIndexFormat(indexFormat, { - prefix, - context: "Argument 2", - }); - offset = webidl.converters.GPUSize64(offset, { + webidl.requiredArguments(arguments.length, 2, prefix); + buffer = webidl.converters.GPUBuffer(buffer, prefix, "Argument 1"); + indexFormat = webidl.converters.GPUIndexFormat( + indexFormat, prefix, - context: "Argument 3", - }); + "Argument 2", + ); + offset = webidl.converters.GPUSize64(offset, prefix, "Argument 3"); if (size !== undefined) { - size = webidl.converters.GPUSize64(size, { - prefix, - context: "Argument 4", - }); + size = webidl.converters.GPUSize64(size, prefix, "Argument 4"); } - const device = assertDevice(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); - const bufferRid = assertResource(buffer, { + const device = assertDevice( + this[_encoder], prefix, - context: "Argument 1", - }); + "encoder referenced by this", + ); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const renderPassRid = assertResource(this, prefix, "this"); + const bufferRid = assertResource(buffer, prefix, "Argument 1"); assertDeviceMatch(device, buffer, { prefix, resourceContext: "Argument 1", @@ -3940,38 +3844,21 @@ class GPURenderPassEncoder { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'setVertexBuffer' on 'GPURenderPassEncoder'"; - webidl.requiredArguments(arguments.length, 2, { prefix }); - slot = webidl.converters.GPUSize32(slot, { - prefix, - context: "Argument 2", - }); - buffer = webidl.converters.GPUBuffer(buffer, { - prefix, - context: "Argument 2", - }); - offset = webidl.converters.GPUSize64(offset, { - prefix, - context: "Argument 3", - }); + webidl.requiredArguments(arguments.length, 2, prefix); + slot = webidl.converters.GPUSize32(slot, prefix, "Argument 1"); + buffer = webidl.converters.GPUBuffer(buffer, prefix, "Argument 2"); + offset = webidl.converters.GPUSize64(offset, prefix, "Argument 3"); if (size !== undefined) { - size = webidl.converters.GPUSize64(size, { - prefix, - context: "Argument 4", - }); + size = webidl.converters.GPUSize64(size, prefix, "Argument 4"); } - const device = assertDevice(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); - const bufferRid = assertResource(buffer, { + const device = assertDevice( + this[_encoder], prefix, - context: "Argument 2", - }); + "encoder referenced by this", + ); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const renderPassRid = assertResource(this, prefix, "this"); + const bufferRid = assertResource(buffer, prefix, "Argument 2"); assertDeviceMatch(device, buffer, { prefix, resourceContext: "Argument 2", @@ -3995,32 +3882,30 @@ class GPURenderPassEncoder { draw(vertexCount, instanceCount = 1, firstVertex = 0, firstInstance = 0) { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'draw' on 'GPURenderPassEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - vertexCount = webidl.converters.GPUSize32(vertexCount, { - prefix, - context: "Argument 1", - }); - instanceCount = webidl.converters.GPUSize32(instanceCount, { - prefix, - context: "Argument 2", - }); - firstVertex = webidl.converters.GPUSize32(firstVertex, { + webidl.requiredArguments(arguments.length, 1, prefix); + vertexCount = webidl.converters.GPUSize32( + vertexCount, prefix, - context: "Argument 3", - }); - firstInstance = webidl.converters.GPUSize32(firstInstance, { + "Argument 1", + ); + instanceCount = webidl.converters.GPUSize32( + instanceCount, prefix, - context: "Argument 4", - }); - assertDevice(this[_encoder], { + "Argument 2", + ); + firstVertex = webidl.converters.GPUSize32( + firstVertex, prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { + "Argument 3", + ); + firstInstance = webidl.converters.GPUSize32( + firstInstance, prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); + "Argument 4", + ); + assertDevice(this[_encoder], prefix, "encoder referenced by this"); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const renderPassRid = assertResource(this, prefix, "this"); ops.op_webgpu_render_pass_draw( renderPassRid, vertexCount, @@ -4046,36 +3931,27 @@ class GPURenderPassEncoder { ) { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'drawIndexed' on 'GPURenderPassEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - indexCount = webidl.converters.GPUSize32(indexCount, { - prefix, - context: "Argument 1", - }); - instanceCount = webidl.converters.GPUSize32(instanceCount, { - prefix, - context: "Argument 2", - }); - firstIndex = webidl.converters.GPUSize32(firstIndex, { - prefix, - context: "Argument 3", - }); - baseVertex = webidl.converters.GPUSignedOffset32(baseVertex, { - prefix, - context: "Argument 4", - }); - firstInstance = webidl.converters.GPUSize32(firstInstance, { + webidl.requiredArguments(arguments.length, 1, prefix); + indexCount = webidl.converters.GPUSize32(indexCount, prefix, "Argument 1"); + instanceCount = webidl.converters.GPUSize32( + instanceCount, prefix, - context: "Argument 5", - }); - assertDevice(this[_encoder], { + "Argument 2", + ); + firstIndex = webidl.converters.GPUSize32(firstIndex, prefix, "Argument 3"); + baseVertex = webidl.converters.GPUSignedOffset32( + baseVertex, prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { + "Argument 4", + ); + firstInstance = webidl.converters.GPUSize32( + firstInstance, prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); + "Argument 5", + ); + assertDevice(this[_encoder], prefix, "encoder referenced by this"); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const renderPassRid = assertResource(this, prefix, "this"); ops.op_webgpu_render_pass_draw_indexed( renderPassRid, indexCount, @@ -4093,28 +3969,29 @@ class GPURenderPassEncoder { drawIndirect(indirectBuffer, indirectOffset) { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'drawIndirect' on 'GPURenderPassEncoder'"; - webidl.requiredArguments(arguments.length, 2, { prefix }); - indirectBuffer = webidl.converters.GPUBuffer(indirectBuffer, { + webidl.requiredArguments(arguments.length, 2, prefix); + indirectBuffer = webidl.converters.GPUBuffer( + indirectBuffer, prefix, - context: "Argument 1", - }); - indirectOffset = webidl.converters.GPUSize64(indirectOffset, { - prefix, - context: "Argument 2", - }); - const device = assertDevice(this[_encoder], { + "Argument 1", + ); + indirectOffset = webidl.converters.GPUSize64( + indirectOffset, prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { + "Argument 2", + ); + const device = assertDevice( + this[_encoder], prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); - const indirectBufferRid = assertResource(indirectBuffer, { + "encoder referenced by this", + ); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const renderPassRid = assertResource(this, prefix, "this"); + const indirectBufferRid = assertResource( + indirectBuffer, prefix, - context: "Argument 1", - }); + "Argument 1", + ); assertDeviceMatch(device, indirectBuffer, { prefix, resourceContext: "Argument 1", @@ -4135,28 +4012,29 @@ class GPURenderPassEncoder { webidl.assertBranded(this, GPURenderPassEncoderPrototype); const prefix = "Failed to execute 'drawIndexedIndirect' on 'GPURenderPassEncoder'"; - webidl.requiredArguments(arguments.length, 2, { prefix }); - indirectBuffer = webidl.converters.GPUBuffer(indirectBuffer, { - prefix, - context: "Argument 1", - }); - indirectOffset = webidl.converters.GPUSize64(indirectOffset, { + webidl.requiredArguments(arguments.length, 2, prefix); + indirectBuffer = webidl.converters.GPUBuffer( + indirectBuffer, prefix, - context: "Argument 2", - }); - const device = assertDevice(this[_encoder], { + "Argument 1", + ); + indirectOffset = webidl.converters.GPUSize64( + indirectOffset, prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { + "Argument 2", + ); + const device = assertDevice( + this[_encoder], prefix, - context: "encoder referenced by this", - }); - const renderPassRid = assertResource(this, { prefix, context: "this" }); - const indirectBufferRid = assertResource(indirectBuffer, { + "encoder referenced by this", + ); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const renderPassRid = assertResource(this, prefix, "this"); + const indirectBufferRid = assertResource( + indirectBuffer, prefix, - context: "Argument 1", - }); + "Argument 1", + ); assertDeviceMatch(device, indirectBuffer, { prefix, resourceContext: "Argument 1", @@ -4169,12 +4047,17 @@ class GPURenderPassEncoder { ); } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - label: this.label, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPURenderPassEncoderPrototype, this), + keys: [ + "label", + ], + }), + inspectOptions, + ); } } GPUObjectBaseMixin("GPURenderPassEncoder", GPURenderPassEncoder); @@ -4221,24 +4104,20 @@ class GPUComputePassEncoder { setPipeline(pipeline) { webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'setPipeline' on 'GPUComputePassEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - pipeline = webidl.converters.GPUComputePipeline(pipeline, { - prefix, - context: "Argument 1", - }); - const device = assertDevice(this[_encoder], { + webidl.requiredArguments(arguments.length, 1, prefix); + pipeline = webidl.converters.GPUComputePipeline( + pipeline, prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - const computePassRid = assertResource(this, { prefix, context: "this" }); - const pipelineRid = assertResource(pipeline, { + "Argument 1", + ); + const device = assertDevice( + this[_encoder], prefix, - context: "Argument 1", - }); + "encoder referenced by this", + ); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const computePassRid = assertResource(this, prefix, "this"); + const pipelineRid = assertResource(pipeline, prefix, "Argument 1"); assertDeviceMatch(device, pipeline, { prefix, resourceContext: "Argument 1", @@ -4260,28 +4139,25 @@ class GPUComputePassEncoder { webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'dispatchWorkgroups' on 'GPUComputePassEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - workgroupCountX = webidl.converters.GPUSize32(workgroupCountX, { - prefix, - context: "Argument 1", - }); - workgroupCountY = webidl.converters.GPUSize32(workgroupCountY, { - prefix, - context: "Argument 2", - }); - workgroupCountZ = webidl.converters.GPUSize32(workgroupCountZ, { + webidl.requiredArguments(arguments.length, 1, prefix); + workgroupCountX = webidl.converters.GPUSize32( + workgroupCountX, prefix, - context: "Argument 3", - }); - assertDevice(this[_encoder], { + "Argument 1", + ); + workgroupCountY = webidl.converters.GPUSize32( + workgroupCountY, prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { + "Argument 2", + ); + workgroupCountZ = webidl.converters.GPUSize32( + workgroupCountZ, prefix, - context: "encoder referenced by this", - }); - const computePassRid = assertResource(this, { prefix, context: "this" }); + "Argument 3", + ); + assertDevice(this[_encoder], prefix, "encoder referenced by this"); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const computePassRid = assertResource(this, prefix, "this"); ops.op_webgpu_compute_pass_dispatch_workgroups( computePassRid, workgroupCountX, @@ -4298,28 +4174,29 @@ class GPUComputePassEncoder { webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'dispatchWorkgroupsIndirect' on 'GPUComputePassEncoder'"; - webidl.requiredArguments(arguments.length, 2, { prefix }); - indirectBuffer = webidl.converters.GPUBuffer(indirectBuffer, { + webidl.requiredArguments(arguments.length, 2, prefix); + indirectBuffer = webidl.converters.GPUBuffer( + indirectBuffer, prefix, - context: "Argument 1", - }); - indirectOffset = webidl.converters.GPUSize64(indirectOffset, { - prefix, - context: "Argument 2", - }); - const device = assertDevice(this[_encoder], { + "Argument 1", + ); + indirectOffset = webidl.converters.GPUSize64( + indirectOffset, prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { + "Argument 2", + ); + const device = assertDevice( + this[_encoder], prefix, - context: "encoder referenced by this", - }); - const computePassRid = assertResource(this, { prefix, context: "this" }); - const indirectBufferRid = assertResource(indirectBuffer, { + "encoder referenced by this", + ); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const computePassRid = assertResource(this, prefix, "this"); + const indirectBufferRid = assertResource( + indirectBuffer, prefix, - context: "Argument 1", - }); + "Argument 1", + ); assertDeviceMatch(device, indirectBuffer, { prefix, resourceContext: "Argument 1", @@ -4335,15 +4212,17 @@ class GPUComputePassEncoder { end() { webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'end' on 'GPUComputePassEncoder'"; - const device = assertDevice(this[_encoder], { + const device = assertDevice( + this[_encoder], prefix, - context: "encoder referenced by this", - }); - const commandEncoderRid = assertResource(this[_encoder], { + "encoder referenced by this", + ); + const commandEncoderRid = assertResource( + this[_encoder], prefix, - context: "encoder referenced by this", - }); - const computePassRid = assertResource(this, { prefix, context: "this" }); + "encoder referenced by this", + ); + const computePassRid = assertResource(this, prefix, "this"); const { err } = ops.op_webgpu_compute_pass_end( commandEncoderRid, computePassRid, @@ -4363,19 +4242,14 @@ class GPUComputePassEncoder { webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'setBindGroup' on 'GPUComputePassEncoder'"; - const device = assertDevice(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - const computePassRid = assertResource(this, { prefix, context: "this" }); - const bindGroupRid = assertResource(bindGroup, { + const device = assertDevice( + this[_encoder], prefix, - context: "Argument 2", - }); + "encoder referenced by this", + ); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const computePassRid = assertResource(this, prefix, "this"); + const bindGroupRid = assertResource(bindGroup, prefix, "Argument 2"); assertDeviceMatch(device, bindGroup, { prefix, resourceContext: "Argument 2", @@ -4408,20 +4282,11 @@ class GPUComputePassEncoder { webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'pushDebugGroup' on 'GPUComputePassEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - groupLabel = webidl.converters.USVString(groupLabel, { - prefix, - context: "Argument 1", - }); - assertDevice(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - const computePassRid = assertResource(this, { prefix, context: "this" }); + webidl.requiredArguments(arguments.length, 1, prefix); + groupLabel = webidl.converters.USVString(groupLabel, prefix, "Argument 1"); + assertDevice(this[_encoder], prefix, "encoder referenced by this"); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const computePassRid = assertResource(this, prefix, "this"); ops.op_webgpu_compute_pass_push_debug_group(computePassRid, groupLabel); } @@ -4429,15 +4294,9 @@ class GPUComputePassEncoder { webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'popDebugGroup' on 'GPUComputePassEncoder'"; - assertDevice(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - const computePassRid = assertResource(this, { prefix, context: "this" }); + assertDevice(this[_encoder], prefix, "encoder referenced by this"); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const computePassRid = assertResource(this, prefix, "this"); ops.op_webgpu_compute_pass_pop_debug_group(computePassRid); } @@ -4448,32 +4307,32 @@ class GPUComputePassEncoder { webidl.assertBranded(this, GPUComputePassEncoderPrototype); const prefix = "Failed to execute 'insertDebugMarker' on 'GPUComputePassEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - markerLabel = webidl.converters.USVString(markerLabel, { - prefix, - context: "Argument 1", - }); - assertDevice(this[_encoder], { - prefix, - context: "encoder referenced by this", - }); - assertResource(this[_encoder], { + webidl.requiredArguments(arguments.length, 1, prefix); + markerLabel = webidl.converters.USVString( + markerLabel, prefix, - context: "encoder referenced by this", - }); - const computePassRid = assertResource(this, { prefix, context: "this" }); + "Argument 1", + ); + assertDevice(this[_encoder], prefix, "encoder referenced by this"); + assertResource(this[_encoder], prefix, "encoder referenced by this"); + const computePassRid = assertResource(this, prefix, "this"); ops.op_webgpu_compute_pass_insert_debug_marker( computePassRid, markerLabel, ); } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - label: this.label, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPUComputePassEncoderPrototype, this), + keys: [ + "label", + ], + }), + inspectOptions, + ); } } GPUObjectBaseMixin("GPUComputePassEncoder", GPUComputePassEncoder); @@ -4513,15 +4372,21 @@ class GPUCommandBuffer { webidl.illegalConstructor(); } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - label: this.label, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPUCommandBufferPrototype, this), + keys: [ + "label", + ], + }), + inspectOptions, + ); } } GPUObjectBaseMixin("GPUCommandBuffer", GPUCommandBuffer); +const GPUCommandBufferPrototype = GPUCommandBuffer.prototype; /** * @param {string | null} label @@ -4563,15 +4428,13 @@ class GPURenderBundleEncoder { finish(descriptor = {}) { webidl.assertBranded(this, GPURenderBundleEncoderPrototype); const prefix = "Failed to execute 'finish' on 'GPURenderBundleEncoder'"; - descriptor = webidl.converters.GPURenderBundleDescriptor(descriptor, { - prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const renderBundleEncoderRid = assertResource(this, { + descriptor = webidl.converters.GPURenderBundleDescriptor( + descriptor, prefix, - context: "this", - }); + "Argument 1", + ); + const device = assertDevice(this, prefix, "this"); + const renderBundleEncoderRid = assertResource(this, prefix, "this"); const { rid, err } = ops.op_webgpu_render_bundle_encoder_finish( renderBundleEncoderRid, descriptor.label, @@ -4599,15 +4462,9 @@ class GPURenderBundleEncoder { webidl.assertBranded(this, GPURenderBundleEncoderPrototype); const prefix = "Failed to execute 'setBindGroup' on 'GPURenderBundleEncoder'"; - const device = assertDevice(this, { prefix, context: "this" }); - const renderBundleEncoderRid = assertResource(this, { - prefix, - context: "this", - }); - const bindGroupRid = assertResource(bindGroup, { - prefix, - context: "Argument 2", - }); + const device = assertDevice(this, prefix, "this"); + const renderBundleEncoderRid = assertResource(this, prefix, "this"); + const bindGroupRid = assertResource(bindGroup, prefix, "Argument 2"); assertDeviceMatch(device, bindGroup, { prefix, resourceContext: "Argument 2", @@ -4640,16 +4497,10 @@ class GPURenderBundleEncoder { webidl.assertBranded(this, GPURenderBundleEncoderPrototype); const prefix = "Failed to execute 'pushDebugGroup' on 'GPURenderBundleEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - groupLabel = webidl.converters.USVString(groupLabel, { - prefix, - context: "Argument 1", - }); - assertDevice(this, { prefix, context: "this" }); - const renderBundleEncoderRid = assertResource(this, { - prefix, - context: "this", - }); + webidl.requiredArguments(arguments.length, 1, prefix); + groupLabel = webidl.converters.USVString(groupLabel, prefix, "Argument 1"); + assertDevice(this, prefix, "this"); + const renderBundleEncoderRid = assertResource(this, prefix, "this"); ops.op_webgpu_render_bundle_encoder_push_debug_group( renderBundleEncoderRid, groupLabel, @@ -4660,11 +4511,8 @@ class GPURenderBundleEncoder { webidl.assertBranded(this, GPURenderBundleEncoderPrototype); const prefix = "Failed to execute 'popDebugGroup' on 'GPURenderBundleEncoder'"; - assertDevice(this, { prefix, context: "this" }); - const renderBundleEncoderRid = assertResource(this, { - prefix, - context: "this", - }); + assertDevice(this, prefix, "this"); + const renderBundleEncoderRid = assertResource(this, prefix, "this"); ops.op_webgpu_render_bundle_encoder_pop_debug_group( renderBundleEncoderRid, ); @@ -4677,16 +4525,14 @@ class GPURenderBundleEncoder { webidl.assertBranded(this, GPURenderBundleEncoderPrototype); const prefix = "Failed to execute 'insertDebugMarker' on 'GPURenderBundleEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - markerLabel = webidl.converters.USVString(markerLabel, { - prefix, - context: "Argument 1", - }); - assertDevice(this, { prefix, context: "this" }); - const renderBundleEncoderRid = assertResource(this, { + webidl.requiredArguments(arguments.length, 1, prefix); + markerLabel = webidl.converters.USVString( + markerLabel, prefix, - context: "this", - }); + "Argument 1", + ); + assertDevice(this, prefix, "this"); + const renderBundleEncoderRid = assertResource(this, prefix, "this"); ops.op_webgpu_render_bundle_encoder_insert_debug_marker( renderBundleEncoderRid, markerLabel, @@ -4700,20 +4546,15 @@ class GPURenderBundleEncoder { webidl.assertBranded(this, GPURenderBundleEncoderPrototype); const prefix = "Failed to execute 'setPipeline' on 'GPURenderBundleEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - pipeline = webidl.converters.GPURenderPipeline(pipeline, { - prefix, - context: "Argument 1", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const renderBundleEncoderRid = assertResource(this, { - prefix, - context: "this", - }); - const pipelineRid = assertResource(pipeline, { + webidl.requiredArguments(arguments.length, 1, prefix); + pipeline = webidl.converters.GPURenderPipeline( + pipeline, prefix, - context: "Argument 1", - }); + "Argument 1", + ); + const device = assertDevice(this, prefix, "this"); + const renderBundleEncoderRid = assertResource(this, prefix, "this"); + const pipelineRid = assertResource(pipeline, prefix, "Argument 1"); assertDeviceMatch(device, pipeline, { prefix, resourceContext: "Argument 1", @@ -4735,32 +4576,18 @@ class GPURenderBundleEncoder { webidl.assertBranded(this, GPURenderBundleEncoderPrototype); const prefix = "Failed to execute 'setIndexBuffer' on 'GPURenderBundleEncoder'"; - webidl.requiredArguments(arguments.length, 2, { prefix }); - buffer = webidl.converters.GPUBuffer(buffer, { - prefix, - context: "Argument 1", - }); - indexFormat = webidl.converters.GPUIndexFormat(indexFormat, { - prefix, - context: "Argument 2", - }); - offset = webidl.converters.GPUSize64(offset, { - prefix, - context: "Argument 3", - }); - size = webidl.converters.GPUSize64(size, { - prefix, - context: "Argument 4", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const renderBundleEncoderRid = assertResource(this, { - prefix, - context: "this", - }); - const bufferRid = assertResource(buffer, { + webidl.requiredArguments(arguments.length, 2, prefix); + buffer = webidl.converters.GPUBuffer(buffer, prefix, "Argument 1"); + indexFormat = webidl.converters.GPUIndexFormat( + indexFormat, prefix, - context: "Argument 1", - }); + "Argument 2", + ); + offset = webidl.converters.GPUSize64(offset, prefix, "Argument 3"); + size = webidl.converters.GPUSize64(size, prefix, "Argument 4"); + const device = assertDevice(this, prefix, "this"); + const renderBundleEncoderRid = assertResource(this, prefix, "this"); + const bufferRid = assertResource(buffer, prefix, "Argument 1"); assertDeviceMatch(device, buffer, { prefix, resourceContext: "Argument 1", @@ -4785,34 +4612,16 @@ class GPURenderBundleEncoder { webidl.assertBranded(this, GPURenderBundleEncoderPrototype); const prefix = "Failed to execute 'setVertexBuffer' on 'GPURenderBundleEncoder'"; - webidl.requiredArguments(arguments.length, 2, { prefix }); - slot = webidl.converters.GPUSize32(slot, { - prefix, - context: "Argument 1", - }); - buffer = webidl.converters.GPUBuffer(buffer, { - prefix, - context: "Argument 2", - }); - offset = webidl.converters.GPUSize64(offset, { - prefix, - context: "Argument 3", - }); + webidl.requiredArguments(arguments.length, 2, prefix); + slot = webidl.converters.GPUSize32(slot, prefix, "Argument 1"); + buffer = webidl.converters.GPUBuffer(buffer, prefix, "Argument 2"); + offset = webidl.converters.GPUSize64(offset, prefix, "Argument 3"); if (size !== undefined) { - size = webidl.converters.GPUSize64(size, { - prefix, - context: "Argument 4", - }); + size = webidl.converters.GPUSize64(size, prefix, "Argument 4"); } - const device = assertDevice(this, { prefix, context: "this" }); - const renderBundleEncoderRid = assertResource(this, { - prefix, - context: "this", - }); - const bufferRid = assertResource(buffer, { - prefix, - context: "Argument 2", - }); + const device = assertDevice(this, prefix, "this"); + const renderBundleEncoderRid = assertResource(this, prefix, "this"); + const bufferRid = assertResource(buffer, prefix, "Argument 2"); assertDeviceMatch(device, buffer, { prefix, resourceContext: "Argument 2", @@ -4836,28 +4645,29 @@ class GPURenderBundleEncoder { draw(vertexCount, instanceCount = 1, firstVertex = 0, firstInstance = 0) { webidl.assertBranded(this, GPURenderBundleEncoderPrototype); const prefix = "Failed to execute 'draw' on 'GPURenderBundleEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - vertexCount = webidl.converters.GPUSize32(vertexCount, { - prefix, - context: "Argument 1", - }); - instanceCount = webidl.converters.GPUSize32(instanceCount, { + webidl.requiredArguments(arguments.length, 1, prefix); + vertexCount = webidl.converters.GPUSize32( + vertexCount, prefix, - context: "Argument 2", - }); - firstVertex = webidl.converters.GPUSize32(firstVertex, { + "Argument 1", + ); + instanceCount = webidl.converters.GPUSize32( + instanceCount, prefix, - context: "Argument 3", - }); - firstInstance = webidl.converters.GPUSize32(firstInstance, { + "Argument 2", + ); + firstVertex = webidl.converters.GPUSize32( + firstVertex, prefix, - context: "Argument 4", - }); - assertDevice(this, { prefix, context: "this" }); - const renderBundleEncoderRid = assertResource(this, { + "Argument 3", + ); + firstInstance = webidl.converters.GPUSize32( + firstInstance, prefix, - context: "this", - }); + "Argument 4", + ); + assertDevice(this, prefix, "this"); + const renderBundleEncoderRid = assertResource(this, prefix, "this"); ops.op_webgpu_render_bundle_encoder_draw( renderBundleEncoderRid, vertexCount, @@ -4884,32 +4694,26 @@ class GPURenderBundleEncoder { webidl.assertBranded(this, GPURenderBundleEncoderPrototype); const prefix = "Failed to execute 'drawIndexed' on 'GPURenderBundleEncoder'"; - webidl.requiredArguments(arguments.length, 1, { prefix }); - indexCount = webidl.converters.GPUSize32(indexCount, { - prefix, - context: "Argument 1", - }); - instanceCount = webidl.converters.GPUSize32(instanceCount, { - prefix, - context: "Argument 2", - }); - firstIndex = webidl.converters.GPUSize32(firstIndex, { - prefix, - context: "Argument 3", - }); - baseVertex = webidl.converters.GPUSignedOffset32(baseVertex, { + webidl.requiredArguments(arguments.length, 1, prefix); + indexCount = webidl.converters.GPUSize32(indexCount, prefix, "Argument 1"); + instanceCount = webidl.converters.GPUSize32( + instanceCount, prefix, - context: "Argument 4", - }); - firstInstance = webidl.converters.GPUSize32(firstInstance, { + "Argument 2", + ); + firstIndex = webidl.converters.GPUSize32(firstIndex, prefix, "Argument 3"); + baseVertex = webidl.converters.GPUSignedOffset32( + baseVertex, prefix, - context: "Argument 5", - }); - assertDevice(this, { prefix, context: "this" }); - const renderBundleEncoderRid = assertResource(this, { + "Argument 4", + ); + firstInstance = webidl.converters.GPUSize32( + firstInstance, prefix, - context: "this", - }); + "Argument 5", + ); + assertDevice(this, prefix, "this"); + const renderBundleEncoderRid = assertResource(this, prefix, "this"); ops.op_webgpu_render_bundle_encoder_draw_indexed( renderBundleEncoderRid, indexCount, @@ -4928,24 +4732,24 @@ class GPURenderBundleEncoder { webidl.assertBranded(this, GPURenderBundleEncoderPrototype); const prefix = "Failed to execute 'drawIndirect' on 'GPURenderBundleEncoder'"; - webidl.requiredArguments(arguments.length, 2, { prefix }); - indirectBuffer = webidl.converters.GPUBuffer(indirectBuffer, { - prefix, - context: "Argument 1", - }); - indirectOffset = webidl.converters.GPUSize64(indirectOffset, { + webidl.requiredArguments(arguments.length, 2, prefix); + indirectBuffer = webidl.converters.GPUBuffer( + indirectBuffer, prefix, - context: "Argument 2", - }); - const device = assertDevice(this, { prefix, context: "this" }); - const renderBundleEncoderRid = assertResource(this, { + "Argument 1", + ); + indirectOffset = webidl.converters.GPUSize64( + indirectOffset, prefix, - context: "this", - }); - const indirectBufferRid = assertResource(indirectBuffer, { + "Argument 2", + ); + const device = assertDevice(this, prefix, "this"); + const renderBundleEncoderRid = assertResource(this, prefix, "this"); + const indirectBufferRid = assertResource( + indirectBuffer, prefix, - context: "Argument 1", - }); + "Argument 1", + ); assertDeviceMatch(device, indirectBuffer, { prefix, resourceContext: "Argument 1", @@ -4958,12 +4762,17 @@ class GPURenderBundleEncoder { ); } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - label: this.label, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPURenderBundleEncoderPrototype, this), + keys: [ + "label", + ], + }), + inspectOptions, + ); } } GPUObjectBaseMixin("GPURenderBundleEncoder", GPURenderBundleEncoder); @@ -5003,16 +4812,21 @@ class GPURenderBundle { webidl.illegalConstructor(); } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - label: this.label, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPURenderBundlePrototype, this), + keys: [ + "label", + ], + }), + inspectOptions, + ); } } GPUObjectBaseMixin("GPURenderBundle", GPURenderBundle); - +const GPURenderBundlePrototype = GPURenderBundle.prototype; /** * @param {string | null} label * @param {InnerGPUDevice} device @@ -5069,24 +4883,26 @@ class GPUQuerySet { this[_count](); } - [SymbolFor("Deno.privateCustomInspect")](inspect) { - return `${this.constructor.name} ${ - inspect({ - label: this.label, - }) - }`; + [SymbolFor("Deno.privateCustomInspect")](inspect, inspectOptions) { + return inspect( + createFilteredInspectProxy({ + object: this, + evaluate: ObjectPrototypeIsPrototypeOf(GPUQuerySetPrototype, this), + keys: [ + "label", + "type", + "count", + ], + }), + inspectOptions, + ); } } GPUObjectBaseMixin("GPUQuerySet", GPUQuerySet); const GPUQuerySetPrototype = GPUQuerySet.prototype; - - - - // Converters - // This needs to be initialized after all of the base classes are implemented, // otherwise their converters might not be available yet. // DICTIONARY: GPUObjectDescriptorBase @@ -6059,8 +5875,7 @@ const dictMembersGPUProgrammableStage = [ }, { key: "constants", - converter: - webidl.converters["record"], + converter: webidl.converters["record"], }, ]; webidl.converters["GPUProgrammableStage"] = webidl.createDictionaryConverter( @@ -6750,24 +6565,25 @@ webidl.converters.GPUComputePassEncoder = webidl.createInterfaceConverter( ); // DICTIONARY: GPUComputePassTimestampWrites -webidl.converters["GPUComputePassTimestampWrites"] = webidl.createDictionaryConverter( - "GPUComputePassTimestampWrites", - [ - { - key: "querySet", - converter: webidl.converters["GPUQuerySet"], - required: true, - }, - { - key: "beginningOfPassWriteIndex", - converter: webidl.converters["GPUSize32"], - }, - { - key: "endOfPassWriteIndex", - converter: webidl.converters["GPUSize32"], - }, - ], -); +webidl.converters["GPUComputePassTimestampWrites"] = webidl + .createDictionaryConverter( + "GPUComputePassTimestampWrites", + [ + { + key: "querySet", + converter: webidl.converters["GPUQuerySet"], + required: true, + }, + { + key: "beginningOfPassWriteIndex", + converter: webidl.converters["GPUSize32"], + }, + { + key: "endOfPassWriteIndex", + converter: webidl.converters["GPUSize32"], + }, + ], + ); // DICTIONARY: GPUComputePassDescriptor const dictMembersGPUComputePassDescriptor = [ @@ -6918,24 +6734,25 @@ webidl.converters.GPUQuerySet = webidl.createInterfaceConverter( ); // DICTIONARY: GPURenderPassTimestampWrites -webidl.converters["GPURenderPassTimestampWrites"] = webidl.createDictionaryConverter( - "GPURenderPassTimestampWrites", - [ - { - key: "querySet", - converter: webidl.converters["GPUQuerySet"], - required: true, - }, - { - key: "beginningOfPassWriteIndex", - converter: webidl.converters["GPUSize32"], - }, - { - key: "endOfPassWriteIndex", - converter: webidl.converters["GPUSize32"], - }, - ], -); +webidl.converters["GPURenderPassTimestampWrites"] = webidl + .createDictionaryConverter( + "GPURenderPassTimestampWrites", + [ + { + key: "querySet", + converter: webidl.converters["GPUQuerySet"], + required: true, + }, + { + key: "beginningOfPassWriteIndex", + converter: webidl.converters["GPUSize32"], + }, + { + key: "endOfPassWriteIndex", + converter: webidl.converters["GPUSize32"], + }, + ], + ); // DICTIONARY: GPURenderPassDescriptor const dictMembersGPURenderPassDescriptor = [ @@ -7143,7 +6960,6 @@ webidl.converters["GPUSignedOffset32"] = (V, opts) => // TYPEDEF: GPUFlagsConstant webidl.converters["GPUFlagsConstant"] = webidl.converters["unsigned long"]; - const gpu = webidl.createBranded(GPU); export { _device, diff --git a/rust-toolchain.toml b/rust-toolchain.toml index e2a6039dba..5436644bf4 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -5,6 +5,6 @@ # to the user in the error, instead of "error: invalid channel name '[toolchain]'". [toolchain] -channel = "1.70" # Needed for deno & cts_runner. Firefox's MSRV is 1.65 +channel = "1.71" # Needed for deno & cts_runner. Firefox's MSRV is 1.65 components = ["rustfmt", "clippy"] targets = ["wasm32-unknown-unknown"] diff --git a/wgpu-hal/src/gles/adapter.rs b/wgpu-hal/src/gles/adapter.rs index 16f4bf9cfb..0e8285240a 100644 --- a/wgpu-hal/src/gles/adapter.rs +++ b/wgpu-hal/src/gles/adapter.rs @@ -787,7 +787,7 @@ impl super::Adapter { // Drop the GL guard so we can move the context into AdapterShared // ( on Wasm the gl handle is just a ref so we tell clippy to allow // dropping the ref ) - #[cfg_attr(target_arch = "wasm32", allow(clippy::drop_ref))] + #[cfg_attr(target_arch = "wasm32", allow(dropping_references))] drop(gl); Some(crate::ExposedAdapter {