wgsl: replace stride attribute with array type parameter#2103
wgsl: replace stride attribute with array type parameter#2103dneto0 wants to merge 4 commits intogpuweb:mainfrom
Conversation
|
We're very open to a name that's better than |
kvark
left a comment
There was a problem hiding this comment.
(haven't finished the review)
wgsl/index.bs
Outdated
|
|
||
| // array<i32,5,4> and array<i32,5> are the same type because the implicit stride of | ||
| // array<i32,5> is 4. | ||
| var<private> g: array<i32,5,4>; |
There was a problem hiding this comment.
unfortunately, this doesn't read well :(
There was a problem hiding this comment.
Alternative syntaxes have been proposed and rejected, like
array<i32,5,stride=4>
Do you have another alternative?
There was a problem hiding this comment.
How about:
// Both the g and h arrays instantiate the same type because h's implicit stride
// is the same as g's explicit stride.
var g : array<i32,5,4>; // Array of 5 i32s with a stride of 4-bytes
var h : array<i32,5>; // Array of 5 i32s with an implicit stride of 4-bytes
There was a problem hiding this comment.
I don't have a good suggestion here. Enrolling into named generic parameters is certainly one way, but it's a lot to chew for this (seemingly little) problem. Leaving <i32, 5, 4> is just looking confusing.
There was a problem hiding this comment.
From group discussion on 2021-10-12, we decided to try the 'stride=N' syntax.
Latest commit shows this.
d454ed4 to
fc2d250
Compare
|
Rebased against main. |
WGSL meeting minutes 2021-10-12
|
- Update related grammar rules and examples - Rename 'runtime-sized' array to 'dyanmically-sized'. Change its declaration syntax to use `dynamic_array` instead of `array` without an element count. - Add examples showing array type compatibility based on stride Editorial: - Rearrange text in Array Types section - More consistently use 'E' for element array type placeholder Part of gpuweb#1534 Change-Id: I09082c257fbc325e20a0e28fe16f7744e882a61e
fc2d250 to
685ed9e
Compare
|
685ed9e is rebased against main. |
- Add new 'modifier word' kind of token which has special meaning only in certain contexts, and is otherwise is an identifier. Note: We should probably make lots of things like this: access mode, image format - When stride is specified in source, spell it out as ',stride=N' instead of just an optional ',N' - Modify the grammar rules for array type declarations, to match the prose.
WGSL meeting minutes 2021-10-19
|
* Remove two paragraphs that are part of gpuweb#2103, the array-stride change.
* Remove two paragraphs that are part of gpuweb#2103, the array-stride change.
|
Is this still valid? @dneto0 |
|
Closing since strides have been removed. |
Change its declaration syntax to use
dynamic_arrayinstead ofarraywithout an element count.Editorial:
Part of #1534
Change-Id: I09082c257fbc325e20a0e28fe16f7744e882a61e