Add tiny UI

This commit is contained in:
Andras Schmelczer 2023-04-30 11:27:26 +01:00
parent e3d0af56e2
commit 6a752a57e9
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
30 changed files with 627 additions and 210 deletions

View 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
};