Skip to content

Commit

Permalink
core: Fix crash when starting example without specified device (#2191)
Browse files Browse the repository at this point in the history
  • Loading branch information
felixpalmer authored Aug 20, 2024
1 parent 7fa4bc2 commit d4b633a
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions modules/core/src/lib/luma.ts
Original file line number Diff line number Diff line change
Expand Up @@ -111,17 +111,19 @@ export class luma {
}

const devices = getDeviceMap(props.devices) || deviceMap;
let WebGPUDevice;
let WebGLDevice;

switch (props.type) {
case 'webgpu':
let WebGPUDevice = devices.get('webgpu') as any;
WebGPUDevice = devices.get('webgpu') as any;
if (WebGPUDevice) {
return await WebGPUDevice.create(props);
}
break;

case 'webgl':
let WebGLDevice = devices.get('webgl') as any;
WebGLDevice = devices.get('webgl') as any;
if (WebGLDevice) {
return await WebGLDevice.create(props);
}
Expand All @@ -139,7 +141,7 @@ export class luma {
if (WebGPUDevice?.isSupported?.()) {
return await WebGPUDevice.create(props);
}
WebGLDevice = devices.get('webgl');
WebGLDevice = devices.get('webgl') as any;
if (WebGLDevice?.isSupported?.()) {
return await WebGLDevice.create(props);
}
Expand Down

0 comments on commit d4b633a

Please sign in to comment.