diff options
author | Matt Mastracci <matthew@mastracci.com> | 2023-12-26 18:30:26 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-12-27 02:30:26 +0100 |
commit | 0efe438f7c191d8504355e03b27fe7e3055c9387 (patch) | |
tree | b96fe9a897eb6941c87a95a04520662d26c02fbe /ext/webgpu | |
parent | e33c5eb704c22fad69876e87d9b852a4e5072a7a (diff) |
perf: remove opAsync (#21690)
`opAsync` requires a lookup by name on each async call. This is a
mechanical translation of all opAsync calls to ensureFastOps.
The `opAsync` API on Deno.core will be removed at a later time.
Diffstat (limited to 'ext/webgpu')
-rw-r--r-- | ext/webgpu/01_webgpu.js | 18 |
1 files changed, 10 insertions, 8 deletions
diff --git a/ext/webgpu/01_webgpu.js b/ext/webgpu/01_webgpu.js index 264eaa443..2b5e36e7f 100644 --- a/ext/webgpu/01_webgpu.js +++ b/ext/webgpu/01_webgpu.js @@ -48,6 +48,12 @@ const { Uint32ArrayPrototype, Uint8Array, } = primordials; +const { + op_webgpu_buffer_get_map_async, + op_webgpu_request_adapter, + op_webgpu_request_adapter_info, + op_webgpu_request_device, +} = core.ensureFastOps(); const _rid = Symbol("[[rid]]"); const _size = Symbol("[[size]]"); @@ -253,8 +259,7 @@ class GPU { "Argument 1", ); - const { err, ...data } = await core.opAsync( - "op_webgpu_request_adapter", + const { err, ...data } = await op_webgpu_request_adapter( options.powerPreference, options.forceFallbackAdapter, ); @@ -343,8 +348,7 @@ class GPUAdapter { } } - const { rid, features, limits } = await core.opAsync( - "op_webgpu_request_device", + const { rid, features, limits } = await op_webgpu_request_device( this[_adapter].rid, descriptor.label, requiredFeatures, @@ -382,8 +386,7 @@ class GPUAdapter { architecture, device, description, - } = await core.opAsync( - "op_webgpu_request_adapter_info", + } = await op_webgpu_request_adapter_info( this[_adapter].rid, ); @@ -1949,8 +1952,7 @@ class GPUBuffer { this[_mapMode] = mode; this[_state] = "pending"; const promise = PromisePrototypeThen( - core.opAsync( - "op_webgpu_buffer_get_map_async", + op_webgpu_buffer_get_map_async( bufferRid, device.rid, mode, |