gfx-rs / wgpu

A cross-platform, safe, pure-Rust graphics API.
https://wgpu.rs
Apache License 2.0
12.23k stars 898 forks source link

Padding of `array<matCx3, 4>` is clobbered in `storage`-bound writes from shader #6298

Open ErichDonGubler opened 4 days ago

ErichDonGubler commented 4 days ago

Description

When running some webgpu:shader,execution,padding:* tests in Firefox, I noticed that the following were failing:

Repro steps

I've reduced this to an MRE repo (erichdongubler-mre/wgpu-matCx3-padding-clobber) that runs natively on the wgpu crate, converting …:array_of_matCx3:columns=2;use_struct=false to Rust code. I recommend using the following

RUST_LOG=debug cargo run

Expected vs observed behavior

Examining the MRE's output, it seems we're failing these tests because we clobber the padding in the first matCx3 element, but not the others. Weird!

Extra materials

-

Platform

This is confirmed to be an issue on MacOS. Firefox's CI reports issues on DX12, too, but I haven't investigated that platform thoroughly or reproduced locally (despite non-exhaustive attempts with the MRE above).

ErichDonGubler commented 4 days ago

CC @sagudev, who may be interested in a CTS-relevant issue.

ErichDonGubler commented 4 days ago

I wonder if this is relevant to https://github.com/gfx-rs/wgpu/issues/5739?