-
Notifications
You must be signed in to change notification settings - Fork 304
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
clarify when const-exprs subexpressions are evaluated #4558
Comments
I forgot to restate that we have a complicated rule like this in order to express the short-circuiting behaviour of |
FYI this was found via development of gpuweb/cts#3595 Thanks @Kangz ! |
WGSL 2024-04-16 Minutes
Later discussion:
|
Example:
The relevant part of the spec is at https://gpuweb.github.io/gpuweb/wgsl/#const-expr :
There is confusion is for OuterE being
x / 0
. OuterE will be evaluated at runtime, not at shader-creation time. So OuterE will be evaluated, and so the RHS subexpression0
will be evaluated to zero at shader-creation time, and then the division by zero should trigger a shader-creation error.However, it's very easy to read the rule as OuterE having to be evaluated at shader-creation time in order for the evaluation of subexpression E to kick in. And if that's the reading, then the division rule can't be checked, and so won't trigger an error.
So we need to clarify that the OuterE doesn't have to be a const-expr for the rule to kick in.
We still want to check a bunch of shader-creation errors even in code that is in statements that will not execute.
So we can't require OuterE to be reachable at runtime.
This is somewhat related to #4551
The text was updated successfully, but these errors were encountered: