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

Wrapper to align values for dynamic uniforms #8

Open
LPGhatguy opened this issue Sep 12, 2020 · 1 comment
Open

Wrapper to align values for dynamic uniforms #8

LPGhatguy opened this issue Sep 12, 2020 · 1 comment

Comments

@LPGhatguy
Copy link

Some graphics APIs like WebGPU require dynamic uniform offsets to be a multiple of 256. shader-types has a type named DymamicOffsetMember that helps with this, but it creates trailing padding bytes which interacts poorly with crates like bytemuck.

Would it make sense for glsl-layout to have a type like this? If it can calculate and add manual trailing padding to the AsStd140 version of the type, that would help avoid unspecified padding bytes.

@zakarumych
Copy link
Collaborator

You mean that you have a struct where fields are uniform blocks, and you want to copy it into GPU buffer, right?
That feature could be implemented, sure, but I can't give you any ETA.

The easier way would be using crate safe-bytes. It allows reading bytes of structs with padding safely.

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

No branches or pull requests

2 participants