Until recently, Dawn didn't allow a trailing comma in template argument lists, and WebGPU CTS also tested that parse cases with a trailing comma failed to parse. Naga also implemented this behavior. However, it turns out that this was all incorrect! π±
The WGSL. spec. states that the template_arg_comma_list must accept a single optional trailing comma:
Description
Until recently, Dawn didn't allow a trailing comma in template argument lists, and WebGPU CTS also tested that parse cases with a trailing comma failed to parse. Naga also implemented this behavior. However, it turns out that this was all incorrect! π±
The WGSL. spec. states that the
template_arg_comma_list
must accept a single optional trailing comma:As of https://github.com/gpuweb/cts/pull/3959, the CTS fixed this to follow the spec., with Dawn following suit in https://crbug.com/366000875. Naga should also fix this, so we don't diverge.
Repro steps
Try to compile this shader:
β¦which, at time of writing, yields the following in
naga-cli
:Alternatively, if lines 3-4 are commented out:
Expected vs observed behavior
The repro steps should produce no errors.
Extra materials
-
Platform
-