LordXido commited on
Commit
cb68079
·
verified ·
1 Parent(s): d21242b

Update gpu.js

Browse files
Files changed (1) hide show
  1. gpu.js +4 -3
gpu.js CHANGED
@@ -1,6 +1,7 @@
1
  export async function initGPU(width, height) {
2
  if (!navigator.gpu) {
3
- throw new Error("WebGPU not supported");
 
4
  }
5
 
6
  const adapter = await navigator.gpu.requestAdapter();
@@ -12,8 +13,8 @@ export async function initGPU(width, height) {
12
  size,
13
  usage:
14
  GPUBufferUsage.STORAGE |
15
- GPUBufferUsage.COPY_DST |
16
- GPUBufferUsage.COPY_SRC
17
  });
18
 
19
  return { device, buffer };
 
1
  export async function initGPU(width, height) {
2
  if (!navigator.gpu) {
3
+ console.warn("WebGPU not supported, falling back to CPU");
4
+ return null;
5
  }
6
 
7
  const adapter = await navigator.gpu.requestAdapter();
 
13
  size,
14
  usage:
15
  GPUBufferUsage.STORAGE |
16
+ GPUBufferUsage.COPY_SRC |
17
+ GPUBufferUsage.COPY_DST
18
  });
19
 
20
  return { device, buffer };