ファイル
ComputeSharp/src/ComputeSharp.Core/Primitives/Internals/UndefinedData.cs
T

20 行
684 B
C#

#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));
}