Update helpers
This commit is contained in:
parent
12fa81c3ed
commit
a76b515b80
4 changed files with 18 additions and 7 deletions
17
src/utils/graphics/initialize-context.ts
Normal file
17
src/utils/graphics/initialize-context.ts
Normal 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;
|
||||
};
|
||||
Loading…
Reference in a new issue