Webgpu Wgsl Memory Layout

Use when laying out WGSL structs for uniform or storage buffers, matching a JS typed array to a shader struct, or choosing an address space. Prevents the single most common WGSL bug: uniform struct misalignment from the vec3 16-byte rule producing garbage shader reads. Covers the six WGSL address spaces, pointers, AlignOf and SizeOf rules, the vec3 16-byte trap, the std140-like uniform array stride, align and size attributes. Keywords: WGSL memory layout, address space, uniform, storage, workgroup, vec3 alignment, std140, align, size, struct padding, ptr, arrayLength, shader reads garbage, uniform buffer offset wrong, how do I lay out a uniform struct.

Impertio-Studio 5797d7c 4 files · 32.0 KB Updated

File contents

impertio-studio/webgpu-claude-skill-package/tree/main/skills/source/webgpu-wgsl/webgpu-wgsl-memory-layout commit 5797d7c669

Frequently asked questions

npx skillmds@latest add impertio-studio/webgpu-wgsl-memory-layout