Added .Shaders support for .NET Standard 2.0

このコミットが含まれているのは:
Sergio Pedri committed 2021-01-05 20:40:18 +01:00
1 親 e27547fb43
コミット 880f501b55
8ファイル変更
+146 -90

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

+12
ファイルの表示
@@ -54,10 +54,16 @@ namespace ComputeSharp.Shaders.Translation.Models
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
#if NET5_0
ref ulong r0 = ref MemoryMarshal.GetArrayDataReference(this.resourcesArray);
ref D3D12_GPU_DESCRIPTOR_HANDLE r1 = ref Unsafe.As<ulong, D3D12_GPU_DESCRIPTOR_HANDLE>(ref r0);
return MemoryMarshal.CreateReadOnlySpan(ref r1, this.resourcesCount);
#else
Span<ulong> span = this.resourcesArray.AsSpan(0, this.resourcesCount);
return MemoryMarshal.Cast<ulong, D3D12_GPU_DESCRIPTOR_HANDLE>(span);
#endif
}
}
@@ -69,11 +75,17 @@ namespace ComputeSharp.Shaders.Translation.Models
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
#if NET5_0
ref byte r0 = ref MemoryMarshal.GetArrayDataReference(this.variablesArray);
ref Int4 r1 = ref Unsafe.As<byte, Int4>(ref r0);
int length = (int)((uint)this.variablesByteSize / (uint)sizeof(Int4));
return MemoryMarshal.CreateReadOnlySpan(ref r1, length);
#else
Span<byte> span = this.variablesArray.AsSpan(0, this.variablesByteSize);
return MemoryMarshal.Cast<byte, Int4>(span);
#endif
}
}