diff --git a/src/AcDream.App/Rendering/Wb/WbDrawDispatcher.cs b/src/AcDream.App/Rendering/Wb/WbDrawDispatcher.cs index 07d33d1..d81360f 100644 --- a/src/AcDream.App/Rendering/Wb/WbDrawDispatcher.cs +++ b/src/AcDream.App/Rendering/Wb/WbDrawDispatcher.cs @@ -80,7 +80,13 @@ public sealed unsafe class WbDrawDispatcher : IDisposable private int _transparentByteOffset; #pragma warning restore CS0169 - [StructLayout(LayoutKind.Sequential, Pack = 4)] + // std430 layout: ulong TextureHandle (uvec2) at offset 0, uint TextureLayer + // at offset 8, uint Flags at offset 12. Total 16 bytes. + // Pack=8 (not 4) because std430's uvec2 requires 8-byte alignment — Pack=4 + // works today by accident (TextureHandle is the first field, so offset 0 is + // always 8-byte aligned), but adding a 4-byte field before TextureHandle + // without bumping Pack would silently misalign the GPU struct. + [StructLayout(LayoutKind.Sequential, Pack = 8)] private struct BatchData { public ulong TextureHandle; // bindless handle (uvec2 in GLSL)