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

Consider an Aligned wrapper around types in generated struct definitions #6

Closed
tomaka opened this issue Feb 29, 2016 · 1 comment
Closed

Comments

@tomaka
Copy link
Member

tomaka commented Feb 29, 2016

Example GLSL code:

struct Foo {
    vec3 a;
    f32 b;
}

This is the Rust code that is currently generated:

#[repr(C)]
#[derive(Default)]
struct Foo  {
    a: [f32; 3],
    _dummy: [u8; 4],
    b: f32,
}

But this could be an alternative solution:

#[repr(C)]
struct Foo  {
    a: Aligned<[f32; 3], Align16>,
    b: f32,
}

Both have their advantages and drawbacks.

@Rua
Copy link
Contributor

Rua commented Aug 8, 2022

This solution unfortunately doesn't play nice with Bytemuck, so it's unlikely to be implemented.

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

No branches or pull requests

2 participants