Skip to content
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

Fix wgsl out struct layout #2450

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

mikialex
Copy link

fix gfx-rs/wgpu#4373 by explicitly adding a size mark on all struct fields.

@mikialex
Copy link
Author

a test failed due to the two struct field members having the same offset. I think this should be checked in validation and fixed in another pr.

} else {
struct_span - member.offset
};
write!(self.out, "@size({current_field_size}) ")?;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can avoid writing the size explicitly if it's the same as the one inferred. See example below on how to get the size:

naga/src/back/msl/writer.rs

Lines 3178 to 3179 in 0491d39

let ty_inner = &module.types[member.ty].inner;
last_offset = member.offset + ty_inner.size(module.to_ctx());

@cwfitzgerald
Copy link
Member

Hello, thank you for your PR against Naga!

As part of gfx-rs/wgpu#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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[wgsl-out] Align and size attributes not being output
3 participants