-
Notifications
You must be signed in to change notification settings - Fork 1k
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
[spv-in] Support texture access qualifier and infer texture access mode #6420
Comments
@jimblandy had mentioned later in the matrix channel that in order to properly support this, we may need to do something similar to the atomics upgrade. What that means is storing the pointer to the image during parsing and then doing a late-pass over the generated module to inspect how that image is used (read or write or readwrite), and then updating the type accordingly. |
|
tl;dr - I don't know if @teoxoy I previously thought it might be the case that
...and that capability isn't allowed in Vulkan
I'm fairly certain that It is a confusing part of the spec. |
As I mentioned in EmbarkStudios/rust-gpu#1097 (comment) (which @schell linked), If Naga supports e.g. In general, the biggest "life hack" for figuring out how Vulkan SPIR-V handles something is to ignore it and just go to GLSL (esp. for features that existed in OpenGL): It is conceptually in the wrong place, but |
Thanks @eddyb :) If I'm not mistaken, |
That reminds me of my preferred suggestion for the Rust-GPU side:
So in essence, both Naga and Rust-GPU's And OpenCL (" @schell Now, in terms of type upgrades on the Naga side, the default seems to be R+W, with At the very least, images can only exist with at most an array around them, so you don't have the same issue as potentially deeply nested types involving atomics etc. |
Ah yes, we can't use the
It looks like naga already supports this: wgpu/naga/src/front/spv/mod.rs Lines 5672 to 5675 in 4f1a9b5
All decorations must come before all types, so our implementation looks correct. |
So in that case, does that mean this fix should indeed be made in |
You need both The latter existing means you only need the former. The implementation guide on the Rust-GPU side is EmbarkStudios/rust-gpu#1097 (comment) (specificially the |
I will close this issue then, please reopen it or open a new one if there is an issue with our implementation. |
Description
As I wrote about here and as far as I can tell, it's not possible to write to textures in
wgpu
if your shader is SPIR-V.This seems to be because the
OpTypeImage
passed toOpImageWrite
must have its "Sampled" parameter set to2
:...
I think
naga
's spv frontend erroneously assumes that2
in this case means read AND write instead of "one of readonly, writeonly or readwrite", as is implied by only having one value for all of them in the SPIR-V spec.Repro steps
Working on it...
Expected vs observed behavior
I expect to be able to build my shader pipeline and write to storage textures.
Instead, I got this error:
I should note that simply marking my texture as read+write is not an option as that is a native-only feature and I target web.
The text was updated successfully, but these errors were encountered: