Skip to content
Discussion options

You must be logged in to vote

I haven't been able to think of exactly what the problem might be here, but one thing I would suggest is reordering your struct members so that you need as little manual padding as possible. This not only saves memory but protects against implementation bugs. (wgpu has to work across many different graphics APIs which have different ideas about alignment requirements, and I've personally encountered one bug. It's still wgpu's responsibility to deal with them, but that doesn't mean there aren't unfixed ones.)

The simplest way to do this (in the absence of vec3s) is to order the members from largest alignment to smallest.

struct Uniform {
   domain: mat2x2<f32>, // align 8 size 16, running …

Replies: 1 comment 7 replies

Comment options

You must be logged in to vote
7 replies
@lobis
Comment options

@kpreid
Comment options

kpreid Sep 15, 2022
Collaborator

@lobis
Comment options

@grovesNL
Comment options

@lobis
Comment options

Answer selected by lobis
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants