2024-01-05 09:25:01 -05:00
|
|
|
// Copyright 2018-2024 the Deno authors. All rights reserved. MIT license.
|
|
|
|
|
|
|
|
import { core } from "ext:core/mod.js";
|
2024-01-10 17:37:25 -05:00
|
|
|
const {
|
|
|
|
op_lazy_load_esm,
|
|
|
|
} = core.ensureFastOps(true);
|
2024-01-05 09:25:01 -05:00
|
|
|
|
|
|
|
let webgpu;
|
|
|
|
|
|
|
|
function webGPUNonEnumerable(getter) {
|
|
|
|
let valueIsSet = false;
|
|
|
|
let value;
|
|
|
|
|
|
|
|
return {
|
|
|
|
get() {
|
|
|
|
loadWebGPU();
|
|
|
|
|
|
|
|
if (valueIsSet) {
|
|
|
|
return value;
|
|
|
|
} else {
|
|
|
|
return getter();
|
|
|
|
}
|
|
|
|
},
|
|
|
|
set(v) {
|
|
|
|
loadWebGPU();
|
|
|
|
|
|
|
|
valueIsSet = true;
|
|
|
|
value = v;
|
|
|
|
},
|
|
|
|
enumerable: false,
|
|
|
|
configurable: true,
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
function loadWebGPU() {
|
|
|
|
if (!webgpu) {
|
2024-01-10 17:37:25 -05:00
|
|
|
webgpu = op_lazy_load_esm("ext:deno_webgpu/01_webgpu.js");
|
2024-01-05 09:25:01 -05:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
export { loadWebGPU, webgpu, webGPUNonEnumerable };
|