You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
[StructLayout(LayoutKind.Explicit)]
public struct SimplePushConstantData {
[FieldOffset(0)] public Vector2 Offset;
[FieldOffset(16)] public Vector3 Color;
public static uint SizeOf() => (uint)Unsafe.SizeOf<SimplePushConstantData>();
}
https://github.com/stymee/SilkVulkanTutorial/blob/7d089b0f4f947bfcd152b657b8db9a27ca7fceba/Source/Chapter09PushConstants/FirstApp.cs#L30C17-L30C17
Here you can do something like this
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)