static SupportBuffer() { FieldSize = Unsafe.SizeOf <Vector4 <float> >(); RequiredSize = Unsafe.SizeOf <SupportBuffer>(); SupportBuffer instance = new SupportBuffer(); FragmentAlphaTestOffset = OffsetOf(ref instance, ref instance.FragmentAlphaTest); FragmentIsBgraOffset = OffsetOf(ref instance, ref instance.FragmentIsBgra); FragmentRenderScaleCountOffset = OffsetOf(ref instance, ref instance.FragmentRenderScaleCount); GraphicsRenderScaleOffset = OffsetOf(ref instance, ref instance.RenderScale); ComputeRenderScaleOffset = GraphicsRenderScaleOffset + FieldSize; }
private static int OffsetOf <T>(ref SupportBuffer storage, ref T target) { return((int)Unsafe.ByteOffset(ref Unsafe.As <SupportBuffer, T>(ref storage), ref target)); }