summaryrefslogtreecommitdiff
path: root/ext/webgpu/02_surface.js
diff options
context:
space:
mode:
authorLeo Kettmeir <crowlkats@toaxl.com>2024-02-06 22:28:32 +0100
committerGitHub <noreply@github.com>2024-02-06 22:28:32 +0100
commitc8b2af8ed1b27822b0e6193b7a82903f54e56d95 (patch)
tree0ea57f0d038552971914d08b95e0dec5d93ef102 /ext/webgpu/02_surface.js
parentc6def993e052626be3933de4299bf4b2eb76e48a (diff)
refactor: use web utils and lazy load utils from core (#22289)
Diffstat (limited to 'ext/webgpu/02_surface.js')
-rw-r--r--ext/webgpu/02_surface.js12
1 files changed, 5 insertions, 7 deletions
diff --git a/ext/webgpu/02_surface.js b/ext/webgpu/02_surface.js
index 94b0a5d54..f35f745af 100644
--- a/ext/webgpu/02_surface.js
+++ b/ext/webgpu/02_surface.js
@@ -22,7 +22,7 @@ const {
import * as webidl from "ext:deno_webidl/00_webidl.js";
import { createFilteredInspectProxy } from "ext:deno_console/01_console.js";
-import { loadWebGPU, webgpu } from "ext:deno_webgpu/00_init.js";
+import { loadWebGPU } from "ext:deno_webgpu/00_init.js";
const _surfaceRid = Symbol("[[surfaceRid]]");
const _configuration = Symbol("[[configuration]]");
@@ -55,7 +55,7 @@ class GPUCanvasContext {
context: "Argument 1",
});
- const { _device, assertDevice } = webgpu;
+ const { _device, assertDevice } = loadWebGPU();
this[_device] = configuration.device[_device];
this[_configuration] = configuration;
const device = assertDevice(this, {
@@ -78,7 +78,7 @@ class GPUCanvasContext {
}
unconfigure() {
- const { _device } = webgpu;
+ const { _device } = loadWebGPU();
webidl.assertBranded(this, GPUCanvasContextPrototype);
@@ -94,7 +94,7 @@ class GPUCanvasContext {
if (this[_configuration] === null) {
throw new DOMException("context is not configured.", "InvalidStateError");
}
- const { createGPUTexture, assertDevice } = webgpu;
+ const { createGPUTexture, assertDevice } = loadWebGPU();
const device = assertDevice(this, { prefix, context: "this" });
@@ -130,7 +130,7 @@ class GPUCanvasContext {
// Required to present the texture; browser don't need this.
[_present]() {
- const { assertDevice } = webgpu;
+ const { assertDevice } = loadWebGPU();
webidl.assertBranded(this, GPUCanvasContextPrototype);
const prefix = "Failed to execute 'present' on 'GPUCanvasContext'";
@@ -160,8 +160,6 @@ const GPUCanvasContextPrototype = GPUCanvasContext.prototype;
function createCanvasContext(options) {
// lazy load webgpu if needed
- loadWebGPU();
-
const canvasContext = webidl.createBranded(GPUCanvasContext);
canvasContext[_surfaceRid] = options.surfaceRid;
canvasContext[_canvas] = options.canvas;