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

Helpful information for BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED #2832

Closed
kpreid opened this issue Jul 2, 2022 · 4 comments · Fixed by #3414
Closed

Helpful information for BUFFER_BINDINGS_NOT_16_BYTE_ALIGNED #2832

kpreid opened this issue Jul 2, 2022 · 4 comments · Fixed by #3414
Labels
area: validation Issues related to validation, diagnostics, and error handling good first issue Good for newcomers help wanted Contributions encouraged type: enhancement New feature or request

Comments

@kpreid
Copy link
Contributor

kpreid commented Jul 2, 2022

Is your feature request related to a problem? Please describe.

  1. Write a shader, uniform buffers, etc.
  2. Try to run the program with the WebGL backend.
  3. 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.

@cwfitzgerald cwfitzgerald added type: enhancement New feature or request help wanted Contributions encouraged good first issue Good for newcomers area: validation Issues related to validation, diagnostics, and error handling labels Jul 2, 2022
@rparrett
Copy link
Contributor

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.

@cwfitzgerald
Copy link
Member

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

@gilescope
Copy link

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.

@cwfitzgerald
Copy link
Member

@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

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: validation Issues related to validation, diagnostics, and error handling good first issue Good for newcomers help wanted Contributions encouraged type: enhancement New feature or request
Projects
None yet
4 participants