Replies: 3 comments 9 replies
-
Yes, that is a good idea. It should be consistent between platforms. I'll take a look @Benualdo Also, what but did you get on ARM? |
Beta Was this translation helpful? Give feedback.
-
This is fixed in 92729f2 btw |
Beta Was this translation helpful? Give feedback.
-
I think there is a further possible discussion regarding the size and alignment of the types. There is an argument towards having types with the same alignment across platforms if e.g. one platform is used to store data and the other to consume it. To be honest, I don't recommend using these types to store data due to wasted space but that could come with the interop structs. It is a known issue and it needs a solution. I am enforcing the alignment of the float4 for now and we'll see what scope or desire there it to change it for other platforms (I'm thinking of NEON here) |
Beta Was this translation helpful? Give feedback.
-
Hi, recently I add a bug on ARM and wanted to switch to scalar implementation of hlslpp onto that platform but this introduced another issue: mesh loading was not working anymore!
Turns out I was serializing a struct like this:
And sizeof(Vertex) was 128 with SSE implementation but only 124 with scalar implementation because of SSE alignement.
While I understand that serializing vector types is discutable (e.g., uv[0] is 16 bytes instead of 8 here) do you think it might be a good idea to enforce struct alignment of hlslpp structs like float4 even when the scalar implementation is used for consistency?
e.g.:
The value of 16 here is because of SSE and could vary but at least we could have a define like
#define HLSLPP_MIN_ALIGNMENT 16
?
I solved my issue by using alignas on my own struct, but what do you think about the feature for hlslpp?
Thanks,
Benoît.
Beta Was this translation helpful? Give feedback.
All reactions