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
wgsl: remove ignore, add phony-assignment #2127
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
Any reason you didn't just extend the assignment_statement
grammar by allowing "_"?
Yes. The _ term has no type. But the assignment statement says the LHS has a reference type, etc. If/when we get destructuring tuple assignment we can revisit, but then the explanation gets a lot more complicated. |
Also, there are other parts of the spec where it says that an assignment statement induces a write to memory. And that doesn't happen with a phony assignment. |
WGSL meeting minutes 2021-09-21
|
Done: #2138 |
WGSL meeting minutes 2021-09-28
|
Updates:
|
But now we have an "updating assignment" for the original concept of an assignment
WGSL meeting minutes 2021-10-05
|
Discussed in the 2021-10-05 meeting. Agreed to the content, except for the change to allow any type for the expression. |
I've rebased the change, and reverted back to the original constraints on the expression type. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks good, thank you!
Just one question/note
wgsl/index.bs
Outdated
// Declare that buf, t, and s are part of the shader interface, without | ||
// using them for anything. | ||
_ = &buf; | ||
_ = &t; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any reason this isn't assigning by value?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
textures and samplers are not constructible.
The constraint on the RHS of phony-assignment is constructible or pointer, to make it as close as possible to regular assignment, which only allows constructible.
There's a special exception for passing textures and samplers as function call parameters.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
But we don't support the address-of operator on textures/samplers, so this example code is not valid. If we want to use this phony-assignment to retain sampler/texture bindings we'd need it to support assigning textures and samplers by value too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ok, so I guess we'll have to add those cases too. :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please take a look at the latest commit.
kvark on Matrix: "Great, please merge" |
Also remove parsing conflict between type constructor and function call, by refactoring the grammar. Fixes: gpuweb#2127
Fixes: #2115