Repository navigation
Conversation
Fixes gpuweb#1056 Also, remove ReadOnly and WriteOnly literals in the SPIR-V examples for declaring image types. Those optional literal qualifiers are only used for Kernel modules, not Shader modules.
There was a problem hiding this comment.
The first half of the change is great!
This half, however, is not:
Also, remove ReadOnly and WriteOnly literals in the SPIR-V examples
for declaring image types. Those optional literal qualifiers are only
used for Kernel modules, not Shader modules.
We still need to specify that these are read-only or write only.
So instead of stripping them away, we should fix them, i.e. "ReadOnly" -> "NonWritable", and "WriteOnly" -> "NonReadable"
actually: not sure how exactly to write this down in this syntax, but we must say that these decorations apply somehow
|
It doesn't look like there is a way to specify Read/Write only in the SPIR-V? At least not that I see. |
|
In SPIR-V the read/write is done via |
|
Right, so not relevant for OpImageType, but for when the variable is created later. Is the suggestion to make that update here as well? |
kvark
left a comment
There was a problem hiding this comment.
I suppose this is where the 1:1 correspondence of WGSL to SPIR-V starts to crack a little bit. Saying that texture_ro_1d is just an OpTypeImage is correct, but it doesn't provide the full picture.
Where do you see it being specified that this will put the NonWritable decoration on any global variable of this image type?
|
That's a good question. I think in the variable section where we define things we'll need a blurb on |
Yes. Exactly. Related is what to do for buffers. SPIR-V for Shader had to match the flexibility in GLSL, where the readonly attribute can apply to individual struct members. We'll restrict the readonly/writeonly attribute to the whole variable, as suggested. (This was on my TODO list!) |
Promote the builtin test runner to `src/webgpu/shader/execution/expression.ts`, and tweak the interface so it can be used for any kind of expression. Move comparision utilities out to `src/webgpu/util/compare.ts`. Move constants out to `src/webgpu/util/constants.ts`.
Fixes #1056
Also, remove ReadOnly and WriteOnly literals in the SPIR-V examples
for declaring image types. Those optional literal qualifiers are only
used for Kernel modules, not Shader modules.