From fc56e7b99934e5c1a8c88bc357fa6241efc37863 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Thu, 2 Nov 2023 02:31:25 +0100 Subject: [PATCH] Use [InlineArray] in GraphicsEffectSourceBuffer --- .../Buffers/GraphicsEffectSourceBuffer.cs | 103 +----------------- 1 file changed, 4 insertions(+), 99 deletions(-) diff --git a/src/ComputeSharp.D2D1.WinUI/Buffers/GraphicsEffectSourceBuffer.cs b/src/ComputeSharp.D2D1.WinUI/Buffers/GraphicsEffectSourceBuffer.cs index 34502c69..a6db6977 100644 --- a/src/ComputeSharp.D2D1.WinUI/Buffers/GraphicsEffectSourceBuffer.cs +++ b/src/ComputeSharp.D2D1.WinUI/Buffers/GraphicsEffectSourceBuffer.cs @@ -1,113 +1,18 @@ -using System; -using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using Windows.Graphics.Effects; +#pragma warning disable IDE0051 + namespace ComputeSharp.D2D1.WinUI.Buffers; /// /// A fixed buffer type containing 16 fields. /// +[InlineArray(16)] internal struct GraphicsEffectSourceBuffer { /// /// The instance at index 0. /// - public SourceReference Source0; - - /// - /// The instance at index 1. - /// - public SourceReference Source1; - - /// - /// The instance at index 2. - /// - public SourceReference Source2; - - /// - /// The instance at index 3. - /// - public SourceReference Source3; - - /// - /// The instance at index 4. - /// - public SourceReference Source4; - - /// - /// The instance at index 5. - /// - public SourceReference Source5; - - /// - /// The instance at index 6. - /// - public SourceReference Source6; - - /// - /// The instance at index 7. - /// - public SourceReference Source7; - - /// - /// The instance at index 8. - /// - public SourceReference Source8; - - /// - /// The instance at index 9. - /// - public SourceReference Source9; - - /// - /// The instance at index 10. - /// - public SourceReference Source10; - - /// - /// The instance at index 11. - /// - public SourceReference Source11; - - /// - /// The instance at index 12. - /// - public SourceReference Source12; - - /// - /// The instance at index 13. - /// - public SourceReference Source13; - - /// - /// The instance at index 14. - /// - public SourceReference Source14; - - /// - /// The instance at index 15. - /// - public SourceReference Source15; - - /// - /// Gets a reference to the value at a given index. - /// - /// The index of the value to get a reference to. - /// A reference to the value at a given index. - /// Thrown if is not a valid index for the current effect. - [UnscopedRef] - public ref SourceReference this[int index] - { - [MethodImpl(MethodImplOptions.AggressiveInlining)] - get - { - default(ArgumentOutOfRangeException).ThrowIfNotInRange(index, 0, 16); - - ref SourceReference r0 = ref Unsafe.As(ref this); - ref SourceReference r1 = ref Unsafe.Add(ref r0, index); - - return ref r1; - } - } + private SourceReference source0; } \ No newline at end of file