Added GroupSharedAttribute type

このコミットが含まれているのは:
Sergio Pedri committed 2021-01-11 18:08:25 +01:00
1 親 d3b2889078
コミット d6228da210
3ファイル変更
+48 -2

検索条件に一致するファイルはありません

+1 -1
ファイルの表示
@@ -5,7 +5,7 @@ namespace ComputeSharp
/// <summary>
/// An attribute that indicates that a target shader type should get an automatic constructor for all fields.
/// </summary>
[AttributeUsage(AttributeTargets.Struct)]
[AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)]
public sealed class AutoConstructorAttribute : Attribute
{
}
+46
ファイルの表示
@@ -0,0 +1,46 @@
using System;
namespace ComputeSharp
{
/// <summary>
/// An attribute that indicates that an array static field in a shader type will be shared in a thread group.
/// <para>
/// This attribute can be used to declare fields as follows:
/// <code>
/// struct MyShader : IComputeShader
/// {
/// [GroupShared(32)]
/// static float[] MyBuffer;
/// }
/// </code>
/// </para>
/// 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.
/// </summary>
[AttributeUsage(AttributeTargets.Field, AllowMultiple = false)]
public sealed class GroupSharedAttribute : Attribute
{
/// <summary>
/// Creates a new <see cref="GroupSharedAttribute"/> instance with the specified parameters.
/// </summary>
public GroupSharedAttribute()
{
}
/// <summary>
/// Creates a new <see cref="GroupSharedAttribute"/> instance with the specified parameters.
/// </summary>
/// <param name="size">The size of the shared buffer to declare.</param>
public GroupSharedAttribute(int size)
{
Size = size;
}
/// <summary>
/// Gets the size of the shared buffer being declared.
/// If <see langword="null"/>, the thread group size will be used.
/// </summary>
public int? Size { get; }
}
}
+1 -1
ファイルの表示
@@ -9,7 +9,7 @@ namespace ComputeSharp
/// correctly, wrapped methods need to have this attribute manually applied to them.
/// Methods also need to be static, though this can only be tested at runtime.
/// </summary>
[AttributeUsage(AttributeTargets.Method)]
[AttributeUsage(AttributeTargets.Method, AllowMultiple = false)]
public sealed class ShaderMethodAttribute : Attribute
{
}