Skip to content

Instantly share code, notes, and snippets.

@greggman
Created January 29, 2026 18:22
Show Gist options
  • Select an option

  • Save greggman/61eb5e34a5de57aba7271e5b9934b5b6 to your computer and use it in GitHub Desktop.

Select an option

Save greggman/61eb5e34a5de57aba7271e5b9934b5b6 to your computer and use it in GitHub Desktop.
WebGPU: Crash
/*bug-in-github-api-content-can-not-be-empty*/
/*bug-in-github-api-content-can-not-be-empty*/
const device = await (await navigator.gpu.requestAdapter()).requestDevice()
device.addEventListener('uncapturederror', e => console.error(e.error.message));
const canvas = document.createElement('canvas');
const context = canvas.getContext('webgpu');
context.configure({device, format: 'rgba8unorm'})
const texture = context.getCurrentTexture();
texture.label = 'canvas texture';
await new Promise(resolve => setTimeout(resolve, 500));
device.queue.writeTexture({texture},new Uint8Array(4), {}, [1]);
await new Promise(resolve => setTimeout(resolve, 500));
device.queue.writeTexture({texture},new Uint8Array(4), {}, [1]);
{"name":"WebGPU: Crash","settings":{},"filenames":["index.html","index.css","index.js"]}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment