naga
naga copied to clipboard
Fix for incorrect GLSL validation on witeonly image uniforms
Related to this issue: https://github.com/gfx-rs/wgpu/issues/4530
I noticed the validation on layout qualifiers for writeonly image uniforms was not working according to the GLSL spec.
I saw there was already a TODO in the code, and the fix seemed straightforward so I made a PR for this.
Thanks for trying to fix the issue, but unfortunately this doesn't solve the underlying problem it just side steps the error gating it.
The problem is that naga doesn't have a way to express a storage image without a format, so we initialize it by default r8uint
and expect the user to change the format.
https://github.com/gfx-rs/naga/blob/7e3750a7f2eca0ab357dfa72d90bdc60b77c3202/src/front/glsl/types.rs#L170-L173
So your solution is just making all writeonly
images without storage format default to r8uint
.
Also if try this on the original issue reproduction case, it won't work, because the storage format kind and the data vector kind aren't equal.
Ok I see the problem. Would this be somehow solvable by making format
optional on ImageClass::Storage
, or is there a hard requirement to have the format later on?
I am wondering how spriv-cross solves this problem.
That would be a possibility, but the real problem is figuring out how to handle it in the backends.
So I recommend you first research how this would map to the different backends and then we can discuss how this would map to the IR.
Hello, thank you for your PR against Naga!
As part of https://github.com/gfx-rs/wgpu/issues/4231, we have moved development of Naga into the wgpu repository in the Naga subfolder. We have transferred all issues, but we are unable to automatically transfer PRs.
As such, please recreate your PR against the wgpu repository. We apologize for the inconvenience this causes, but will make contributing to both projects more streamlined going forward.
We are leaving PRs open, but once they are transferred, please close the original Naga PR.