-
Notifications
You must be signed in to change notification settings - Fork 345
[wgsl] Add spec text around vector accessors. #852
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
Conversation
This CL adds some initial spec text around the vector accessors and adds in that `rgba` and `xyzw` are valid accessors for a vector. Fixes #754
kvark
left a comment
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, just have a few notes
|
This talks about access generically, but looks like it mean only reading from a vector value. This doesn't cover assignment to vector components. I suggest that needs to be done in a followup. |
wgsl/index.bs
Outdated
|
|
||
| <table class='data'> | ||
| <tr><td>rgba<td>where r is the first component. Each letter is applied to the | ||
| components in order up to the size of the source vector. |
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.
"up to the size of the source vector" is ambigous.
At first I read it to mean you can only use as many letters as there are elements in the source vector. There's already a sentence later to limit the letters to avoid out-of-bounds access.
I'd rather see this:
... or using a sequence of convenience names, each mapping to an element of the source vector.
- The colour set of convenience names:
r,g,b,afor vector elements 0, 1, 2, or 3, respectively. - The dimensional set of convenience names:
x,y,z,wfor vector elements 0, 1, 2, or 3, respectively.
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.
Done
wgsl/index.bs
Outdated
| <div class='example'> | ||
| <xmp highlight='rust'> | ||
| var a : vec3<f32> = vec3<f32>(1., 2., 3.); | ||
| var b : f32 = a.y; |
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.
I suggest adding comments to indicate the actual value computed.
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.
Done
dneto0
left a comment
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.
Thanks!
This CL adds some initial spec text around the vector accessors and adds
in that
rgbaandxyzware valid accessors for a vector.Fixes #754