Update helpers

This commit is contained in:
Andras Schmelczer 2023-05-21 11:01:31 +01:00
commit a76b515b80
No known key found for this signature in database
GPG key ID: FC8F2C3D3D1A718C
4 changed files with 18 additions and 7 deletions

View file

@ -0,0 +1,17 @@
export const initializeContext = ({
device,
canvas,
}: {
device: GPUDevice;
canvas: HTMLCanvasElement;
}): GPUCanvasContext => {
const context = canvas.getContext('webgpu') as any as GPUCanvasContext;
context.configure({
device: device,
format: navigator.gpu.getPreferredCanvasFormat(),
alphaMode: 'premultiplied',
});
return context;
};