GPU shader data layout mismatch: a 12-byte gap that can freeze your computer
Testing WebGPU data layouts with Facet
When sharing configuration data between Rust and WebGPU compute shaders, subtle layout differences can cause GPU threads to spin forever. Matt Keeter discovered that a mat3x3 matrix takes 48 bytes in WGSL but only 36 in Rust, leading to a 12-byte offset error. He built a generic unit test using the facet reflection library and naga to automatically compare struct layouts, catching mismatches without hardcoding fields.
Even more unfortunately, I'm writing bytecode VMs which run in compute shaders, and their failure mode is often "congrats, your GPU now has persistently spinning threads which can only be killed by rebooting your computer".