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
Array Stride Mismatch in vec3-padded Struct #5262
Labels
api: metal
Issues with Metal
area: naga back-end
Outputs of naga shader conversion
lang: Metal
Metal Shading Language
naga
Shader Translator
Comments
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
This comment was marked as outdated.
Merged
cwfitzgerald
changed the title
Compute shader only sees first portion of buffer when element is a struct
Array Stride Mismatch in vec3-padded Struct
Feb 18, 2024
cwfitzgerald
added
api: metal
Issues with Metal
area: naga back-end
Outputs of naga shader conversion
naga
Shader Translator
lang: Metal
Metal Shading Language
labels
Feb 18, 2024
The issue here is as follows: struct Inner {
vec: vec3<u32>,
scalar1: u32,
scalar2: u32
} This struct is supposed to be size 32, alignment 16. However, when accessed through an array in metal, the stride shows itself to be 24. I suspect packed_uint3 doesn't have the alignment requirements?
Unmark the test as failing on metal in #5264 to see the behavior. |
Probably just need to insert an alignas(16) when we're using packed_uint3 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Labels
api: metal
Issues with Metal
area: naga back-end
Outputs of naga shader conversion
lang: Metal
Metal Shading Language
naga
Shader Translator
Description
Running a compute shader with an input of an array of struct of 20 bytes will only see the first 20/32 entries.
Repro steps
cd examples
cargo run hello_compute
Expected vs observed behavior
Observed:
Expected:
Extra materials
Screenshots to help explain your problem.
Validation logs can be attached in case there are warnings and errors.
Zip-compressed API traces and GPU captures can also land here.
Platform
MacOS 14.3 (23D56), MacBookPro18,2
The text was updated successfully, but these errors were encountered: