Now we reach the fun tier of shader language questions.
Uncategorized
2
Posts
1
Posters
0
Views
-
Now we reach the fun tier of shader language questions. "i wonder what happens if i shift out of range"
-
Now we reach the fun tier of shader language questions. "i wonder what happens if i shift out of range"
thankfully at the spir-v level this is answerable:
1) shifting out of range produces an unspecified value
2) if you annotate a shift instruction with `NoUnsignedWrap` or `NoSignedWrap`, then it becomes undefined behavior.at the slang level it's specified as: <crickets>
edit: Reading the code a left shift in slang ir just produces OpShiftLeftLogical, so in practice, on the spir-v backend, it should behave as 1, barring any potential shenanigans in the slang optimisation pipeline itself.
-
undefined Oblomov shared this topic