naga
naga copied to clipboard
is "- 1" can be considered as const Expressions?
so i was testing the textureSample function, https://www.w3.org/TR/WGSL/#texturesample
I notice that the
fn textureSample(t: texture_2d
the last offset: vec2
so if i want to use like textureSample(_, _, _, off) is gonna be wrong (off is a vec2
but if i use like textureSample(_, _, _, vec2
The reason why this "space" is a problem to me is: using Rust, most of the time you need to use macro.
the token stream will automatically separate "-1" to "- 1", same as “()” to “( )”, “!a” to "! a"
so I am wondering if anyone wants to combine the wgls with rust macro, this textureSample's offset will be a problem?
any ideas?
thanks!!!!
The current implementation uses the core::num::i32::from_str_radix to parse an int in the tokenization stage, which doesn't allow any space between the preceding '-' and number literals. I think for const int literals, this limitation is ok. The real question is wgsl seems not to support the const operator (like this minus unary case) as a const expression at all.
Note this is expected, we haven't implemented any of the const stuff yet
Note this is expected, we haven't implemented any of the const stuff yet
so this could be somthing which will implement later?
Yeah, we'll need to eventually to be conformant.
closing as duplicate of #1829