using System;
namespace ComputeSharp
{
///
/// An attribute that indicates a field to declare in a custom struct type to use in a shader.
/// This is necessary to be used instead of manually declare fields, so that the fields can be
/// declared with the right offset into the type data, as HLSL requires precise alignment for values.
///
[AttributeUsage(AttributeTargets.Struct, AllowMultiple = true)]
public sealed class FieldAttribute : Attribute
{
///
/// Creates a new instance with the specified parameters.
///
/// The name of the field to declare.
/// The type of field to declare.
public FieldAttribute(string name, Type type)
{
Name = name;
Type = type;
}
///
/// Gets the name of the field to declare.
///
public string Name { get; }
///
/// Gets the type of the field to declare.
///
public Type Type { get; }
///
/// Gets the optional summary for the field to declare.
///
public string? Summary { get; init; }
}
}