WGSL: Const. eval. short-circuiting #6302
Labels
area: correctness
We're behaving incorrectly
area: cts
Issues stemming from the WebGPU Conformance Test Suite
area: naga processing
Passes over IR in the middle
area: validation
Issues related to validation, diagnostics, and error handling
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
The text was updated successfully, but these errors were encountered: