-
Notifications
You must be signed in to change notification settings - Fork 928
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
D3DCompile error with vector indexing #4460
Comments
I'm totally wrong, see the 5th row here: https://gpuweb.github.io/gpuweb/wgsl/#vector-single-component This may be a problem with either FXC or dxbc (vs dxil). The workaround using array<f32, 4> will still get around the problem. |
Using an |
WGSL group decided that dynamic indexing for |
Make sure it is stored in a var, not let. |
Tint had to deal with this as well, see https://bugs.chromium.org/p/tint/issues/detail?id=998. |
See also #4337 |
@gfx-rs/naga: Has this issue been resolved, now that #4337 has been resolved? |
I don't think so. |
When trying to assign to a vector component through indexing, the Direct3D shader compiler rejects the generated HLSL. On Vulkan and Metal the shader is built without any issues and runs correctly.
Error message:
Related WGSL (32-bit quaternion decompression)
Generated HLSL
From reading the error messages, it seems that the first dynamic indexes in the loop can be avoided by unrolling the loop, but the last access towards the end of the function cannot be unrolled since it is not in a loop and causes the issue. Where does WGSL / WebGPU stand on the issue? Is assignment into vectors by dynamic indexing supported or am I invoking unvalidated behaviour?
Update:
If I wrap the last indexing into a dummy loop of
for i in 0..4 { if i == largest_i { q[i] = ... } }
then the shader compiler is able to work around by unrolling. Not ideal but if someone else runs into this, it might be useful as a temporary fixThe text was updated successfully, but these errors were encountered: