Add tiny UI
This commit is contained in:
parent
e3d0af56e2
commit
6a752a57e9
30 changed files with 627 additions and 210 deletions
16
src/utils/webgpu/initialize-gpu.ts
Normal file
16
src/utils/webgpu/initialize-gpu.ts
Normal file
|
|
@ -0,0 +1,16 @@
|
|||
export const initializeGPU = async (): Promise<GPUDevice> => {
|
||||
const gpu = navigator.gpu;
|
||||
if (!gpu) {
|
||||
throw new Error('WebGPU is not supported');
|
||||
}
|
||||
|
||||
const adapter = await gpu.requestAdapter({
|
||||
powerPreference: 'high-performance',
|
||||
});
|
||||
|
||||
if (!adapter) {
|
||||
throw new Error('Could not request adatper');
|
||||
}
|
||||
|
||||
return await adapter.requestDevice(); // could request more resources
|
||||
};
|
||||
Loading…
Add table
Add a link
Reference in a new issue