From: Chris Duncan Date: Sun, 12 Jan 2025 08:36:10 +0000 (-0800) Subject: Initial attempt at creating fallback to GL. X-Git-Tag: v1.2.0~15 X-Git-Url: https://zoso.dev/?a=commitdiff_plain;h=c37c57e4bb199d29b54afd1549654646ede5b96c;p=nano-pow.git Initial attempt at creating fallback to GL. --- diff --git a/src/classes/gpu.ts b/src/classes/gpu.ts index 6da7396..c8de386 100644 --- a/src/classes/gpu.ts +++ b/src/classes/gpu.ts @@ -18,9 +18,9 @@ export class NanoPowGpu { static #bindGroupLayout: GPUBindGroupLayout static #pipeline: GPUComputePipeline - static { - this.init() - } + // static { + // this.init() + // } // Initialize WebGPU static async init (): Promise { diff --git a/src/classes/index.ts b/src/classes/index.ts index 525577e..b5330ee 100644 --- a/src/classes/index.ts +++ b/src/classes/index.ts @@ -2,9 +2,13 @@ // SPDX-License-Identifier: GPL-3.0-or-later import { NanoPowGl } from "./gl.js" -import { NanoPowGpu } from "./gpu.js" - -export { - NanoPowGl, - NanoPowGpu +import { NanoPowGpu as gpu } from "./gpu.js" +console.log(`export barrel`) +let NanoPowGpu = null +try { + NanoPowGpu = await gpu.init() +} catch (err) { + console.warn(`WebGPU is not supported in this environment.`) } +console.log(`barrel`) +export { NanoPowGl, NanoPowGpu } diff --git a/test.html b/test.html index de8bdae..d395eee 100644 --- a/test.html +++ b/test.html @@ -9,7 +9,7 @@ SPDX-License-Identifier: GPL-3.0-or-later - +