Open ErichDonGubler opened 2 months ago
This will be complicated as evaluator already evals them to bool when doing logical and: https://github.com/gfx-rs/wgpu/blob/14abdd47547e0cd364e8431dec46c3d57be3e160/naga/src/proc/constant_evaluator.rs#L1925-L1929
Description
Naga currently rejects programs with constant expressions such as this one:
An uninformed reader might assume that dividing by zero yielding an error is expected. Indeed, Naga will happily report an error here:
And yet, this is not standard behavior! The WGSL spec. clearly states that we should only be attempting const. eval. on the RHS of expressions when it cannot short-circuit. In the current WGSL spec.'s section 8.1.1:
Repro steps
Validate the above shader via
naga
as a file, i.e.,in.wgsl
. One can do this with a repo. checkout as follows:Expected vs observed behavior
Already described, I hope!
Extra materials
-
Platform
-