-
Notifications
You must be signed in to change notification settings - Fork 7
Open
Description
Here you can do something like this
[StructLayout(LayoutKind.Explicit)]
public struct SimplePushConstantData {
[FieldOffset(0)] public Vector2 Offset;
[FieldOffset(16)] public Vector3 Color;
public static uint SizeOf() => (uint)Unsafe.SizeOf<SimplePushConstantData>();
}
Pack property of LayoutKind.Sequential is for type aligment itself, but each field must align with fields of its own size (1, 2, 4, 8, etc., bytes) or the alignment of the type, whichever is smaller (source https://learn.microsoft.com/en-us/dotnet/api/system.runtime.interopservices.structlayoutattribute.pack?view=net-7.0)
Metadata
Metadata
Assignees
Labels
No labels