From 451b45ee3a26ed6e393c3deba86937e1a6dc5649 Mon Sep 17 00:00:00 2001 From: Leo Kettmeir Date: Thu, 23 Feb 2023 19:05:50 +0100 Subject: fix(webgpu): don't default to 0 for setVertexBuffer.size & properly use webidl.setlike (#17800) --- ext/webgpu/01_webgpu.js | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) (limited to 'ext/webgpu/01_webgpu.js') diff --git a/ext/webgpu/01_webgpu.js b/ext/webgpu/01_webgpu.js index 3e8e3161e..a310eac2f 100644 --- a/ext/webgpu/01_webgpu.js +++ b/ext/webgpu/01_webgpu.js @@ -618,11 +618,12 @@ function createGPUSupportedFeatures(features) { /** @type {GPUSupportedFeatures} */ const supportedFeatures = webidl.createBranded(GPUSupportedFeatures); supportedFeatures[webidl.setlikeInner] = new Set(features); - return webidl.setlike( + webidl.setlike( supportedFeatures, GPUSupportedFeaturesPrototype, true, ); + return supportedFeatures; } class GPUSupportedFeatures { @@ -4903,14 +4904,14 @@ class GPURenderBundleEncoder { * @param {number} offset * @param {number} size */ - setVertexBuffer(slot, buffer, offset = 0, size = 0) { + setVertexBuffer(slot, buffer, offset = 0, size) { 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 2", + context: "Argument 1", }); buffer = webidl.converters.GPUBuffer(buffer, { prefix, @@ -4920,10 +4921,12 @@ class GPURenderBundleEncoder { prefix, context: "Argument 3", }); - size = webidl.converters.GPUSize64(size, { - prefix, - context: "Argument 4", - }); + if (size !== undefined) { + size = webidl.converters.GPUSize64(size, { + prefix, + context: "Argument 4", + }); + } const device = assertDevice(this, { prefix, context: "this" }); const renderBundleEncoderRid = assertResource(this, { prefix, -- cgit v1.2.3