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

Investigate best way to add WebGL2 padding required by wgpu #6685

Open
cart opened this issue Nov 18, 2022 · 1 comment
Open

Investigate best way to add WebGL2 padding required by wgpu #6685

cart opened this issue Nov 18, 2022 · 1 comment
Labels
A-Rendering Drawing game state to the screen C-Enhancement A new feature

Comments

@cart
Copy link
Member

cart commented Nov 18, 2022

Bevy needs to add padding to some structs to support WebGL2. We are currently doing this, but the best way to do it is a bit unclear. Worth investigating!
Relevant discussion: #6643 (comment)

@cart cart added C-Enhancement A new feature A-Rendering Drawing game state to the screen labels Nov 18, 2022
@nicopap
Copy link
Contributor

nicopap commented Nov 28, 2022

Rust supports const-time panics. If all buffer bindings that require proper padding must be derived by a proc-macro we control, it should be possible to check the alignment of the struct (with mem::align_of::<T>()) and cause a panic at compile time. For example by defining a dummy const which evaluates to something that can panic.

I've already done this for a bevy-unrelated project, in an include-bytes-transmute macro.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-Rendering Drawing game state to the screen C-Enhancement A new feature
Projects
None yet
Development

No branches or pull requests

2 participants