wgpu
wgpu copied to clipboard
Helpful information for `BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED`
Is your feature request related to a problem? Please describe.
- Write a shader, uniform buffers, etc.
- Try to run the program with the WebGL backend.
- Get an error that tells you
BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED
is unsupported, and the pipeline name, and nothing else.
Describe the solution you'd like Provide diagnostic information to help fix the alignment problem, such as:
- The fact that this error is provoked by the shader's code, not the size of CPU-provided buffers.
- The name or number of the binding that was the wrong size.
- The field layout of the struct type of that binding, if it is a struct.
All but the first of these improvements would require making the MissingDownlevelFlags
error able to carry additional context, or some other kind of refactoring of the error types.
I am a bevy user experiencing this error while migrating to a version of bevy that uses wgpu 0.13, and I would definitely love to have any sort of idea what's going on.
The problem is that the size of your shader side struct must be aligned to size 16 - if it isn't, it needs to be padded out to be size 16
One of your shader structs isn't aligned. Not going to tell you which one. You have to find the needle in the haystack. Sad face.
@gilescope We should have the binding information available in the key of the hash map we're iterating through here, so a PR adding this information shouldn't be that difficult. https://github.com/gfx-rs/wgpu/blob/master/wgpu-core/src/device/mod.rs#L2857