Open Aern-do opened 4 months ago
Also, in the generated structure, the position field is [f32; 4]
instead of [f32; 3]
. I'm not sure if this is correct behavior or not
However, vertex attributes do not have this field, and it appears only in the structure itself
The vertex_index
you are specifying is built in and doesn't need to be specified.
Also, in the generated structure, the position field is
[f32; 4]
instead of[f32; 3]
. I'm not sure if this is correct behavior or not
That is the correct behaviour, it is automatically adding the padding bytes in this case. You can provide your own types, it will still ensure (through const assertions that position
is 16 bytes in length).
The vertex_index you are specifying is built in and doesn't need to be specified.
I understand that this is the intended behavior. However, the vertex_index
should not be included in the generated structure, since it is not a user input.
The vertex_index you are specifying is built in and doesn't need to be specified.
I understand that this is the intended behavior. However, the
vertex_index
should not be included in the generated structure, since it is not a user input.
Ah you're right. My caffeine is weak today. 😅
On second thought, generating vertex_index
isn't necessary a bug. In places where this is used in eg: storage buffer, it will be treated as padding field, and the gpu fills this for you. I have made a change where constructors
and Init
structs will zero out this field.
The other part about the position being 16 bytes instead of 12 is likely a bug. Alignments are likely handled differently in vertex attrib. I'll need to play around with a working example to test that however.
I have this structure in a shader used as vertex shader input
In the generated Rust code, the structure still contains the builtin field
vertex_index
However, vertex attributes do not have this field, and it appears only in the structure itself