gfx-rs / naga

Universal shader translation in Rust

Home Page:https://github.com/gfx-rs/wgpu/tree/trunk/naga

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

[wgsl-in] 0.0 / 0.0 should not be allowed

Wumpf opened this issue · comments

Spec says that NaN is generally not defined. I think Tint is right here and Naga should catch this as well as Tint does:

Tint WGSL reader failure: :80:17 error: '0.0 / 0.0' cannot be represented as 'abstract-float'
    let a = 0.0 / 0.0;

For reference, this violates the WGSL spec for abstract numeric types:

An evaluation of an expression in one of these types must not overflow or produce infinite, NaN, undefined, or indeterminate results.

Kudos to @ben-clayton for pointing this out in Matrix.