demo · v139
WGSL Shader Compilation Tester
Write WGSL, hit Compile, and see real compilation messages — errors with line numbers, warnings, and info notes — via shaderModule.getCompilationInfo(). Compare against device limits and the "minimum guaranteed" baseline.
WebGPU required. If unavailable, a static example with annotated compilation output is shown.
IDLE
Run a compile to see results.
device limits
Queried from device.limits. Run "Check limits" to populate.
maxBindGroups
—
min guaranteed: 4
maxUniformBufferBindingSize
—
min: 65536 bytes
maxStorageBufferBindingSize
—
min: 134217728 bytes
maxComputeWorkgroupSizeX
—
min: 256
maxComputeWorkgroupSizeY
—
min: 256
maxComputeWorkgroupSizeZ
—
min: 64
maxBindingsPerBindGroup
—
min: 640
maxVertexBuffers
—
min: 8
the code
const device = await (await navigator.gpu.requestAdapter()).requestDevice();
const module = device.createShaderModule({ code: wgslSource });
// getCompilationInfo() is stable in Chrome 139 core
const info = await module.getCompilationInfo();
for (const msg of info.messages) {
console.log(msg.type); // "error" | "warning" | "info"
console.log(msg.message); // human-readable text
console.log(msg.lineNum); // 1-based line number
console.log(msg.linePos); // 1-based column
console.log(msg.offset); // byte offset into source
console.log(msg.length); // length of the problematic span
}
// Check device limits
console.log(device.limits.maxBindGroups); // 4+
console.log(device.limits.maxComputeWorkgroupSizeX); // 256+