This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
interface BufferInit { | |
label?: string; | |
usage: number; | |
contents: ArrayBuffer; | |
} | |
export function createBufferInit( | |
device: GPUDevice, | |
descriptor: BufferInit, | |
): GPUBuffer { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const adapter = await navigator.gpu.requestAdapter(); | |
if (!adapter) throw new Error("Failed to get GPU adapter."); | |
const device = await adapter.requestDevice(); | |
// First Matrix | |
const firstMatrix = new Float32Array([ | |
2 /* rows */, | |
4 /* columns */, | |
1, |