Added AutoConstructorAttribute type

このコミットが含まれているのは:
Sergio Pedri committed 2020-11-26 18:29:17 +01:00
1 親 0f9d370455
コミット 9a95e5d6f1
4ファイル変更
+66 -2

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

+1 -1
ファイルの表示
@@ -3,7 +3,7 @@
namespace ComputeSharp
{
/// <summary>
/// A shader that indicates that a target shader type should get an automatic constructor for all fields.
/// An attribute that indicates that a target shader type should get an automatic constructor for all fields.
/// </summary>
[AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)]
public sealed class AutoConstructorAttribute : Attribute
+44
ファイルの表示
@@ -0,0 +1,44 @@
using System;
namespace ComputeSharp
{
/// <summary>
/// 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.
/// </summary>
[AttributeUsage(AttributeTargets.Struct, AllowMultiple = false)]
public sealed class FieldAttribute : Attribute
{
/// <summary>
/// Creates a new <see cref="FieldAttribute"/> instance with the specified parameters.
/// </summary>
/// <param name="name">The name of the field to declare.</param>
/// <param name="type">The type of field to declare.</param>
public FieldAttribute(string name, Type type)
{
Name = name;
Type = type;
}
/// <summary>
/// Gets the name of the field to declare.
/// </summary>
public string Name { get; }
/// <summary>
/// Gets the type of the field to declare.
/// </summary>
public Type Type { get; }
/// <summary>
/// Gets the optional summary for the field to declare.
/// </summary>
public string? Summary { get; init; }
/// <summary>
/// Gets the optional remarks for the field to declare.
/// </summary>
public string? Remarks { get; init; }
}
}
+1 -1
ファイルの表示
@@ -8,7 +8,7 @@ using System.Reflection;
namespace ComputeSharp
{
/// <summary>
/// A shader that indicates that a target shader type should get an automatic constructor for all fields.
/// An attribute that indicates that a target shader type should get an automatic constructor for all fields.
/// This attribute is not meant to be directly used by applications using ComputeSharp.
/// </summary>
[AttributeUsage(AttributeTargets.Assembly, AllowMultiple = true)]
+20
ファイルの表示
@@ -0,0 +1,20 @@
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
#if !NET5_0
using System.ComponentModel;
namespace System.Runtime.CompilerServices
{
/// <summary>
/// Reserved to be used by the compiler for tracking metadata.
/// This class should not be used by developers in source code.
/// </summary>
[EditorBrowsable(EditorBrowsableState.Never)]
internal static class IsExternalInit
{
}
}
#endif