From bd5d445da98435d03e2f6a6f6d5478ff623bd714 Mon Sep 17 00:00:00 2001 From: Aaron O'Mullan Date: Mon, 24 Jan 2022 23:47:05 +0100 Subject: chore: re-enable wgpu_sync (#13453) --- ext/webgpu/01_webgpu.js | 49 +++++++++++++++++++++++++++++++++++++++++++------ 1 file changed, 43 insertions(+), 6 deletions(-) (limited to 'ext/webgpu/01_webgpu.js') diff --git a/ext/webgpu/01_webgpu.js b/ext/webgpu/01_webgpu.js index f1d3eb120..45d910c1a 100644 --- a/ext/webgpu/01_webgpu.js +++ b/ext/webgpu/01_webgpu.js @@ -3060,6 +3060,48 @@ device.pushError(err); } + /** + * @param {GPUBuffer} destination + * @param {GPUSize64} destinationOffset + * @param {GPUSize64} size + */ + clearBuffer(destination, destinationOffset, size) { + webidl.assertBranded(this, GPUCommandEncoder); + const prefix = "Failed to execute 'clearBuffer' on 'GPUCommandEncoder'"; + webidl.requiredArguments(arguments.length, 3, { prefix }); + destination = webidl.converters.GPUBuffer(destination, { + prefix, + context: "Argument 1", + }); + destinationOffset = webidl.converters.GPUSize64(destinationOffset, { + 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 destinationRid = assertResource(destination, { + prefix, + context: "Argument 1", + }); + const { err } = core.opSync( + "op_webgpu_command_encoder_clear_buffer", + { + commandEncoderRid, + destinationRid, + destinationOffset, + size, + }, + ); + device.pushError(err); + } + /** * @param {string} groupLabel */ @@ -3203,7 +3245,7 @@ prefix, context: "Argument 3", }); - destination = webidl.converters.GPUQuerySet(destination, { + destination = webidl.converters.GPUBuffer(destination, { prefix, context: "Argument 4", }); @@ -4527,15 +4569,10 @@ webidl.illegalConstructor(); } - get executionTime() { - throw new Error("Not yet implemented"); - } - [SymbolFor("Deno.privateCustomInspect")](inspect) { return `${this.constructor.name} ${ inspect({ label: this.label, - // TODO(crowlKats): executionTime }) }`; } -- cgit v1.2.3