diff options
author | Aaron O'Mullan <aaron.omullan@gmail.com> | 2022-01-19 13:38:51 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-19 13:38:51 +0100 |
commit | 2ab21dafa768b3bb89f9a7f6550648263bc065d1 (patch) | |
tree | 584fbe7660d84a1cd85072412d65dd99610a94da /ext/webgpu/01_webgpu.js | |
parent | 1259a3f48c00e95a8bb0964e4dabfa769a20bcde (diff) |
experiment: wgpu sync (#13402)
Diffstat (limited to 'ext/webgpu/01_webgpu.js')
-rw-r--r-- | ext/webgpu/01_webgpu.js | 51 |
1 files changed, 44 insertions, 7 deletions
diff --git a/ext/webgpu/01_webgpu.js b/ext/webgpu/01_webgpu.js index f1d3eb120..fa412ca17 100644 --- a/ext/webgpu/01_webgpu.js +++ b/ext/webgpu/01_webgpu.js @@ -1,4 +1,4 @@ -// Copyright 2018-2022 the Deno authors. All rights reserved. MIT license. +// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license. // @ts-check /// <reference path="../../core/lib.deno_core.d.ts" /> @@ -3061,6 +3061,48 @@ } /** + * @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 */ pushDebugGroup(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 }) }`; } |