Add buffer_view language feature#6291
Conversation
alan-baker
commented
Jun 11, 2026
- API and WGSL changes to support buffer_view
|
Previews, as seen when this build job started (e4bdbd4): |
dneto0
left a comment
There was a problem hiding this comment.
very nice, careful work!
i have a bunch of refinements below, and also updates to other parts of the spec
14.4.5
"The storage and uniform address spaces have different buffer layout constraints which are described in this section."
Replace "buffer" with "memory" ?? Or delete "buffer" entirely?
14.4
"AlignOf(T) is the alignment of T", when T is not a a buffer type.
14.4 AccessibleBytes
AccessibleBytes(T) is not defined otherwise. (other than the listed cases)
14.4.1 Alignment and size.
"Each host-shareable or fixed footprint data type T has an alignment and size."
Suggest splitting cases, to make the exception clear:
Each host-shareable or fixed footprint type has a size.
Except for [=buffer=] types, each host-shareable or fixed footprint type has an alignment.
14.4.4 Internal layout of values.
"These layouts depend on the value’s type, and the align and size attributes on structure members."
Append. "These rule apply to non-opaque types as described below; values of [=buffer=] type do not
have an internal structure, and are not contrained by these rules."
interaction with "valid pointer"
bufferView, bufferArrayView built-ins yield invalid pointer if the original pointer is invalid.
Is that possible?
What does bufferLength return on an invalid pointer? (Is that even possible after type checking?)
6.5.8
"A pointer value is formed in one of the following ways"
- add a case for bufferView
6.5.4
"a bufferView or bufferArrayView built-in function requires a larger size than the buffer’s memory view contains."
The "requires a larger size" is confusing?
This rule belongs in a new set of paragraphs for how to make an invalid pointer rather than invalid reference.
Suggest?:
An invalid pointer is formed by:
- Applying the address-of operator (&) to an invalid memory reference.
- Calling the bufferView or bufferArrayView built-in functions, but the memory view of
the resulting pointer would otherwise include memory locations outside the memory view of the
pointer argument.
* API and WGSL changes to support buffer_view
ab43bc6 to
d735a03
Compare
Given the API validation around minimum binding size, I don't believe there can ever be an invalid buffer pointer. |
minutes from WGSL committee meeting 2026-6-23
|
Co-authored-by: Jim Blandy <jimb@red-bean.com>
There was a problem hiding this comment.
Should this use the size parameter only if the parameter is an override expression?
That's the only time validation-time has a value for it.
And spelling it out, if size is a runtime value then still use MinTypeSize.
I think that's right?
There was a problem hiding this comment.
Probably this could be simplifed to use MinTypeSize always. Clamping would be possible if we guarantee at least 1 array element.
