@ende/webgpu
ende add jsr:@ende/webgpuVersion 2026.10.15 on JSR.
Utilities for interacting with the WebGPU API.
import { createTextureWithData } from "@ende/webgpu";
const adapter = await navigator.gpu.requestAdapter();
const device = await adapter?.requestDevice()!;
createTextureWithData(device, {
format: "bgra8unorm-srgb",
size: {
width: 3,
height: 2,
},
usage: GPUTextureUsage.COPY_SRC,
}, new Uint8Array([1, 1, 1, 1, 1, 1, 1]));
Modules
Exports
BYTES_PER_PIXEL— Number of bytes per pixel.COPY_BYTES_PER_ROW_ALIGNMENT— Buffer-Texture copies must have [`bytes_per_row`] aligned to this number.createCapture— Creates a texture and buffer to use as a capture.CreateCapture— Return value for createCapture.createTextureWithData— Create a GPUTexture with data.describeTextureFormat— Get various information about a specific GPUTextureFormat.getRowPadding— Calculates the number of bytes including necessary padding when passing a GPUImageCopyBuffer.Padding— Return value for getRowPadding.resliceBufferWithPadding— Creates a new buffer while removing any unnecessary empty bytes. Useful for when wanting to save an image as a specific format.TextureFormatInfo— Return type for describeTextureFormat.