Unify all undefined data for HLSL primitive types

このコミットが含まれているのは:
Sergio Pedri committed 2023-10-08 17:59:35 +02:00
1 親 98397f9390
コミット 0af7f53ae7
26ファイル変更
+5173 -5702

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

+19
ファイルの表示
@@ -0,0 +1,19 @@
#if NET6_0_OR_GREATER
using System.Runtime.CompilerServices;
#else
using RuntimeHelpers = ComputeSharp.NetStandard.RuntimeHelpers;
#endif
namespace ComputeSharp;
/// <summary>
/// A helper class with shared undefined data for all HLSL primitive types.
/// This reduces allocations and minimizes reflection metadata kept per type.
/// </summary>
internal static class UndefinedData
{
/// <summary>
/// The shared memory with undefined data (has size of <see cref="Double4"/>, as it's the maximum needed at once).
/// </summary>
public static readonly unsafe void* Memory = (void*)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(UndefinedData), sizeof(Double4));
}