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] Missing integer type validation for contants

Wumpf opened this issue · comments

As of 0.12.0 this compiles:

var<private> TEXTURE_SIZE: u32 = 2048;

When it should actually be

var<private> TEXTURE_SIZE: u32 = 2048u;

For me, this caused an invalid glsl shader down the line whereas the msl variant was happy. Glsl failed (correctly) with Internal error in ShaderStages(NONE | VERTEX) shader: ERROR: 0:63: '=' : cannot convert from 'const int' to 'highp uint'

(yes, const TEXTURE_SIZE: u32 = 2048u; would be more appropriate!)

Thanks for the report! I recently fixed this in #2266.