From 35e5bd90a34186f7a0f0219541513f2eff4d4b88 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 6 Aug 2022 16:07:17 +0200 Subject: [PATCH] Add the D2DResourceIndexAttribute type --- .../Attributes/D2DResourceIndexAttribute.cs | 28 +++++++++++++++++++ 1 file changed, 28 insertions(+) create mode 100644 src/ComputeSharp.D2D1/Attributes/D2DResourceIndexAttribute.cs diff --git a/src/ComputeSharp.D2D1/Attributes/D2DResourceIndexAttribute.cs b/src/ComputeSharp.D2D1/Attributes/D2DResourceIndexAttribute.cs new file mode 100644 index 00000000..07fd076e --- /dev/null +++ b/src/ComputeSharp.D2D1/Attributes/D2DResourceIndexAttribute.cs @@ -0,0 +1,28 @@ +using System; + +namespace ComputeSharp.D2D1; + +/// +/// An attribute for a field in a D2D1 shader indicating the index of the D2D1 resource. +/// This is needed to bind an input resource in a shader to the correct input. Using this attribute is mandatory. +/// +/// +/// For more info, see . +/// +[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)] +public sealed class D2DResourceIndexAttribute : Attribute +{ + /// + /// Creates a new instance of the type with the specified arguments. + /// + /// The index of the annotated field. + public D2DResourceIndexAttribute(int index) + { + Index = index; + } + + /// + /// Gets the index of the annotated field. + /// + public int Index { get; } +}