Skip to content

Instantly share code, notes, and snippets.

View danteissaias's full-sized avatar

Dante danteissaias

  • UK
  • 01:05 (UTC +01:00)
View GitHub Profile
interface BufferInit {
label?: string;
usage: number;
contents: ArrayBuffer;
}
export function createBufferInit(
device: GPUDevice,
descriptor: BufferInit,
): GPUBuffer {
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,