Closed
Labels
wgslWebGPU Shading Language Issues
Milestone
Description
This feature appears in some CTS tests.
It corresponds to the GLSL 'writeonly' and 'readonly' attributes on storage buffer variables.
Example shader:
#version 450
layout (set=0, binding = 0) buffer writeonly BufferName {
int value;
} buf;
void main() {
buf.value = 1;
}
In SPIR-V this maps to a NonReadable decoration on the member. (But let's gloss over where it's applied).
The readonly attribute is a hint to an implementation that it is safe to aggressively prefetch and cache accesses.
The writeonly attribute is a hint to an implementation that it's wasteful to cache accesses, and you don't need a snooping mechanism on the store buffer.
If we add this to WGSL, then when translating to another language, a fallback is to drop the attributes.
Reacted by Dzmitry Malyshau
Metadata
Metadata
Assignees
Labels
wgslWebGPU Shading Language Issues
Activity
dneto0 commentedon Sep 19, 2020
See discussion on #1059 (comment) for how this should work for both read-only buffers and storage textures (read-only and write-only).
Since I filed this, I've learned this is more important than I realized. The buffer has to be set up differently on the API side as well.
kvark commentedon Sep 19, 2020
First of all, we probably don't need write-only buffers, since the API doesn't have them (only read-write).
Secondly, it would be nice if the "readonly/read-write" semantic was a part of the type in WGSL (and not the binding), to be consistent with texture declarations, where it's already a part of the type.
dneto0 commentedon Sep 22, 2020
Discussed during 2020-09-22 meeting relation to #1056.
Suggested direction: Use distinct types for readonly and read-write buffers. Motivation is that HLSL has them as distinct types.
dneto0 commentedon May 11, 2021
This is obsolete. See #1064 for the latest iteration.
dneto0 commentedon May 11, 2021
Discussed in 2021-05-11
kdashg commentedon May 17, 2021
WGSL meeting minutes 2021-05-11
Change validation test texture_format_equality to texture_format_comp…