naga: Comparison-expressions on atomic types are not treated as an error #5474
Labels
area: validation
Issues related to validation, diagnostics, and error handling
kind: diagnostics
Error message should be better
naga
Shader Translator
Description
According to the WGSL Specification, Section 8.8, comparison expressions are defined to operate on AbstractInt, AbstractFloat, bool, i32, u32, f32, or f16 (and apply component-wise on their vector equivalents). It looks like naga (0.19.2) permits an instance of
atomic<u32>
and au32
to be passed as the operands of a comparison operator and injects an atomic load before the comparison while translating the output. Tint treats this as an error and rejects the program.I believe Tint's behavior matches the specification while Naga's behavior does not. Please see the details below.
Details
The offending WGSL is from a compute program that applies comparison between two bindings (
// ...
denotes sections that are omitted from the rest of the program):Tint Behavior:
Given the above, tint outputs the following error, which I believe matches the spec:
Naga Behavior:
Naga accepts the program. Looking at the generated MSL, it looks like Naga inserts an atomic load and performs the comparison on the result of that. I haven't attempted to reproduce this on other backends:
The text was updated successfully, but these errors were encountered: