diff --git a/src/ComputeSharp/Core/Imaging/Bgra32.cs b/src/ComputeSharp/Core/Imaging/Bgra32.cs index 1c2e6393..d73398a1 100644 --- a/src/ComputeSharp/Core/Imaging/Bgra32.cs +++ b/src/ComputeSharp/Core/Imaging/Bgra32.cs @@ -2,10 +2,8 @@ using System; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -#if NET6_0_OR_GREATER using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; -#endif namespace ComputeSharp; @@ -19,10 +17,7 @@ namespace ComputeSharp; /// /// This struct is fully mutable. [StructLayout(LayoutKind.Sequential)] -public struct Bgra32 : IEquatable, IPixel -#if NET6_0_OR_GREATER - , ISpanFormattable -#endif +public struct Bgra32 : IEquatable, IPixel, ISpanFormattable { /// /// The blue component. @@ -91,7 +86,6 @@ public struct Bgra32 : IEquatable, IPixel [MethodImpl(MethodImplOptions.AggressiveInlining)] public readonly Float4 ToPixel() { -#if NET6_0_OR_GREATER if (Sse2.IsSupported) { int pack = Unsafe.As(ref Unsafe.AsRef(in this)); @@ -106,7 +100,7 @@ public struct Bgra32 : IEquatable, IPixel return vNorm.AsVector4(); } -#endif + Vector4 linear = new(this.R, this.G, this.B, this.A); Vector4 normalized = linear / byte.MaxValue; @@ -161,7 +155,6 @@ public struct Bgra32 : IEquatable, IPixel return $"{nameof(Bgra32)}({this.B}, {this.G}, {this.R}, {this.A})"; } -#if NET6_0_OR_GREATER /// public string ToString(string? format, IFormatProvider? formatProvider) { @@ -173,5 +166,4 @@ public struct Bgra32 : IEquatable, IPixel { return destination.TryWrite(provider, $"{nameof(Bgra32)}({this.B}, {this.G}, {this.R}, {this.A})", out charsWritten); } -#endif } \ No newline at end of file diff --git a/src/ComputeSharp/Core/Imaging/R16.cs b/src/ComputeSharp/Core/Imaging/R16.cs index 35b61732..f898ab70 100644 --- a/src/ComputeSharp/Core/Imaging/R16.cs +++ b/src/ComputeSharp/Core/Imaging/R16.cs @@ -11,10 +11,7 @@ namespace ComputeSharp; /// /// [StructLayout(LayoutKind.Sequential)] -public struct R16 : IEquatable, IPixel -#if NET6_0_OR_GREATER - , ISpanFormattable -#endif +public struct R16 : IEquatable, IPixel, ISpanFormattable { /// /// The red component. @@ -97,7 +94,6 @@ public struct R16 : IEquatable, IPixel return $"{nameof(R16)}({this.R})"; } -#if NET6_0_OR_GREATER /// public string ToString(string? format, IFormatProvider? formatProvider) { @@ -109,5 +105,4 @@ public struct R16 : IEquatable, IPixel { return destination.TryWrite(provider, $"{nameof(R16)}({this.R})", out charsWritten); } -#endif } \ No newline at end of file diff --git a/src/ComputeSharp/Core/Imaging/R8.cs b/src/ComputeSharp/Core/Imaging/R8.cs index d46c8315..c6f1c169 100644 --- a/src/ComputeSharp/Core/Imaging/R8.cs +++ b/src/ComputeSharp/Core/Imaging/R8.cs @@ -11,10 +11,7 @@ namespace ComputeSharp; /// /// [StructLayout(LayoutKind.Sequential)] -public struct R8 : IEquatable, IPixel -#if NET6_0_OR_GREATER - , ISpanFormattable -#endif +public struct R8 : IEquatable, IPixel, ISpanFormattable { /// /// The red component. @@ -97,7 +94,6 @@ public struct R8 : IEquatable, IPixel return $"{nameof(R8)}({this.R})"; } -#if NET6_0_OR_GREATER /// public string ToString(string? format, IFormatProvider? formatProvider) { @@ -109,5 +105,4 @@ public struct R8 : IEquatable, IPixel { return destination.TryWrite(provider, $"{nameof(R8)}({this.R})", out charsWritten); } -#endif } \ No newline at end of file diff --git a/src/ComputeSharp/Core/Imaging/Rg16.cs b/src/ComputeSharp/Core/Imaging/Rg16.cs index 1ae01ab8..19092181 100644 --- a/src/ComputeSharp/Core/Imaging/Rg16.cs +++ b/src/ComputeSharp/Core/Imaging/Rg16.cs @@ -11,10 +11,7 @@ namespace ComputeSharp; /// /// [StructLayout(LayoutKind.Sequential)] -public struct Rg16 : IEquatable, IPixel -#if NET6_0_OR_GREATER - , ISpanFormattable -#endif +public struct Rg16 : IEquatable, IPixel, ISpanFormattable { /// /// The red component. @@ -104,7 +101,6 @@ public struct Rg16 : IEquatable, IPixel return $"{nameof(Rg16)}({this.R}, {this.G})"; } -#if NET6_0_OR_GREATER /// public string ToString(string? format, IFormatProvider? formatProvider) { @@ -116,5 +112,4 @@ public struct Rg16 : IEquatable, IPixel { return destination.TryWrite(provider, $"{nameof(Rg16)}({this.R}, {this.G})", out charsWritten); } -#endif } \ No newline at end of file diff --git a/src/ComputeSharp/Core/Imaging/Rg32.cs b/src/ComputeSharp/Core/Imaging/Rg32.cs index 3262b123..45d63aee 100644 --- a/src/ComputeSharp/Core/Imaging/Rg32.cs +++ b/src/ComputeSharp/Core/Imaging/Rg32.cs @@ -11,10 +11,7 @@ namespace ComputeSharp; /// /// [StructLayout(LayoutKind.Sequential)] -public struct Rg32 : IEquatable, IPixel -#if NET6_0_OR_GREATER - , ISpanFormattable -#endif +public struct Rg32 : IEquatable, IPixel, ISpanFormattable { /// /// The red component. @@ -104,7 +101,6 @@ public struct Rg32 : IEquatable, IPixel return $"{nameof(Rg32)}({this.R}, {this.G})"; } -#if NET6_0_OR_GREATER /// public string ToString(string? format, IFormatProvider? formatProvider) { @@ -116,5 +112,4 @@ public struct Rg32 : IEquatable, IPixel { return destination.TryWrite(provider, $"{nameof(Rg32)}({this.R}, {this.G})", out charsWritten); } -#endif } \ No newline at end of file diff --git a/src/ComputeSharp/Core/Imaging/Rgba32.cs b/src/ComputeSharp/Core/Imaging/Rgba32.cs index 61fc1f32..1ac835da 100644 --- a/src/ComputeSharp/Core/Imaging/Rgba32.cs +++ b/src/ComputeSharp/Core/Imaging/Rgba32.cs @@ -2,10 +2,8 @@ using System; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -#if NET6_0_OR_GREATER using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; -#endif namespace ComputeSharp; @@ -18,10 +16,7 @@ namespace ComputeSharp; /// /// This struct is fully mutable. [StructLayout(LayoutKind.Sequential)] -public struct Rgba32 : IEquatable, IPixel -#if NET6_0_OR_GREATER - , ISpanFormattable -#endif +public struct Rgba32 : IEquatable, IPixel, ISpanFormattable { /// /// The red component. @@ -90,7 +85,6 @@ public struct Rgba32 : IEquatable, IPixel [MethodImpl(MethodImplOptions.AggressiveInlining)] public readonly Float4 ToPixel() { -#if NET6_0_OR_GREATER if (Sse2.IsSupported) { int pack = Unsafe.As(ref Unsafe.AsRef(in this)); @@ -104,7 +98,7 @@ public struct Rgba32 : IEquatable, IPixel return vNorm.AsVector4(); } -#endif + Vector4 linear = new(this.R, this.G, this.B, this.A); Vector4 normalized = linear / byte.MaxValue; @@ -159,7 +153,6 @@ public struct Rgba32 : IEquatable, IPixel return $"{nameof(Rgba32)}({this.R}, {this.G}, {this.B}, {this.A})"; } -#if NET6_0_OR_GREATER /// public string ToString(string? format, IFormatProvider? formatProvider) { @@ -171,5 +164,4 @@ public struct Rgba32 : IEquatable, IPixel { return destination.TryWrite(provider, $"{nameof(Rgba32)}({this.R}, {this.G}, {this.B}, {this.A})", out charsWritten); } -#endif } \ No newline at end of file diff --git a/src/ComputeSharp/Core/Imaging/Rgba64.cs b/src/ComputeSharp/Core/Imaging/Rgba64.cs index 51f9e3a3..d65aea56 100644 --- a/src/ComputeSharp/Core/Imaging/Rgba64.cs +++ b/src/ComputeSharp/Core/Imaging/Rgba64.cs @@ -2,10 +2,8 @@ using System; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -#if NET6_0_OR_GREATER using System.Runtime.Intrinsics; using System.Runtime.Intrinsics.X86; -#endif namespace ComputeSharp; @@ -18,10 +16,7 @@ namespace ComputeSharp; /// /// This struct is fully mutable. [StructLayout(LayoutKind.Sequential)] -public struct Rgba64 : IEquatable, IPixel -#if NET6_0_OR_GREATER - , ISpanFormattable -#endif +public struct Rgba64 : IEquatable, IPixel, ISpanFormattable { /// /// The red component. @@ -90,7 +85,6 @@ public struct Rgba64 : IEquatable, IPixel [MethodImpl(MethodImplOptions.AggressiveInlining)] public readonly Float4 ToPixel() { -#if NET6_0_OR_GREATER if (Sse2.IsSupported) { long pack = Unsafe.As(ref Unsafe.AsRef(in this)); @@ -102,7 +96,7 @@ public struct Rgba64 : IEquatable, IPixel return vNorm.AsVector4(); } -#endif + Vector4 linear = new(this.R, this.G, this.B, this.A); Vector4 normalized = linear / ushort.MaxValue; @@ -157,7 +151,6 @@ public struct Rgba64 : IEquatable, IPixel return $"{nameof(Rgba64)}({this.R}, {this.G}, {this.B}, {this.A})"; } -#if NET6_0_OR_GREATER /// public string ToString(string? format, IFormatProvider? formatProvider) { @@ -169,5 +162,4 @@ public struct Rgba64 : IEquatable, IPixel { return destination.TryWrite(provider, $"{nameof(Rgba64)}({this.R}, {this.G}, {this.B}, {this.A})", out charsWritten); } -#endif } \ No newline at end of file diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/ComPtrExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/ComPtrExtensions.cs index cc1dd87e..33690232 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/ComPtrExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/ComPtrExtensions.cs @@ -16,11 +16,7 @@ internal static class ComPtrExtensions /// The moved instance. [MethodImpl(MethodImplOptions.AggressiveInlining)] public static unsafe ComPtr Move(this in ComPtr ptr) -#if NET6_0_OR_GREATER where T : unmanaged//, IUnknown.Interface -#else - where T : unmanaged -#endif { ComPtr copy = default; diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs index fc4e69e7..ba509cb3 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.IBufferWriter.cs @@ -35,141 +35,10 @@ unsafe partial class IWICStreamExtensions /// /// A manual CCW implementation for an object wrapping an instance. /// - private unsafe partial struct IBufferWriterWrapper -#if NET6_0_OR_GREATER - //: IUnknown.Interface -#endif + private unsafe partial struct IBufferWriterWrapper //: IUnknown.Interface { -#if NET6_0_OR_GREATER ///// //static Guid* INativeGuid.NativeGuid => (Guid*)default(NotSupportedException).Throw(); -#else - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate int QueryInterfaceDelegate(IBufferWriterWrapper* @this, Guid* riid, void** ppvObject); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate uint AddRefDelegate(IBufferWriterWrapper* @this); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate uint ReleaseDelegate(IBufferWriterWrapper* @this); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT ReadDelegate(IBufferWriterWrapper* @this, void* pv, uint cb, uint* pcbRead); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT WriteDelegate(IBufferWriterWrapper* @this, void* pv, uint cb, uint* pcbWritten); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT SeekDelegate(IBufferWriterWrapper* @this, LARGE_INTEGER dlibMove, uint dwOrigin, ULARGE_INTEGER* plibNewPosition); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT SetSizeDelegate(IBufferWriterWrapper* @this, ULARGE_INTEGER libNewSize); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT CopyToDelegate(IBufferWriterWrapper* @this, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT CommitDelegate(IBufferWriterWrapper* @this, uint grfCommitFlags); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT RevertDelegate(IBufferWriterWrapper* @this); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT LockRegionDelegate(IBufferWriterWrapper* @this, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT UnlockRegionDelegate(IBufferWriterWrapper* @this, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT StatDelegate(IBufferWriterWrapper* @this, STATSTG* pstatstg, uint grfStatFlag); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT CloneDelegate(IBufferWriterWrapper* @this, IStream** ppstm); - - /// - /// A cached instance wrapping . - /// - private static readonly QueryInterfaceDelegate QueryInterfaceWrapper = QueryInterface; - - /// - /// A cached instance wrapping . - /// - private static readonly AddRefDelegate AddRefWrapper = AddRef; - - /// - /// A cached instance wrapping . - /// - private static readonly ReleaseDelegate ReleaseWrapper = Release; - - /// - /// A cached instance wrapping . - /// - private static readonly ReadDelegate ReadWrapper = Read; - - /// - /// A cached instance wrapping . - /// - private static readonly WriteDelegate WriteWrapper = Write; - - /// - /// A cached instance wrapping . - /// - private static readonly SeekDelegate SeekWrapper = Seek; - - /// - /// A cached instance wrapping . - /// - private static readonly SetSizeDelegate SetSizeWrapper = SetSize; - - /// - /// A cached instance wrapping . - /// - private static readonly CopyToDelegate CopyToWrapper = CopyTo; - - /// - /// A cached instance wrapping . - /// - private static readonly CommitDelegate CommitWrapper = Commit; - - /// - /// A cached instance wrapping . - /// - private static readonly RevertDelegate RevertWrapper = Revert; - - /// - /// A cached instance wrapping . - /// - private static readonly LockRegionDelegate LockRegionWrapper = LockRegion; - - /// - /// A cached instance wrapping . - /// - private static readonly UnlockRegionDelegate UnlockRegionWrapper = UnlockRegion; - - /// - /// A cached instance wrapping . - /// - private static readonly StatDelegate StatWrapper = Stat; - - /// - /// A cached instance wrapping . - /// - private static readonly CloneDelegate CloneWrapper = Clone; -#endif /// /// The shared vtable pointer for instances. @@ -184,7 +53,6 @@ unsafe partial class IWICStreamExtensions { void** lpVtbl = (void**)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(IBufferWriterWrapper), sizeof(void*) * 14); -#if NET6_0_OR_GREATER lpVtbl[0] = (delegate* unmanaged)&QueryInterface; lpVtbl[1] = (delegate* unmanaged)&AddRef; lpVtbl[2] = (delegate* unmanaged)&Release; @@ -199,22 +67,6 @@ unsafe partial class IWICStreamExtensions lpVtbl[11] = (delegate* unmanaged)&UnlockRegion; lpVtbl[12] = (delegate* unmanaged)&Stat; lpVtbl[13] = (delegate* unmanaged)&Clone; -#else - lpVtbl[0] = (void*)Marshal.GetFunctionPointerForDelegate(QueryInterfaceWrapper); - lpVtbl[1] = (void*)Marshal.GetFunctionPointerForDelegate(AddRefWrapper); - lpVtbl[2] = (void*)Marshal.GetFunctionPointerForDelegate(ReleaseWrapper); - lpVtbl[3] = (void*)Marshal.GetFunctionPointerForDelegate(ReadWrapper); - lpVtbl[4] = (void*)Marshal.GetFunctionPointerForDelegate(WriteWrapper); - lpVtbl[5] = (void*)Marshal.GetFunctionPointerForDelegate(SeekWrapper); - lpVtbl[6] = (void*)Marshal.GetFunctionPointerForDelegate(SetSizeWrapper); - lpVtbl[7] = (void*)Marshal.GetFunctionPointerForDelegate(CopyToWrapper); - lpVtbl[8] = (void*)Marshal.GetFunctionPointerForDelegate(CommitWrapper); - lpVtbl[9] = (void*)Marshal.GetFunctionPointerForDelegate(RevertWrapper); - lpVtbl[10] = (void*)Marshal.GetFunctionPointerForDelegate(LockRegionWrapper); - lpVtbl[11] = (void*)Marshal.GetFunctionPointerForDelegate(UnlockRegionWrapper); - lpVtbl[12] = (void*)Marshal.GetFunctionPointerForDelegate(StatWrapper); - lpVtbl[13] = (void*)Marshal.GetFunctionPointerForDelegate(CloneWrapper); -#endif return lpVtbl; } @@ -260,25 +112,23 @@ unsafe partial class IWICStreamExtensions return Unsafe.As>(this.writerHandle.Target!); } -#if NET6_0_OR_GREATER /// - public HRESULT QueryInterface(Guid* riid, void** ppvObject) + private HRESULT QueryInterface(Guid* riid, void** ppvObject) { return ((delegate* unmanaged)this.lpVtbl[0])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this), riid, ppvObject); } /// - public uint AddRef() + private uint AddRef() { return ((delegate* unmanaged)this.lpVtbl[1])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this)); } /// - public uint Release() + private uint Release() { return ((delegate* unmanaged)this.lpVtbl[2])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this)); } -#endif /// [UnmanagedCallersOnly] diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs index 33669a79..926e6948 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs @@ -37,141 +37,10 @@ internal static unsafe partial class IWICStreamExtensions /// /// A manual CCW implementation for an object wrapping a instance. /// - private unsafe partial struct IStreamWrapper -#if NET6_0_OR_GREATER - //: IUnknown.Interface -#endif + private unsafe partial struct IStreamWrapper //: IUnknown.Interface { -#if NET6_0_OR_GREATER ///// //static Guid* INativeGuid.NativeGuid => (Guid*)default(NotSupportedException).Throw(); -#else - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate int QueryInterfaceDelegate(IStreamWrapper* @this, Guid* riid, void** ppvObject); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate uint AddRefDelegate(IStreamWrapper* @this); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate uint ReleaseDelegate(IStreamWrapper* @this); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT ReadDelegate(IStreamWrapper* @this, void* pv, uint cb, uint* pcbRead); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT WriteDelegate(IStreamWrapper* @this, void* pv, uint cb, uint* pcbWritten); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT SeekDelegate(IStreamWrapper* @this, LARGE_INTEGER dlibMove, uint dwOrigin, ULARGE_INTEGER* plibNewPosition); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT SetSizeDelegate(IStreamWrapper* @this, ULARGE_INTEGER libNewSize); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT CopyToDelegate(IStreamWrapper* @this, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT CommitDelegate(IStreamWrapper* @this, uint grfCommitFlags); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT RevertDelegate(IStreamWrapper* @this); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT LockRegionDelegate(IStreamWrapper* @this, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT UnlockRegionDelegate(IStreamWrapper* @this, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT StatDelegate(IStreamWrapper* @this, STATSTG* pstatstg, uint grfStatFlag); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate HRESULT CloneDelegate(IStreamWrapper* @this, IStream** ppstm); - - /// - /// A cached instance wrapping . - /// - private static readonly QueryInterfaceDelegate QueryInterfaceWrapper = QueryInterface; - - /// - /// A cached instance wrapping . - /// - private static readonly AddRefDelegate AddRefWrapper = AddRef; - - /// - /// A cached instance wrapping . - /// - private static readonly ReleaseDelegate ReleaseWrapper = Release; - - /// - /// A cached instance wrapping . - /// - private static readonly ReadDelegate ReadWrapper = Read; - - /// - /// A cached instance wrapping . - /// - private static readonly WriteDelegate WriteWrapper = Write; - - /// - /// A cached instance wrapping . - /// - private static readonly SeekDelegate SeekWrapper = Seek; - - /// - /// A cached instance wrapping . - /// - private static readonly SetSizeDelegate SetSizeWrapper = SetSize; - - /// - /// A cached instance wrapping . - /// - private static readonly CopyToDelegate CopyToWrapper = CopyTo; - - /// - /// A cached instance wrapping . - /// - private static readonly CommitDelegate CommitWrapper = Commit; - - /// - /// A cached instance wrapping . - /// - private static readonly RevertDelegate RevertWrapper = Revert; - - /// - /// A cached instance wrapping . - /// - private static readonly LockRegionDelegate LockRegionWrapper = LockRegion; - - /// - /// A cached instance wrapping . - /// - private static readonly UnlockRegionDelegate UnlockRegionWrapper = UnlockRegion; - - /// - /// A cached instance wrapping . - /// - private static readonly StatDelegate StatWrapper = Stat; - - /// - /// A cached instance wrapping . - /// - private static readonly CloneDelegate CloneWrapper = Clone; -#endif /// /// The shared vtable pointer for instances. @@ -186,7 +55,6 @@ internal static unsafe partial class IWICStreamExtensions { void** lpVtbl = (void**)RuntimeHelpers.AllocateTypeAssociatedMemory(typeof(IStreamWrapper), sizeof(void*) * 14); -#if NET6_0_OR_GREATER lpVtbl[0] = (delegate* unmanaged)&QueryInterface; lpVtbl[1] = (delegate* unmanaged)&AddRef; lpVtbl[2] = (delegate* unmanaged)&Release; @@ -201,22 +69,6 @@ internal static unsafe partial class IWICStreamExtensions lpVtbl[11] = (delegate* unmanaged)&UnlockRegion; lpVtbl[12] = (delegate* unmanaged)&Stat; lpVtbl[13] = (delegate* unmanaged)&Clone; -#else - lpVtbl[0] = (void*)Marshal.GetFunctionPointerForDelegate(QueryInterfaceWrapper); - lpVtbl[1] = (void*)Marshal.GetFunctionPointerForDelegate(AddRefWrapper); - lpVtbl[2] = (void*)Marshal.GetFunctionPointerForDelegate(ReleaseWrapper); - lpVtbl[3] = (void*)Marshal.GetFunctionPointerForDelegate(ReadWrapper); - lpVtbl[4] = (void*)Marshal.GetFunctionPointerForDelegate(WriteWrapper); - lpVtbl[5] = (void*)Marshal.GetFunctionPointerForDelegate(SeekWrapper); - lpVtbl[6] = (void*)Marshal.GetFunctionPointerForDelegate(SetSizeWrapper); - lpVtbl[7] = (void*)Marshal.GetFunctionPointerForDelegate(CopyToWrapper); - lpVtbl[8] = (void*)Marshal.GetFunctionPointerForDelegate(CommitWrapper); - lpVtbl[9] = (void*)Marshal.GetFunctionPointerForDelegate(RevertWrapper); - lpVtbl[10] = (void*)Marshal.GetFunctionPointerForDelegate(LockRegionWrapper); - lpVtbl[11] = (void*)Marshal.GetFunctionPointerForDelegate(UnlockRegionWrapper); - lpVtbl[12] = (void*)Marshal.GetFunctionPointerForDelegate(StatWrapper); - lpVtbl[13] = (void*)Marshal.GetFunctionPointerForDelegate(CloneWrapper); -#endif return lpVtbl; } @@ -262,25 +114,23 @@ internal static unsafe partial class IWICStreamExtensions return Unsafe.As(this.streamHandle.Target!); } -#if NET6_0_OR_GREATER /// - public HRESULT QueryInterface(Guid* riid, void** ppvObject) + private HRESULT QueryInterface(Guid* riid, void** ppvObject) { return ((delegate* unmanaged)this.lpVtbl[0])((IStreamWrapper*)Unsafe.AsPointer(ref this), riid, ppvObject); } /// - public uint AddRef() + private uint AddRef() { return ((delegate* unmanaged)this.lpVtbl[1])((IStreamWrapper*)Unsafe.AsPointer(ref this)); } /// - public uint Release() + private uint Release() { return ((delegate* unmanaged)this.lpVtbl[2])((IStreamWrapper*)Unsafe.AsPointer(ref this)); } -#endif /// [UnmanagedCallersOnly] diff --git a/src/ComputeSharp/Graphics/Extensions/Texture1DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Texture1DExtensions.cs index 5b054655..c2dc4378 100644 --- a/src/ComputeSharp/Graphics/Extensions/Texture1DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Texture1DExtensions.cs @@ -66,7 +66,6 @@ public static class Texture1DExtensions source.CopyTo(destination.AsSpan(), 0, source.Width); } -#if NET6_0_OR_GREATER /// /// Reads the contents of the specified range from the current instance and writes them into a target array. /// @@ -82,7 +81,6 @@ public static class Texture1DExtensions source.CopyTo(destination.AsSpan(), x); } -#endif /// /// Reads the contents of the specified range from the current instance and writes them into a target array. @@ -117,7 +115,6 @@ public static class Texture1DExtensions source.CopyTo(destination.AsSpan(destinationOffset), 0, source.Width); } -#if NET6_0_OR_GREATER /// /// Reads the contents of the specified range from the current instance and writes them into a target array. /// @@ -134,7 +131,6 @@ public static class Texture1DExtensions source.CopyTo(destination.AsSpan(destinationOffset), x); } -#endif /// /// Reads the contents of the specified range from the current instance and writes them into a target array. @@ -169,7 +165,6 @@ public static class Texture1DExtensions source.CopyTo(destination, 0, source.Width); } -#if NET6_0_OR_GREATER /// /// Reads the contents of the specified range from the current instance and writes them into a target . /// @@ -186,7 +181,6 @@ public static class Texture1DExtensions source.CopyTo(destination, offsetX, width); } -#endif /// /// Reads the contents of the specified range from the current instance and writes them into a target . @@ -319,7 +313,6 @@ public static class Texture1DExtensions destination.CopyFrom(source.AsSpan(), 0, destination.Width); } -#if NET6_0_OR_GREATER /// /// Writes the contents of a given array to a specified area of the current instance. /// @@ -335,7 +328,6 @@ public static class Texture1DExtensions destination.CopyFrom(source.AsSpan(), x); } -#endif /// /// Writes the contents of a given array to a specified area of the current instance. @@ -354,7 +346,6 @@ public static class Texture1DExtensions destination.CopyFrom(source.AsSpan(), destinationOffsetX, width); } -#if NET6_0_OR_GREATER /// /// Writes the contents of a given array to a specified area of the current instance. /// @@ -371,7 +362,6 @@ public static class Texture1DExtensions destination.CopyFrom(source.AsSpan(sourceOffset), x); } -#endif /// /// Writes the contents of a given array to a specified area of the current instance. @@ -406,7 +396,6 @@ public static class Texture1DExtensions destination.CopyFrom(source, 0, destination.Width); } -#if NET6_0_OR_GREATER /// /// Writes the contents of a given to a specified area of the current instance. /// @@ -423,7 +412,6 @@ public static class Texture1DExtensions destination.CopyFrom(source, offsetX, width); } -#endif /// /// Writes the contents of a given to a specified area of the current instance. diff --git a/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs index 16f288ab..c42d7f7b 100644 --- a/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs @@ -89,7 +89,6 @@ public static class Texture2DExtensions source.CopyTo(destination.AsSpan(), 0, 0, source.Width, source.Height); } -#if NET6_0_OR_GREATER /// /// Reads the contents of the specified range from the current instance and writes them into a target array. /// @@ -106,7 +105,6 @@ public static class Texture2DExtensions source.CopyTo(destination.AsSpan(), x, y); } -#endif /// /// Reads the contents of the specified range from the current instance and writes them into a target array. @@ -143,7 +141,6 @@ public static class Texture2DExtensions source.CopyTo(destination.AsSpan(destinationOffset), 0, 0, source.Width, source.Height); } -#if NET6_0_OR_GREATER /// /// Reads the contents of the specified range from the current instance and writes them into a target array. /// @@ -161,7 +158,6 @@ public static class Texture2DExtensions source.CopyTo(destination.AsSpan(destinationOffset), x, y); } -#endif /// /// Reads the contents of the specified range from the current instance and writes them into a target array. @@ -198,7 +194,6 @@ public static class Texture2DExtensions source.CopyTo(destination, 0, 0, source.Width, source.Height); } -#if NET6_0_OR_GREATER /// /// Reads the contents of the specified range from the current instance and writes them into a target . /// @@ -217,7 +212,6 @@ public static class Texture2DExtensions source.CopyTo(destination, offsetX, offsetY, width, height); } -#endif /// /// Reads the contents of the specified range from the current instance and writes them into a target . @@ -379,7 +373,6 @@ public static class Texture2DExtensions destination.CopyFrom(source.AsSpan(), 0, 0, destination.Width, destination.Height); } -#if NET6_0_OR_GREATER /// /// Writes the contents of a given array to a specified area of the current instance. /// @@ -396,7 +389,6 @@ public static class Texture2DExtensions destination.CopyFrom(source.AsSpan(), x, y); } -#endif /// /// Writes the contents of a given array to a specified area of the current instance. @@ -417,7 +409,6 @@ public static class Texture2DExtensions destination.CopyFrom(source.AsSpan(), destinationOffsetX, destinationOffsetY, width, height); } -#if NET6_0_OR_GREATER /// /// Writes the contents of a given array to a specified area of the current instance. /// @@ -435,7 +426,6 @@ public static class Texture2DExtensions destination.CopyFrom(source.AsSpan(sourceOffset), x, y); } -#endif /// /// Writes the contents of a given array to a specified area of the current instance. @@ -472,7 +462,6 @@ public static class Texture2DExtensions destination.CopyFrom(source, 0, 0, destination.Width, destination.Height); } -#if NET6_0_OR_GREATER /// /// Writes the contents of a given to a specified area of the current instance. /// @@ -491,7 +480,6 @@ public static class Texture2DExtensions destination.CopyFrom(source, offsetX, offsetY, width, height); } -#endif /// /// Writes the contents of a given to a specified area of the current instance. diff --git a/src/ComputeSharp/Graphics/Extensions/Texture3DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Texture3DExtensions.cs index e38b9859..4fcb8592 100644 --- a/src/ComputeSharp/Graphics/Extensions/Texture3DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Texture3DExtensions.cs @@ -100,7 +100,6 @@ public static class Texture3DExtensions source.CopyTo(destination.AsSpan(destinationOffset), 0, 0, 0, source.Width, source.Height, source.Depth); } -#if NET6_0_OR_GREATER /// /// Reads the contents of the specified range from the current instance and writes them into a target array. /// @@ -119,7 +118,6 @@ public static class Texture3DExtensions source.CopyTo(destination.AsSpan(destinationOffset), x, y, z); } -#endif /// /// Reads the contents of the specified range from the current instance and writes them into a target array. @@ -157,7 +155,6 @@ public static class Texture3DExtensions source.CopyTo(destination, 0, 0, 0, source.Width, source.Height, source.Depth); } -#if NET6_0_OR_GREATER /// /// Reads the contents of the specified range from the current instance and writes them into a target . /// @@ -178,7 +175,6 @@ public static class Texture3DExtensions source.CopyTo(destination, offsetX, offsetY, offsetZ, width, height, depth); } -#endif /// /// Reads the contents of the specified range from the current instance and writes them into a target . @@ -357,7 +353,6 @@ public static class Texture3DExtensions destination.CopyFrom(source.AsSpan(), 0, 0, 0, destination.Width, destination.Height, destination.Depth); } -#if NET6_0_OR_GREATER /// /// Writes the contents of a given array to a specified area of the current instance. /// @@ -375,7 +370,6 @@ public static class Texture3DExtensions destination.CopyFrom(source.AsSpan(), x, y, z); } -#endif /// /// Writes the contents of a given array to a specified area of the current instance. @@ -398,7 +392,6 @@ public static class Texture3DExtensions destination.CopyFrom(source.AsSpan(), destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth); } -#if NET6_0_OR_GREATER /// /// Writes the contents of a given array to a specified area of the current instance. /// @@ -417,7 +410,6 @@ public static class Texture3DExtensions destination.CopyFrom(source.AsSpan(sourceOffset), x, y, z); } -#endif /// /// Writes the contents of a given array to a specified area of the current instance. @@ -456,7 +448,6 @@ public static class Texture3DExtensions destination.CopyFrom(source, 0, 0, 0, destination.Width, destination.Height, destination.Depth); } -#if NET6_0_OR_GREATER /// /// Writes the contents of a given to a specified area of the current instance. /// @@ -477,7 +468,6 @@ public static class Texture3DExtensions destination.CopyFrom(source, offsetX, offsetY, offsetZ, width, height, depth); } -#endif /// /// Writes the contents of a given to a specified area of the current instance. diff --git a/src/ComputeSharp/Graphics/GraphicsDevice.DeviceLost.cs b/src/ComputeSharp/Graphics/GraphicsDevice.DeviceLost.cs index ae9f9c21..aec1095a 100644 --- a/src/ComputeSharp/Graphics/GraphicsDevice.DeviceLost.cs +++ b/src/ComputeSharp/Graphics/GraphicsDevice.DeviceLost.cs @@ -11,13 +11,6 @@ namespace ComputeSharp; /// unsafe partial class GraphicsDevice { -#if !NET6_0_OR_GREATER - /// - /// A cached instance wrapping . - /// - private static readonly WaitForSingleObjectCallbackDelegate WaitForSingleObjectCallbackForRegisterDeviceLostCallbackWrapper = WaitForSingleObjectCallbackForRegisterDeviceLostCallback; -#endif - /// /// Throws an if the current device has been lost. /// @@ -124,11 +117,7 @@ unsafe partial class GraphicsDevice _ = Windows.RegisterWaitForSingleObject( phNewWaitObject: &waitHandle, hObject: eventHandle, -#if NET6_0_OR_GREATER Callback: &WaitForSingleObjectCallbackForRegisterDeviceLostCallback, -#else - Callback: (void*)Marshal.GetFunctionPointerForDelegate(WaitForSingleObjectCallbackForRegisterDeviceLostCallbackWrapper), -#endif Context: (void*)GCHandle.ToIntPtr(handle), dwMilliseconds: Windows.INFINITE, dwFlags: 0); diff --git a/src/ComputeSharp/Graphics/GraphicsDevice.Execute.cs b/src/ComputeSharp/Graphics/GraphicsDevice.Execute.cs index a402805f..a92dfeea 100644 --- a/src/ComputeSharp/Graphics/GraphicsDevice.Execute.cs +++ b/src/ComputeSharp/Graphics/GraphicsDevice.Execute.cs @@ -17,21 +17,6 @@ namespace ComputeSharp; /// unsafe partial class GraphicsDevice { -#if !NET6_0_OR_GREATER - /// - /// A delegate for a callback to pass to . - /// - /// The input context. - /// Whether the wait has timed out. - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate void WaitForSingleObjectCallbackDelegate(void* pContext, byte timedOut); - - /// - /// A cached instance wrapping . - /// - private static readonly WaitForSingleObjectCallbackDelegate WaitForSingleObjectCallbackForWaitForFenceAsyncWrapper = WaitForSingleObjectCallbackForWaitForFenceAsync; -#endif - /// /// Executes a given command list and waits for the operation to be completed. /// @@ -67,11 +52,7 @@ unsafe partial class GraphicsDevice d3D12CommandQueue->ExecuteCommandLists(1, d3D12CommandList); } -#if NET6_0_OR_GREATER ulong updatedFenceValue = Interlocked.Increment(ref d3D12FenceValue); -#else - ulong updatedFenceValue = (ulong)Interlocked.Increment(ref Unsafe.As(ref d3D12FenceValue)); -#endif // Signal to the target fence with the updated value. Note that incrementing the // target fence value to signal must be done after executing the command list. @@ -101,11 +82,7 @@ unsafe partial class GraphicsDevice this.d3D12ComputeCommandQueue.Get()->ExecuteCommandLists(1, d3D12CommandList); } -#if NET6_0_OR_GREATER ulong updatedFenceValue = Interlocked.Increment(ref this.nextD3D12ComputeFenceValue); -#else - ulong updatedFenceValue = (ulong)Interlocked.Increment(ref Unsafe.As(ref this.nextD3D12ComputeFenceValue)); -#endif // Signal to the target fence with the updated value. Note that incrementing the // target fence value to signal must be done after executing the command list. @@ -117,11 +94,7 @@ unsafe partial class GraphicsDevice // Return the rented command list and command allocator so that they can be reused this.computeCommandListPool.Return(commandList.DetachD3D12CommandList(), commandList.DetachD3D12CommandAllocator()); -#if NET6_0_OR_GREATER return ValueTask.CompletedTask; -#else - return new(Task.CompletedTask); -#endif } // Setup the awaitable task @@ -198,11 +171,7 @@ unsafe partial class GraphicsDevice int result = Windows.RegisterWaitForSingleObject( phNewWaitObject: &waitHandle, hObject: eventHandle, -#if NET6_0_OR_GREATER Callback: &WaitForSingleObjectCallbackForWaitForFenceAsync, -#else - Callback: (void*)Marshal.GetFunctionPointerForDelegate(WaitForSingleObjectCallbackForWaitForFenceAsyncWrapper), -#endif Context: callbackContext, dwMilliseconds: Windows.INFINITE, dwFlags: 0); diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs index 23cf33cf..9fa7cb8e 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.IDXGIFactory6.cs @@ -101,44 +101,6 @@ partial class DeviceHelper /// private unsafe struct IDXGIFactory4As6Backcompat { -#if !NET6_0_OR_GREATER - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate uint ReleaseDelegate(IDXGIFactory4As6Backcompat* @this); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate int EnumAdaptersDelegate(IDXGIFactory4As6Backcompat* @this, uint Adapter, IDXGIAdapter** ppAdapter); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate int EnumWarpAdapterDelegate(IDXGIFactory4As6Backcompat* @this, Guid* riid, void** ppvAdapter); - - /// - [UnmanagedFunctionPointer(CallingConvention.StdCall)] - private delegate int EnumAdapterByGpuPreferenceDelegate(IDXGIFactory4As6Backcompat* @this, uint Adapter, DXGI_GPU_PREFERENCE GpuPreference, Guid* riid, void** ppvAdapter); - - /// - /// A cached instance wrapping . - /// - private static readonly ReleaseDelegate ReleaseWrapper = Release; - - /// - /// A cached instance wrapping . - /// - private static readonly EnumAdaptersDelegate EnumAdaptersWrapper = EnumAdapters; - - /// - /// A cached instance wrapping . - /// - private static readonly EnumWarpAdapterDelegate EnumWarpAdapterWrapper = EnumWarpAdapter; - - /// - /// A cached instance wrapping . - /// - private static readonly EnumAdapterByGpuPreferenceDelegate EnumAdapterByGpuPreferenceWrapper = EnumAdapterByGpuPreference; -#endif - /// /// The shared method table pointer for all instances. /// @@ -154,17 +116,10 @@ partial class DeviceHelper new Span(lpVtbl, 30).Clear(); -#if NET6_0_OR_GREATER lpVtbl[2] = (delegate* unmanaged)&Release; lpVtbl[7] = (delegate* unmanaged)&EnumAdapters; lpVtbl[27] = (delegate* unmanaged)&EnumWarpAdapter; lpVtbl[29] = (delegate* unmanaged)&EnumAdapterByGpuPreference; -#else - lpVtbl[2] = (void*)Marshal.GetFunctionPointerForDelegate(ReleaseWrapper); - lpVtbl[7] = (void*)Marshal.GetFunctionPointerForDelegate(EnumAdaptersWrapper); - lpVtbl[27] = (void*)Marshal.GetFunctionPointerForDelegate(EnumWarpAdapterWrapper); - lpVtbl[29] = (void*)Marshal.GetFunctionPointerForDelegate(EnumAdapterByGpuPreferenceWrapper); -#endif return lpVtbl; } diff --git a/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12Allocation.cs b/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12Allocation.cs index 22031a8f..ee15a951 100644 --- a/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12Allocation.cs +++ b/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12Allocation.cs @@ -11,10 +11,7 @@ namespace ComputeSharp.Interop.Allocation; /// An allocation wrapper for a native object. /// [Guid("D42D5782-2DE7-4539-A817-482E3AA01E2E")] -internal unsafe struct ID3D12Allocation -#if NET6_0_OR_GREATER -//: IUnknown.Interface -#endif +internal unsafe struct ID3D12Allocation //: IUnknown.Interface { /// /// Gets the for (D42D5782-2DE7-4539-A817-482E3AA01E2E). @@ -40,10 +37,8 @@ internal unsafe struct ID3D12Allocation } } -#if NET6_0_OR_GREATER ///// //static Guid* INativeGuid.NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in Guid)); -#endif /// /// The vtable for the current instance. diff --git a/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocator.cs b/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocator.cs index 61ed95ac..840732aa 100644 --- a/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocator.cs +++ b/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocator.cs @@ -11,10 +11,7 @@ namespace ComputeSharp.Interop.Allocation; /// An object that can allocate resources for a given instance. /// [Guid("2D5E55D2-9244-431F-868E-0D90AAB6E575")] -internal unsafe struct ID3D12MemoryAllocator -#if NET6_0_OR_GREATER -//: IUnknown.Interface -#endif +internal unsafe struct ID3D12MemoryAllocator //: IUnknown.Interface { /// /// Gets the for (2D5E55D2-9244-431F-868E-0D90AAB6E575). @@ -40,10 +37,8 @@ internal unsafe struct ID3D12MemoryAllocator } } -#if NET6_0_OR_GREATER ///// //static Guid* INativeGuid.NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in Guid)); -#endif /// /// The vtable for the current instance. diff --git a/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocatorFactory.cs b/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocatorFactory.cs index f87b6424..bb41a71e 100644 --- a/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocatorFactory.cs +++ b/src/ComputeSharp/Graphics/Interop/Allocation/ID3D12MemoryAllocatorFactory.cs @@ -11,10 +11,7 @@ namespace ComputeSharp.Interop.Allocation; /// A factory type for objects. /// [Guid("CC1E74A7-786D-40F4-8AE2-F8B7A255587E")] -internal unsafe struct ID3D12MemoryAllocatorFactory -#if NET6_0_OR_GREATER -//: IUnknown.Interface -#endif +internal unsafe struct ID3D12MemoryAllocatorFactory //: IUnknown.Interface { /// /// Gets the for (CC1E74A7-786D-40F4-8AE2-F8B7A255587E). @@ -40,10 +37,8 @@ internal unsafe struct ID3D12MemoryAllocatorFactory } } -#if NET6_0_OR_GREATER ///// //static Guid* INativeGuid.NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in Guid)); -#endif /// /// The vtable for the current instance. diff --git a/src/ComputeSharp/Graphics/Luid.cs b/src/ComputeSharp/Graphics/Luid.cs index 54290da3..4c0d369c 100644 --- a/src/ComputeSharp/Graphics/Luid.cs +++ b/src/ComputeSharp/Graphics/Luid.cs @@ -9,10 +9,7 @@ namespace ComputeSharp; /// /// A locally unique identifier for a graphics device. /// -public readonly struct Luid : IEquatable -#if NET6_0_OR_GREATER - , ISpanFormattable -#endif +public readonly struct Luid : IEquatable, ISpanFormattable { /// /// The low bits of the luid. @@ -63,7 +60,6 @@ public readonly struct Luid : IEquatable return ((((long)this.highPart) << 32) | this.lowPart).ToString(); } -#if NET6_0_OR_GREATER /// public string ToString(string? format, IFormatProvider? formatProvider) { @@ -75,7 +71,6 @@ public readonly struct Luid : IEquatable { return ((((long)this.highPart) << 32) | this.lowPart).TryFormat(destination, out charsWritten, format, provider); } -#endif /// /// Check whether two values are equal. diff --git a/src/ComputeSharp/Shaders/ComputeContext.cs b/src/ComputeSharp/Shaders/ComputeContext.cs index eb431f10..468a8995 100644 --- a/src/ComputeSharp/Shaders/ComputeContext.cs +++ b/src/ComputeSharp/Shaders/ComputeContext.cs @@ -284,11 +284,7 @@ public struct ComputeContext : IDisposable, IAsyncDisposable { device.GetReferenceTracker().DangerousRelease(); -#if NET6_0_OR_GREATER return ValueTask.CompletedTask; -#else - return new(Task.CompletedTask); -#endif } try