diff --git a/src/ComputeSharp.D2D1Interop.NetStandard/ComputeSharp.D2D1Interop.NetStandard.projitems b/src/ComputeSharp.D2D1Interop.NetStandard/ComputeSharp.D2D1Interop.NetStandard.projitems
index f8dad006..6221a613 100644
--- a/src/ComputeSharp.D2D1Interop.NetStandard/ComputeSharp.D2D1Interop.NetStandard.projitems
+++ b/src/ComputeSharp.D2D1Interop.NetStandard/ComputeSharp.D2D1Interop.NetStandard.projitems
@@ -9,6 +9,9 @@
ComputeSharp.D2D1Interop.NetStandard
-
+
+
+
+
\ No newline at end of file
diff --git a/src/ComputeSharp.D2D1Interop.NetStandard/System/Diagnostics.CodeAnalysis/DoesNotReturnAttribute.cs b/src/ComputeSharp.D2D1Interop.NetStandard/System/Diagnostics.CodeAnalysis/DoesNotReturnAttribute.cs
new file mode 100644
index 00000000..1c6a222e
--- /dev/null
+++ b/src/ComputeSharp.D2D1Interop.NetStandard/System/Diagnostics.CodeAnalysis/DoesNotReturnAttribute.cs
@@ -0,0 +1,14 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace System.Diagnostics.CodeAnalysis;
+
+///
+/// Applied to a method that will never return under any circumstance.
+///
+/// Internal copy from the BCL attribute.
+[AttributeUsage(AttributeTargets.Method, Inherited = false)]
+internal sealed class DoesNotReturnAttribute : Attribute
+{
+}
\ No newline at end of file
diff --git a/src/ComputeSharp.D2D1Interop.NetStandard/System.Runtime.CompilerServices/RuntimeHelpers.cs b/src/ComputeSharp.D2D1Interop.NetStandard/System/Runtime.CompilerServices/RuntimeHelpers.cs
similarity index 100%
rename from src/ComputeSharp.D2D1Interop.NetStandard/System.Runtime.CompilerServices/RuntimeHelpers.cs
rename to src/ComputeSharp.D2D1Interop.NetStandard/System/Runtime.CompilerServices/RuntimeHelpers.cs
diff --git a/src/ComputeSharp.D2D1Interop.NetStandard/System/Text/EncodingExtensions.cs b/src/ComputeSharp.D2D1Interop.NetStandard/System/Text/EncodingExtensions.cs
new file mode 100644
index 00000000..7d1e31e3
--- /dev/null
+++ b/src/ComputeSharp.D2D1Interop.NetStandard/System/Text/EncodingExtensions.cs
@@ -0,0 +1,27 @@
+using System;
+using System.Runtime.InteropServices;
+using System.Text;
+
+namespace ComputeSharp.D2D1Interop.NetStandard.System.Text;
+
+///
+/// A polyfill type that mirrors some methods from on .NET 5.
+///
+internal static class EncodingExtensions
+{
+ ///
+ /// Encodes into a span of bytes a set of characters from the specified read-only span.
+ ///
+ /// The input instance to use.
+ /// The span containing the set of characters to encode.
+ /// The byte span to hold the encoded bytes.
+ /// The number of encoded bytes.
+ public static unsafe int GetBytes(this Encoding encoding, ReadOnlySpan chars, Span bytes)
+ {
+ fixed (char* charsPtr = &MemoryMarshal.GetReference(chars))
+ fixed (byte* bytesPtr = &MemoryMarshal.GetReference(bytes))
+ {
+ return encoding.GetBytes(charsPtr, chars.Length, bytesPtr, bytes.Length);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/ComputeSharp.D2D1Interop/ComputeSharp.D2D1Interop.csproj b/src/ComputeSharp.D2D1Interop/ComputeSharp.D2D1Interop.csproj
index 2c78a08b..5cb71139 100644
--- a/src/ComputeSharp.D2D1Interop/ComputeSharp.D2D1Interop.csproj
+++ b/src/ComputeSharp.D2D1Interop/ComputeSharp.D2D1Interop.csproj
@@ -1,19 +1,28 @@
- net6.0
+ netstandard2.0;net6.0
bin\Release
ComputeSharp.D2D1Interop.xml
AnyCPU;x64;ARM64
+
+
+
+
+
+
-
+
true
false
+
-
+
+
+
diff --git a/src/ComputeSharp.D2D1Interop/Shaders/Translation/D2D1ShaderCompiler.cs b/src/ComputeSharp.D2D1Interop/Shaders/Translation/D2D1ShaderCompiler.cs
index 68da8cf6..aaf9553b 100644
--- a/src/ComputeSharp.D2D1Interop/Shaders/Translation/D2D1ShaderCompiler.cs
+++ b/src/ComputeSharp.D2D1Interop/Shaders/Translation/D2D1ShaderCompiler.cs
@@ -6,6 +6,9 @@ using System.Runtime.InteropServices;
using System.Text;
using ComputeSharp.D2D1Interop.Exceptions;
using ComputeSharp.D2D1Interop.Extensions;
+#if !NET6_0_OR_GREATER
+using ComputeSharp.D2D1Interop.NetStandard.System.Text;
+#endif
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1DrawInfo.cs b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1DrawInfo.cs
index 1d6dce80..5f3fc333 100644
--- a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1DrawInfo.cs
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1DrawInfo.cs
@@ -23,7 +23,7 @@ namespace TerraFX.Interop.DirectX
[VtblIndex(7)]
public HRESULT SetPixelShaderConstantBuffer([NativeTypeName("const BYTE *")] byte* buffer, [NativeTypeName("UINT32")] uint bufferCount)
{
- return ((delegate* unmanaged)(lpVtbl[7]))((ID2D1DrawInfo*)Unsafe.AsPointer(ref this), buffer, bufferCount);
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[7]))((ID2D1DrawInfo*)Unsafe.AsPointer(ref this), buffer, bufferCount);
}
}
}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d3d11shadeer/ID3D11ShaderReflection.cs b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d3d11shadeer/ID3D11ShaderReflection.cs
index fa515209..ed1349c1 100644
--- a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d3d11shadeer/ID3D11ShaderReflection.cs
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d3d11shadeer/ID3D11ShaderReflection.cs
@@ -24,7 +24,7 @@ namespace TerraFX.Interop.DirectX
[VtblIndex(0)]
public HRESULT QueryInterface([NativeTypeName("const IID &")] Guid* riid, void** ppvObject)
{
- return ((delegate* unmanaged)(lpVtbl[0]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this), riid, ppvObject);
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[0]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this), riid, ppvObject);
}
///
@@ -33,7 +33,7 @@ namespace TerraFX.Interop.DirectX
[return: NativeTypeName("ULONG")]
public uint AddRef()
{
- return ((delegate* unmanaged)(lpVtbl[1]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[1]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
///
@@ -42,63 +42,63 @@ namespace TerraFX.Interop.DirectX
[return: NativeTypeName("ULONG")]
public uint Release()
{
- return ((delegate* unmanaged)(lpVtbl[2]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[2]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(3)]
public HRESULT GetDesc(D3D11_SHADER_DESC* pDesc)
{
- return ((delegate* unmanaged)(lpVtbl[3]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this), pDesc);
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this), pDesc);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(12)]
public uint GetMovInstructionCount()
{
- return ((delegate* unmanaged)(lpVtbl[12]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[12]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(13)]
public uint GetMovcInstructionCount()
{
- return ((delegate* unmanaged)(lpVtbl[13]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[13]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(14)]
public uint GetConversionInstructionCount()
{
- return ((delegate* unmanaged)(lpVtbl[14]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[14]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(15)]
public uint GetBitwiseInstructionCount()
{
- return ((delegate* unmanaged)(lpVtbl[15]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[15]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(16)]
public D3D_PRIMITIVE GetGSInputPrimitive()
{
- return ((delegate* unmanaged)(lpVtbl[16]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[16]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(18)]
public uint GetNumInterfaceSlots()
{
- return ((delegate* unmanaged)(lpVtbl[18]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[18]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[VtblIndex(20)]
public uint GetThreadGroupSize(uint* pSizeX, uint* pSizeY, uint* pSizeZ)
{
- return ((delegate* unmanaged)(lpVtbl[20]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this), pSizeX, pSizeY, pSizeZ);
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[20]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this), pSizeX, pSizeY, pSizeZ);
}
[MethodImpl(MethodImplOptions.AggressiveInlining)]
@@ -106,7 +106,7 @@ namespace TerraFX.Interop.DirectX
[return: NativeTypeName("UINT64")]
public ulong GetRequiresFlags()
{
- return ((delegate* unmanaged)(lpVtbl[21]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[21]))((ID3D11ShaderReflection*)Unsafe.AsPointer(ref this));
}
}
}
\ No newline at end of file