using System;
namespace ComputeSharp
{
///
/// An attribute that indicates that an array static field in a shader type will be shared in a thread group.
///
/// This attribute can be used to declare fields as follows:
///
/// struct MyShader : IComputeShader
/// {
/// [GroupShared(32)]
/// static float[] MyBuffer;
/// }
///
///
/// The buffer shouldn't be manually initialized, as each shader invocation will automatically receive the
/// right buffer in use for the thread group it belongs to. If there is an assignment for the field, it
/// will just be ignored in the shader. Additionally, buffer types are not allowed as array items.
///
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
public sealed class GroupSharedAttribute : Attribute
{
///
/// Creates a new instance with the specified parameters.
///
public GroupSharedAttribute()
{
}
///
/// Creates a new instance with the specified parameters.
///
/// The size of the shared buffer to declare.
public GroupSharedAttribute(int size)
{
Size = size;
}
///
/// Gets the size of the shared buffer being declared.
/// If , the thread group size will be used.
///
public int? Size { get; }
}
}