Remove downlevel paths in ComputeSharp
このコミットが含まれているのは:
1 親
23748b514e
コミット
813f5a18f1
21ファイル変更
+22
-515
検索条件に一致するファイルはありません
@@ -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;
|
||||
/// </summary>
|
||||
/// <remarks>This struct is fully mutable.</remarks>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Bgra32 : IEquatable<Bgra32>, IPixel<Bgra32, Float4>
|
||||
#if NET6_0_OR_GREATER
|
||||
, ISpanFormattable
|
||||
#endif
|
||||
public struct Bgra32 : IEquatable<Bgra32>, IPixel<Bgra32, Float4>, ISpanFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// The blue component.
|
||||
@@ -91,7 +86,6 @@ public struct Bgra32 : IEquatable<Bgra32>, IPixel<Bgra32, Float4>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly Float4 ToPixel()
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
if (Sse2.IsSupported)
|
||||
{
|
||||
int pack = Unsafe.As<Bgra32, int>(ref Unsafe.AsRef(in this));
|
||||
@@ -106,7 +100,7 @@ public struct Bgra32 : IEquatable<Bgra32>, IPixel<Bgra32, Float4>
|
||||
|
||||
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<Bgra32>, IPixel<Bgra32, Float4>
|
||||
return $"{nameof(Bgra32)}({this.B}, {this.G}, {this.R}, {this.A})";
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <inheritdoc />
|
||||
public string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
@@ -173,5 +166,4 @@ public struct Bgra32 : IEquatable<Bgra32>, IPixel<Bgra32, Float4>
|
||||
{
|
||||
return destination.TryWrite(provider, $"{nameof(Bgra32)}({this.B}, {this.G}, {this.R}, {this.A})", out charsWritten);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -11,10 +11,7 @@ namespace ComputeSharp;
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct R16 : IEquatable<R16>, IPixel<R16, float>
|
||||
#if NET6_0_OR_GREATER
|
||||
, ISpanFormattable
|
||||
#endif
|
||||
public struct R16 : IEquatable<R16>, IPixel<R16, float>, ISpanFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// The red component.
|
||||
@@ -97,7 +94,6 @@ public struct R16 : IEquatable<R16>, IPixel<R16, float>
|
||||
return $"{nameof(R16)}({this.R})";
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <inheritdoc/>
|
||||
public string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
@@ -109,5 +105,4 @@ public struct R16 : IEquatable<R16>, IPixel<R16, float>
|
||||
{
|
||||
return destination.TryWrite(provider, $"{nameof(R16)}({this.R})", out charsWritten);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -11,10 +11,7 @@ namespace ComputeSharp;
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct R8 : IEquatable<R8>, IPixel<R8, float>
|
||||
#if NET6_0_OR_GREATER
|
||||
, ISpanFormattable
|
||||
#endif
|
||||
public struct R8 : IEquatable<R8>, IPixel<R8, float>, ISpanFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// The red component.
|
||||
@@ -97,7 +94,6 @@ public struct R8 : IEquatable<R8>, IPixel<R8, float>
|
||||
return $"{nameof(R8)}({this.R})";
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <inheritdoc/>
|
||||
public string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
@@ -109,5 +105,4 @@ public struct R8 : IEquatable<R8>, IPixel<R8, float>
|
||||
{
|
||||
return destination.TryWrite(provider, $"{nameof(R8)}({this.R})", out charsWritten);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -11,10 +11,7 @@ namespace ComputeSharp;
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Rg16 : IEquatable<Rg16>, IPixel<Rg16, Float2>
|
||||
#if NET6_0_OR_GREATER
|
||||
, ISpanFormattable
|
||||
#endif
|
||||
public struct Rg16 : IEquatable<Rg16>, IPixel<Rg16, Float2>, ISpanFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// The red component.
|
||||
@@ -104,7 +101,6 @@ public struct Rg16 : IEquatable<Rg16>, IPixel<Rg16, Float2>
|
||||
return $"{nameof(Rg16)}({this.R}, {this.G})";
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <inheritdoc/>
|
||||
public string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
@@ -116,5 +112,4 @@ public struct Rg16 : IEquatable<Rg16>, IPixel<Rg16, Float2>
|
||||
{
|
||||
return destination.TryWrite(provider, $"{nameof(Rg16)}({this.R}, {this.G})", out charsWritten);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -11,10 +11,7 @@ namespace ComputeSharp;
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Rg32 : IEquatable<Rg32>, IPixel<Rg32, Float2>
|
||||
#if NET6_0_OR_GREATER
|
||||
, ISpanFormattable
|
||||
#endif
|
||||
public struct Rg32 : IEquatable<Rg32>, IPixel<Rg32, Float2>, ISpanFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// The red component.
|
||||
@@ -104,7 +101,6 @@ public struct Rg32 : IEquatable<Rg32>, IPixel<Rg32, Float2>
|
||||
return $"{nameof(Rg32)}({this.R}, {this.G})";
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <inheritdoc/>
|
||||
public string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
@@ -116,5 +112,4 @@ public struct Rg32 : IEquatable<Rg32>, IPixel<Rg32, Float2>
|
||||
{
|
||||
return destination.TryWrite(provider, $"{nameof(Rg32)}({this.R}, {this.G})", out charsWritten);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -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;
|
||||
/// </summary>
|
||||
/// <remarks>This struct is fully mutable.</remarks>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Rgba32 : IEquatable<Rgba32>, IPixel<Rgba32, Float4>
|
||||
#if NET6_0_OR_GREATER
|
||||
, ISpanFormattable
|
||||
#endif
|
||||
public struct Rgba32 : IEquatable<Rgba32>, IPixel<Rgba32, Float4>, ISpanFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// The red component.
|
||||
@@ -90,7 +85,6 @@ public struct Rgba32 : IEquatable<Rgba32>, IPixel<Rgba32, Float4>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly Float4 ToPixel()
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
if (Sse2.IsSupported)
|
||||
{
|
||||
int pack = Unsafe.As<Rgba32, int>(ref Unsafe.AsRef(in this));
|
||||
@@ -104,7 +98,7 @@ public struct Rgba32 : IEquatable<Rgba32>, IPixel<Rgba32, Float4>
|
||||
|
||||
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<Rgba32>, IPixel<Rgba32, Float4>
|
||||
return $"{nameof(Rgba32)}({this.R}, {this.G}, {this.B}, {this.A})";
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <inheritdoc/>
|
||||
public string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
@@ -171,5 +164,4 @@ public struct Rgba32 : IEquatable<Rgba32>, IPixel<Rgba32, Float4>
|
||||
{
|
||||
return destination.TryWrite(provider, $"{nameof(Rgba32)}({this.R}, {this.G}, {this.B}, {this.A})", out charsWritten);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -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;
|
||||
/// </summary>
|
||||
/// <remarks>This struct is fully mutable.</remarks>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Rgba64 : IEquatable<Rgba64>, IPixel<Rgba64, Float4>
|
||||
#if NET6_0_OR_GREATER
|
||||
, ISpanFormattable
|
||||
#endif
|
||||
public struct Rgba64 : IEquatable<Rgba64>, IPixel<Rgba64, Float4>, ISpanFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// The red component.
|
||||
@@ -90,7 +85,6 @@ public struct Rgba64 : IEquatable<Rgba64>, IPixel<Rgba64, Float4>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly Float4 ToPixel()
|
||||
{
|
||||
#if NET6_0_OR_GREATER
|
||||
if (Sse2.IsSupported)
|
||||
{
|
||||
long pack = Unsafe.As<Rgba64, long>(ref Unsafe.AsRef(in this));
|
||||
@@ -102,7 +96,7 @@ public struct Rgba64 : IEquatable<Rgba64>, IPixel<Rgba64, Float4>
|
||||
|
||||
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<Rgba64>, IPixel<Rgba64, Float4>
|
||||
return $"{nameof(Rgba64)}({this.R}, {this.G}, {this.B}, {this.A})";
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <inheritdoc/>
|
||||
public string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
@@ -169,5 +162,4 @@ public struct Rgba64 : IEquatable<Rgba64>, IPixel<Rgba64, Float4>
|
||||
{
|
||||
return destination.TryWrite(provider, $"{nameof(Rgba64)}({this.R}, {this.G}, {this.B}, {this.A})", out charsWritten);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
@@ -16,11 +16,7 @@ internal static class ComPtrExtensions
|
||||
/// <returns>The moved <see cref="ComPtr{T}"/> instance.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static unsafe ComPtr<T> Move<T>(this in ComPtr<T> ptr)
|
||||
#if NET6_0_OR_GREATER
|
||||
where T : unmanaged//, IUnknown.Interface
|
||||
#else
|
||||
where T : unmanaged
|
||||
#endif
|
||||
{
|
||||
ComPtr<T> copy = default;
|
||||
|
||||
|
||||
@@ -35,141 +35,10 @@ unsafe partial class IWICStreamExtensions
|
||||
/// <summary>
|
||||
/// A manual CCW implementation for an <see cref="IStream"/> object wrapping an <see cref="IBufferWriter{T}"/> instance.
|
||||
/// </summary>
|
||||
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
|
||||
///// <inheritdoc/>
|
||||
//static Guid* INativeGuid.NativeGuid => (Guid*)default(NotSupportedException).Throw<nint>();
|
||||
#else
|
||||
/// <inheritdoc cref="QueryInterface"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate int QueryInterfaceDelegate(IBufferWriterWrapper* @this, Guid* riid, void** ppvObject);
|
||||
|
||||
/// <inheritdoc cref="AddRef"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate uint AddRefDelegate(IBufferWriterWrapper* @this);
|
||||
|
||||
/// <inheritdoc cref="Release"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate uint ReleaseDelegate(IBufferWriterWrapper* @this);
|
||||
|
||||
/// <inheritdoc cref="Read"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT ReadDelegate(IBufferWriterWrapper* @this, void* pv, uint cb, uint* pcbRead);
|
||||
|
||||
/// <inheritdoc cref="Write"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT WriteDelegate(IBufferWriterWrapper* @this, void* pv, uint cb, uint* pcbWritten);
|
||||
|
||||
/// <inheritdoc cref="Seek"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT SeekDelegate(IBufferWriterWrapper* @this, LARGE_INTEGER dlibMove, uint dwOrigin, ULARGE_INTEGER* plibNewPosition);
|
||||
|
||||
/// <inheritdoc cref="SetSize"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT SetSizeDelegate(IBufferWriterWrapper* @this, ULARGE_INTEGER libNewSize);
|
||||
|
||||
/// <inheritdoc cref="CopyTo"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT CopyToDelegate(IBufferWriterWrapper* @this, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten);
|
||||
|
||||
/// <inheritdoc cref="Commit"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT CommitDelegate(IBufferWriterWrapper* @this, uint grfCommitFlags);
|
||||
|
||||
/// <inheritdoc cref="Revert"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT RevertDelegate(IBufferWriterWrapper* @this);
|
||||
|
||||
/// <inheritdoc cref="LockRegion"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT LockRegionDelegate(IBufferWriterWrapper* @this, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType);
|
||||
|
||||
/// <inheritdoc cref="UnlockRegion"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT UnlockRegionDelegate(IBufferWriterWrapper* @this, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType);
|
||||
|
||||
/// <inheritdoc cref="Stat"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT StatDelegate(IBufferWriterWrapper* @this, STATSTG* pstatstg, uint grfStatFlag);
|
||||
|
||||
/// <inheritdoc cref="Clone"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT CloneDelegate(IBufferWriterWrapper* @this, IStream** ppstm);
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="QueryInterfaceDelegate"/> instance wrapping <see cref="QueryInterface"/>.
|
||||
/// </summary>
|
||||
private static readonly QueryInterfaceDelegate QueryInterfaceWrapper = QueryInterface;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="AddRefDelegate"/> instance wrapping <see cref="AddRef"/>.
|
||||
/// </summary>
|
||||
private static readonly AddRefDelegate AddRefWrapper = AddRef;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="ReleaseDelegate"/> instance wrapping <see cref="Release"/>.
|
||||
/// </summary>
|
||||
private static readonly ReleaseDelegate ReleaseWrapper = Release;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="ReadDelegate"/> instance wrapping <see cref="Read"/>.
|
||||
/// </summary>
|
||||
private static readonly ReadDelegate ReadWrapper = Read;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="WriteDelegate"/> instance wrapping <see cref="Write"/>.
|
||||
/// </summary>
|
||||
private static readonly WriteDelegate WriteWrapper = Write;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="SeekDelegate"/> instance wrapping <see cref="Seek"/>.
|
||||
/// </summary>
|
||||
private static readonly SeekDelegate SeekWrapper = Seek;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="SetSizeDelegate"/> instance wrapping <see cref="SetSize"/>.
|
||||
/// </summary>
|
||||
private static readonly SetSizeDelegate SetSizeWrapper = SetSize;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="CopyToDelegate"/> instance wrapping <see cref="CopyTo"/>.
|
||||
/// </summary>
|
||||
private static readonly CopyToDelegate CopyToWrapper = CopyTo;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="CommitDelegate"/> instance wrapping <see cref="Commit"/>.
|
||||
/// </summary>
|
||||
private static readonly CommitDelegate CommitWrapper = Commit;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="RevertDelegate"/> instance wrapping <see cref="Revert"/>.
|
||||
/// </summary>
|
||||
private static readonly RevertDelegate RevertWrapper = Revert;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="LockRegionDelegate"/> instance wrapping <see cref="LockRegion"/>.
|
||||
/// </summary>
|
||||
private static readonly LockRegionDelegate LockRegionWrapper = LockRegion;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="UnlockRegionDelegate"/> instance wrapping <see cref="UnlockRegion"/>.
|
||||
/// </summary>
|
||||
private static readonly UnlockRegionDelegate UnlockRegionWrapper = UnlockRegion;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="StatDelegate"/> instance wrapping <see cref="Stat"/>.
|
||||
/// </summary>
|
||||
private static readonly StatDelegate StatWrapper = Stat;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="CloneDelegate"/> instance wrapping <see cref="Clone"/>.
|
||||
/// </summary>
|
||||
private static readonly CloneDelegate CloneWrapper = Clone;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// The shared vtable pointer for <see cref="IBufferWriterWrapper"/> 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<IBufferWriterWrapper*, Guid*, void**, int>)&QueryInterface;
|
||||
lpVtbl[1] = (delegate* unmanaged<IBufferWriterWrapper*, uint>)&AddRef;
|
||||
lpVtbl[2] = (delegate* unmanaged<IBufferWriterWrapper*, uint>)&Release;
|
||||
@@ -199,22 +67,6 @@ unsafe partial class IWICStreamExtensions
|
||||
lpVtbl[11] = (delegate* unmanaged<IBufferWriterWrapper*, ULARGE_INTEGER, ULARGE_INTEGER, uint, HRESULT>)&UnlockRegion;
|
||||
lpVtbl[12] = (delegate* unmanaged<IBufferWriterWrapper*, STATSTG*, uint, HRESULT>)&Stat;
|
||||
lpVtbl[13] = (delegate* unmanaged<IBufferWriterWrapper*, IStream**, HRESULT>)&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<IBufferWriter<byte>>(this.writerHandle.Target!);
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <inheritdoc/>
|
||||
public HRESULT QueryInterface(Guid* riid, void** ppvObject)
|
||||
private HRESULT QueryInterface(Guid* riid, void** ppvObject)
|
||||
{
|
||||
return ((delegate* unmanaged<IBufferWriterWrapper*, Guid*, void**, HRESULT>)this.lpVtbl[0])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this), riid, ppvObject);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public uint AddRef()
|
||||
private uint AddRef()
|
||||
{
|
||||
return ((delegate* unmanaged<IBufferWriterWrapper*, uint>)this.lpVtbl[1])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public uint Release()
|
||||
private uint Release()
|
||||
{
|
||||
return ((delegate* unmanaged<IBufferWriterWrapper*, uint>)this.lpVtbl[2])((IBufferWriterWrapper*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <inheritdoc cref="IStream.QueryInterface(Guid*, void**)"/>
|
||||
[UnmanagedCallersOnly]
|
||||
|
||||
@@ -37,141 +37,10 @@ internal static unsafe partial class IWICStreamExtensions
|
||||
/// <summary>
|
||||
/// A manual CCW implementation for an <see cref="IStream"/> object wrapping a <see cref="Stream"/> instance.
|
||||
/// </summary>
|
||||
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
|
||||
///// <inheritdoc/>
|
||||
//static Guid* INativeGuid.NativeGuid => (Guid*)default(NotSupportedException).Throw<nint>();
|
||||
#else
|
||||
/// <inheritdoc cref="QueryInterface"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate int QueryInterfaceDelegate(IStreamWrapper* @this, Guid* riid, void** ppvObject);
|
||||
|
||||
/// <inheritdoc cref="AddRef"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate uint AddRefDelegate(IStreamWrapper* @this);
|
||||
|
||||
/// <inheritdoc cref="Release"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate uint ReleaseDelegate(IStreamWrapper* @this);
|
||||
|
||||
/// <inheritdoc cref="Read"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT ReadDelegate(IStreamWrapper* @this, void* pv, uint cb, uint* pcbRead);
|
||||
|
||||
/// <inheritdoc cref="Write"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT WriteDelegate(IStreamWrapper* @this, void* pv, uint cb, uint* pcbWritten);
|
||||
|
||||
/// <inheritdoc cref="Seek"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT SeekDelegate(IStreamWrapper* @this, LARGE_INTEGER dlibMove, uint dwOrigin, ULARGE_INTEGER* plibNewPosition);
|
||||
|
||||
/// <inheritdoc cref="SetSize"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT SetSizeDelegate(IStreamWrapper* @this, ULARGE_INTEGER libNewSize);
|
||||
|
||||
/// <inheritdoc cref="CopyTo"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT CopyToDelegate(IStreamWrapper* @this, IStream* pstm, ULARGE_INTEGER cb, ULARGE_INTEGER* pcbRead, ULARGE_INTEGER* pcbWritten);
|
||||
|
||||
/// <inheritdoc cref="Commit"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT CommitDelegate(IStreamWrapper* @this, uint grfCommitFlags);
|
||||
|
||||
/// <inheritdoc cref="Revert"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT RevertDelegate(IStreamWrapper* @this);
|
||||
|
||||
/// <inheritdoc cref="LockRegion"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT LockRegionDelegate(IStreamWrapper* @this, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType);
|
||||
|
||||
/// <inheritdoc cref="UnlockRegion"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT UnlockRegionDelegate(IStreamWrapper* @this, ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, uint dwLockType);
|
||||
|
||||
/// <inheritdoc cref="Stat"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT StatDelegate(IStreamWrapper* @this, STATSTG* pstatstg, uint grfStatFlag);
|
||||
|
||||
/// <inheritdoc cref="Clone"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate HRESULT CloneDelegate(IStreamWrapper* @this, IStream** ppstm);
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="QueryInterfaceDelegate"/> instance wrapping <see cref="QueryInterface"/>.
|
||||
/// </summary>
|
||||
private static readonly QueryInterfaceDelegate QueryInterfaceWrapper = QueryInterface;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="AddRefDelegate"/> instance wrapping <see cref="AddRef"/>.
|
||||
/// </summary>
|
||||
private static readonly AddRefDelegate AddRefWrapper = AddRef;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="ReleaseDelegate"/> instance wrapping <see cref="Release"/>.
|
||||
/// </summary>
|
||||
private static readonly ReleaseDelegate ReleaseWrapper = Release;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="ReadDelegate"/> instance wrapping <see cref="Read"/>.
|
||||
/// </summary>
|
||||
private static readonly ReadDelegate ReadWrapper = Read;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="WriteDelegate"/> instance wrapping <see cref="Write"/>.
|
||||
/// </summary>
|
||||
private static readonly WriteDelegate WriteWrapper = Write;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="SeekDelegate"/> instance wrapping <see cref="Seek"/>.
|
||||
/// </summary>
|
||||
private static readonly SeekDelegate SeekWrapper = Seek;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="SetSizeDelegate"/> instance wrapping <see cref="SetSize"/>.
|
||||
/// </summary>
|
||||
private static readonly SetSizeDelegate SetSizeWrapper = SetSize;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="CopyToDelegate"/> instance wrapping <see cref="CopyTo"/>.
|
||||
/// </summary>
|
||||
private static readonly CopyToDelegate CopyToWrapper = CopyTo;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="CommitDelegate"/> instance wrapping <see cref="Commit"/>.
|
||||
/// </summary>
|
||||
private static readonly CommitDelegate CommitWrapper = Commit;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="RevertDelegate"/> instance wrapping <see cref="Revert"/>.
|
||||
/// </summary>
|
||||
private static readonly RevertDelegate RevertWrapper = Revert;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="LockRegionDelegate"/> instance wrapping <see cref="LockRegion"/>.
|
||||
/// </summary>
|
||||
private static readonly LockRegionDelegate LockRegionWrapper = LockRegion;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="UnlockRegionDelegate"/> instance wrapping <see cref="UnlockRegion"/>.
|
||||
/// </summary>
|
||||
private static readonly UnlockRegionDelegate UnlockRegionWrapper = UnlockRegion;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="StatDelegate"/> instance wrapping <see cref="Stat"/>.
|
||||
/// </summary>
|
||||
private static readonly StatDelegate StatWrapper = Stat;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="CloneDelegate"/> instance wrapping <see cref="Clone"/>.
|
||||
/// </summary>
|
||||
private static readonly CloneDelegate CloneWrapper = Clone;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// The shared vtable pointer for <see cref="IStreamWrapper"/> 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<IStreamWrapper*, Guid*, void**, int>)&QueryInterface;
|
||||
lpVtbl[1] = (delegate* unmanaged<IStreamWrapper*, uint>)&AddRef;
|
||||
lpVtbl[2] = (delegate* unmanaged<IStreamWrapper*, uint>)&Release;
|
||||
@@ -201,22 +69,6 @@ internal static unsafe partial class IWICStreamExtensions
|
||||
lpVtbl[11] = (delegate* unmanaged<IStreamWrapper*, ULARGE_INTEGER, ULARGE_INTEGER, uint, HRESULT>)&UnlockRegion;
|
||||
lpVtbl[12] = (delegate* unmanaged<IStreamWrapper*, STATSTG*, uint, HRESULT>)&Stat;
|
||||
lpVtbl[13] = (delegate* unmanaged<IStreamWrapper*, IStream**, HRESULT>)&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<Stream>(this.streamHandle.Target!);
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <inheritdoc/>
|
||||
public HRESULT QueryInterface(Guid* riid, void** ppvObject)
|
||||
private HRESULT QueryInterface(Guid* riid, void** ppvObject)
|
||||
{
|
||||
return ((delegate* unmanaged<IStreamWrapper*, Guid*, void**, HRESULT>)this.lpVtbl[0])((IStreamWrapper*)Unsafe.AsPointer(ref this), riid, ppvObject);
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public uint AddRef()
|
||||
private uint AddRef()
|
||||
{
|
||||
return ((delegate* unmanaged<IStreamWrapper*, uint>)this.lpVtbl[1])((IStreamWrapper*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
public uint Release()
|
||||
private uint Release()
|
||||
{
|
||||
return ((delegate* unmanaged<IStreamWrapper*, uint>)this.lpVtbl[2])((IStreamWrapper*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <inheritdoc cref="IStream.QueryInterface(Guid*, void**)"/>
|
||||
[UnmanagedCallersOnly]
|
||||
|
||||
@@ -66,7 +66,6 @@ public static class Texture1DExtensions
|
||||
source.CopyTo(destination.AsSpan(), 0, source.Width);
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <summary>
|
||||
/// Reads the contents of the specified range from the current <see cref="Texture1D{T}"/> instance and writes them into a target array.
|
||||
/// </summary>
|
||||
@@ -82,7 +81,6 @@ public static class Texture1DExtensions
|
||||
|
||||
source.CopyTo(destination.AsSpan(), x);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Reads the contents of the specified range from the current <see cref="Texture1D{T}"/> 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
|
||||
/// <summary>
|
||||
/// Reads the contents of the specified range from the current <see cref="Texture1D{T}"/> instance and writes them into a target array.
|
||||
/// </summary>
|
||||
@@ -134,7 +131,6 @@ public static class Texture1DExtensions
|
||||
|
||||
source.CopyTo(destination.AsSpan(destinationOffset), x);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Reads the contents of the specified range from the current <see cref="Texture1D{T}"/> 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
|
||||
/// <summary>
|
||||
/// Reads the contents of the specified range from the current <see cref="Texture1D{T}"/> instance and writes them into a target <see cref="Span{T}"/>.
|
||||
/// </summary>
|
||||
@@ -186,7 +181,6 @@ public static class Texture1DExtensions
|
||||
|
||||
source.CopyTo(destination, offsetX, width);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Reads the contents of the specified range from the current <see cref="Texture1D{T}"/> instance and writes them into a target <see cref="Span{T}"/>.
|
||||
@@ -319,7 +313,6 @@ public static class Texture1DExtensions
|
||||
destination.CopyFrom(source.AsSpan(), 0, destination.Width);
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <typeparamref name="T"/> array to a specified area of the current <see cref="Texture1D{T}"/> instance.
|
||||
/// </summary>
|
||||
@@ -335,7 +328,6 @@ public static class Texture1DExtensions
|
||||
|
||||
destination.CopyFrom(source.AsSpan(), x);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <typeparamref name="T"/> array to a specified area of the current <see cref="Texture1D{T}"/> instance.
|
||||
@@ -354,7 +346,6 @@ public static class Texture1DExtensions
|
||||
destination.CopyFrom(source.AsSpan(), destinationOffsetX, width);
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <typeparamref name="T"/> array to a specified area of the current <see cref="Texture1D{T}"/> instance.
|
||||
/// </summary>
|
||||
@@ -371,7 +362,6 @@ public static class Texture1DExtensions
|
||||
|
||||
destination.CopyFrom(source.AsSpan(sourceOffset), x);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <typeparamref name="T"/> array to a specified area of the current <see cref="Texture1D{T}"/> instance.
|
||||
@@ -406,7 +396,6 @@ public static class Texture1DExtensions
|
||||
destination.CopyFrom(source, 0, destination.Width);
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <see cref="ReadOnlySpan{T}"/> to a specified area of the current <see cref="Texture1D{T}"/> instance.
|
||||
/// </summary>
|
||||
@@ -423,7 +412,6 @@ public static class Texture1DExtensions
|
||||
|
||||
destination.CopyFrom(source, offsetX, width);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <see cref="ReadOnlySpan{T}"/> to a specified area of the current <see cref="Texture1D{T}"/> instance.
|
||||
|
||||
@@ -89,7 +89,6 @@ public static class Texture2DExtensions
|
||||
source.CopyTo(destination.AsSpan(), 0, 0, source.Width, source.Height);
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <summary>
|
||||
/// Reads the contents of the specified range from the current <see cref="Texture2D{T}"/> instance and writes them into a target array.
|
||||
/// </summary>
|
||||
@@ -106,7 +105,6 @@ public static class Texture2DExtensions
|
||||
|
||||
source.CopyTo(destination.AsSpan(), x, y);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Reads the contents of the specified range from the current <see cref="Texture2D{T}"/> 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
|
||||
/// <summary>
|
||||
/// Reads the contents of the specified range from the current <see cref="Texture2D{T}"/> instance and writes them into a target array.
|
||||
/// </summary>
|
||||
@@ -161,7 +158,6 @@ public static class Texture2DExtensions
|
||||
|
||||
source.CopyTo(destination.AsSpan(destinationOffset), x, y);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Reads the contents of the specified range from the current <see cref="Texture2D{T}"/> 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
|
||||
/// <summary>
|
||||
/// Reads the contents of the specified range from the current <see cref="Texture2D{T}"/> instance and writes them into a target <see cref="Span{T}"/>.
|
||||
/// </summary>
|
||||
@@ -217,7 +212,6 @@ public static class Texture2DExtensions
|
||||
|
||||
source.CopyTo(destination, offsetX, offsetY, width, height);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Reads the contents of the specified range from the current <see cref="Texture2D{T}"/> instance and writes them into a target <see cref="Span{T}"/>.
|
||||
@@ -379,7 +373,6 @@ public static class Texture2DExtensions
|
||||
destination.CopyFrom(source.AsSpan(), 0, 0, destination.Width, destination.Height);
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <typeparamref name="T"/> array to a specified area of the current <see cref="Texture2D{T}"/> instance.
|
||||
/// </summary>
|
||||
@@ -396,7 +389,6 @@ public static class Texture2DExtensions
|
||||
|
||||
destination.CopyFrom(source.AsSpan(), x, y);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <typeparamref name="T"/> array to a specified area of the current <see cref="Texture2D{T}"/> instance.
|
||||
@@ -417,7 +409,6 @@ public static class Texture2DExtensions
|
||||
destination.CopyFrom(source.AsSpan(), destinationOffsetX, destinationOffsetY, width, height);
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <typeparamref name="T"/> array to a specified area of the current <see cref="Texture2D{T}"/> instance.
|
||||
/// </summary>
|
||||
@@ -435,7 +426,6 @@ public static class Texture2DExtensions
|
||||
|
||||
destination.CopyFrom(source.AsSpan(sourceOffset), x, y);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <typeparamref name="T"/> array to a specified area of the current <see cref="Texture2D{T}"/> instance.
|
||||
@@ -472,7 +462,6 @@ public static class Texture2DExtensions
|
||||
destination.CopyFrom(source, 0, 0, destination.Width, destination.Height);
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <see cref="ReadOnlySpan{T}"/> to a specified area of the current <see cref="Texture2D{T}"/> instance.
|
||||
/// </summary>
|
||||
@@ -491,7 +480,6 @@ public static class Texture2DExtensions
|
||||
|
||||
destination.CopyFrom(source, offsetX, offsetY, width, height);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <see cref="ReadOnlySpan{T}"/> to a specified area of the current <see cref="Texture2D{T}"/> instance.
|
||||
|
||||
@@ -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
|
||||
/// <summary>
|
||||
/// Reads the contents of the specified range from the current <see cref="Texture3D{T}"/> instance and writes them into a target array.
|
||||
/// </summary>
|
||||
@@ -119,7 +118,6 @@ public static class Texture3DExtensions
|
||||
|
||||
source.CopyTo(destination.AsSpan(destinationOffset), x, y, z);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Reads the contents of the specified range from the current <see cref="Texture3D{T}"/> 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
|
||||
/// <summary>
|
||||
/// Reads the contents of the specified range from the current <see cref="Texture3D{T}"/> instance and writes them into a target <see cref="Span{T}"/>.
|
||||
/// </summary>
|
||||
@@ -178,7 +175,6 @@ public static class Texture3DExtensions
|
||||
|
||||
source.CopyTo(destination, offsetX, offsetY, offsetZ, width, height, depth);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Reads the contents of the specified range from the current <see cref="Texture3D{T}"/> instance and writes them into a target <see cref="Span{T}"/>.
|
||||
@@ -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
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <typeparamref name="T"/> array to a specified area of the current <see cref="Texture3D{T}"/> instance.
|
||||
/// </summary>
|
||||
@@ -375,7 +370,6 @@ public static class Texture3DExtensions
|
||||
|
||||
destination.CopyFrom(source.AsSpan(), x, y, z);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <typeparamref name="T"/> array to a specified area of the current <see cref="Texture3D{T}"/> instance.
|
||||
@@ -398,7 +392,6 @@ public static class Texture3DExtensions
|
||||
destination.CopyFrom(source.AsSpan(), destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth);
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <typeparamref name="T"/> array to a specified area of the current <see cref="Texture3D{T}"/> instance.
|
||||
/// </summary>
|
||||
@@ -417,7 +410,6 @@ public static class Texture3DExtensions
|
||||
|
||||
destination.CopyFrom(source.AsSpan(sourceOffset), x, y, z);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <typeparamref name="T"/> array to a specified area of the current <see cref="Texture3D{T}"/> 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
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <see cref="ReadOnlySpan{T}"/> to a specified area of the current <see cref="Texture3D{T}"/> instance.
|
||||
/// </summary>
|
||||
@@ -477,7 +468,6 @@ public static class Texture3DExtensions
|
||||
|
||||
destination.CopyFrom(source, offsetX, offsetY, offsetZ, width, height, depth);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Writes the contents of a given <see cref="ReadOnlySpan{T}"/> to a specified area of the current <see cref="Texture3D{T}"/> instance.
|
||||
|
||||
@@ -11,13 +11,6 @@ namespace ComputeSharp;
|
||||
/// <inheritdoc/>
|
||||
unsafe partial class GraphicsDevice
|
||||
{
|
||||
#if !NET6_0_OR_GREATER
|
||||
/// <summary>
|
||||
/// A cached <see cref="WaitForSingleObjectCallbackDelegate"/> instance wrapping <see cref="WaitForSingleObjectCallbackForRegisterDeviceLostCallback(void*, byte)"/>.
|
||||
/// </summary>
|
||||
private static readonly WaitForSingleObjectCallbackDelegate WaitForSingleObjectCallbackForRegisterDeviceLostCallbackWrapper = WaitForSingleObjectCallbackForRegisterDeviceLostCallback;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Throws an <see cref="InvalidOperationException"/> if the current device has been lost.
|
||||
/// </summary>
|
||||
@@ -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);
|
||||
|
||||
@@ -17,21 +17,6 @@ namespace ComputeSharp;
|
||||
/// <inheritdoc/>
|
||||
unsafe partial class GraphicsDevice
|
||||
{
|
||||
#if !NET6_0_OR_GREATER
|
||||
/// <summary>
|
||||
/// A delegate for a callback to pass to <see cref="Windows.RegisterWaitForSingleObject(HANDLE*, HANDLE, void*, void*, uint, uint)"/>.
|
||||
/// </summary>
|
||||
/// <param name="pContext">The input context.</param>
|
||||
/// <param name="timedOut">Whether the wait has timed out.</param>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate void WaitForSingleObjectCallbackDelegate(void* pContext, byte timedOut);
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="WaitForSingleObjectCallbackDelegate"/> instance wrapping <see cref="WaitForSingleObjectCallbackForWaitForFenceAsync(void*, byte)"/>.
|
||||
/// </summary>
|
||||
private static readonly WaitForSingleObjectCallbackDelegate WaitForSingleObjectCallbackForWaitForFenceAsyncWrapper = WaitForSingleObjectCallbackForWaitForFenceAsync;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Executes a given command list and waits for the operation to be completed.
|
||||
/// </summary>
|
||||
@@ -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<ulong, long>(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<ulong, long>(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);
|
||||
|
||||
@@ -101,44 +101,6 @@ partial class DeviceHelper
|
||||
/// </summary>
|
||||
private unsafe struct IDXGIFactory4As6Backcompat
|
||||
{
|
||||
#if !NET6_0_OR_GREATER
|
||||
/// <inheritdoc cref="Release"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate uint ReleaseDelegate(IDXGIFactory4As6Backcompat* @this);
|
||||
|
||||
/// <inheritdoc cref="EnumAdapters"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate int EnumAdaptersDelegate(IDXGIFactory4As6Backcompat* @this, uint Adapter, IDXGIAdapter** ppAdapter);
|
||||
|
||||
/// <inheritdoc cref="EnumWarpAdapter"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate int EnumWarpAdapterDelegate(IDXGIFactory4As6Backcompat* @this, Guid* riid, void** ppvAdapter);
|
||||
|
||||
/// <inheritdoc cref="EnumAdapterByGpuPreference"/>
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate int EnumAdapterByGpuPreferenceDelegate(IDXGIFactory4As6Backcompat* @this, uint Adapter, DXGI_GPU_PREFERENCE GpuPreference, Guid* riid, void** ppvAdapter);
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="ReleaseDelegate"/> instance wrapping <see cref="Release"/>.
|
||||
/// </summary>
|
||||
private static readonly ReleaseDelegate ReleaseWrapper = Release;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="EnumAdaptersDelegate"/> instance wrapping <see cref="EnumAdapters"/>.
|
||||
/// </summary>
|
||||
private static readonly EnumAdaptersDelegate EnumAdaptersWrapper = EnumAdapters;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="EnumWarpAdapterDelegate"/> instance wrapping <see cref="EnumWarpAdapter"/>.
|
||||
/// </summary>
|
||||
private static readonly EnumWarpAdapterDelegate EnumWarpAdapterWrapper = EnumWarpAdapter;
|
||||
|
||||
/// <summary>
|
||||
/// A cached <see cref="EnumAdapterByGpuPreferenceDelegate"/> instance wrapping <see cref="EnumAdapterByGpuPreference"/>.
|
||||
/// </summary>
|
||||
private static readonly EnumAdapterByGpuPreferenceDelegate EnumAdapterByGpuPreferenceWrapper = EnumAdapterByGpuPreference;
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// The shared method table pointer for all <see cref="IDXGIFactory4As6Backcompat"/> instances.
|
||||
/// </summary>
|
||||
@@ -154,17 +116,10 @@ partial class DeviceHelper
|
||||
|
||||
new Span<IntPtr>(lpVtbl, 30).Clear();
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
lpVtbl[2] = (delegate* unmanaged<IDXGIFactory4As6Backcompat*, uint>)&Release;
|
||||
lpVtbl[7] = (delegate* unmanaged<IDXGIFactory4As6Backcompat*, uint, IDXGIAdapter**, int>)&EnumAdapters;
|
||||
lpVtbl[27] = (delegate* unmanaged<IDXGIFactory4As6Backcompat*, Guid*, void**, int>)&EnumWarpAdapter;
|
||||
lpVtbl[29] = (delegate* unmanaged<IDXGIFactory4As6Backcompat*, uint, DXGI_GPU_PREFERENCE, Guid*, void**, int>)&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;
|
||||
}
|
||||
|
||||
@@ -11,10 +11,7 @@ namespace ComputeSharp.Interop.Allocation;
|
||||
/// An allocation wrapper for a native <see cref="ID3D12Resource"/> object.
|
||||
/// </summary>
|
||||
[Guid("D42D5782-2DE7-4539-A817-482E3AA01E2E")]
|
||||
internal unsafe struct ID3D12Allocation
|
||||
#if NET6_0_OR_GREATER
|
||||
//: IUnknown.Interface
|
||||
#endif
|
||||
internal unsafe struct ID3D12Allocation //: IUnknown.Interface
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the <see cref="System.Guid"/> for <see cref="ID3D12Allocation"/> (<c>D42D5782-2DE7-4539-A817-482E3AA01E2E</c>).
|
||||
@@ -40,10 +37,8 @@ internal unsafe struct ID3D12Allocation
|
||||
}
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
///// <inheritdoc/>
|
||||
//static Guid* INativeGuid.NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in Guid));
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// The vtable for the current instance.
|
||||
|
||||
@@ -11,10 +11,7 @@ namespace ComputeSharp.Interop.Allocation;
|
||||
/// An object that can allocate resources for a given <see cref="ID3D12Device"/> instance.
|
||||
/// </summary>
|
||||
[Guid("2D5E55D2-9244-431F-868E-0D90AAB6E575")]
|
||||
internal unsafe struct ID3D12MemoryAllocator
|
||||
#if NET6_0_OR_GREATER
|
||||
//: IUnknown.Interface
|
||||
#endif
|
||||
internal unsafe struct ID3D12MemoryAllocator //: IUnknown.Interface
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the <see cref="System.Guid"/> for <see cref="ID3D12MemoryAllocator"/> (<c>2D5E55D2-9244-431F-868E-0D90AAB6E575</c>).
|
||||
@@ -40,10 +37,8 @@ internal unsafe struct ID3D12MemoryAllocator
|
||||
}
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
///// <inheritdoc/>
|
||||
//static Guid* INativeGuid.NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in Guid));
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// The vtable for the current instance.
|
||||
|
||||
@@ -11,10 +11,7 @@ namespace ComputeSharp.Interop.Allocation;
|
||||
/// A factory type for <see cref="ID3D12MemoryAllocator"/> objects.
|
||||
/// </summary>
|
||||
[Guid("CC1E74A7-786D-40F4-8AE2-F8B7A255587E")]
|
||||
internal unsafe struct ID3D12MemoryAllocatorFactory
|
||||
#if NET6_0_OR_GREATER
|
||||
//: IUnknown.Interface
|
||||
#endif
|
||||
internal unsafe struct ID3D12MemoryAllocatorFactory //: IUnknown.Interface
|
||||
{
|
||||
/// <summary>
|
||||
/// Gets the <see cref="System.Guid"/> for <see cref="ID3D12MemoryAllocatorFactory"/> (<c>CC1E74A7-786D-40F4-8AE2-F8B7A255587E</c>).
|
||||
@@ -40,10 +37,8 @@ internal unsafe struct ID3D12MemoryAllocatorFactory
|
||||
}
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
///// <inheritdoc/>
|
||||
//static Guid* INativeGuid.NativeGuid => (Guid*)Unsafe.AsPointer(ref Unsafe.AsRef(in Guid));
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// The vtable for the current instance.
|
||||
|
||||
@@ -9,10 +9,7 @@ namespace ComputeSharp;
|
||||
/// <summary>
|
||||
/// A locally unique identifier for a graphics device.
|
||||
/// </summary>
|
||||
public readonly struct Luid : IEquatable<Luid>
|
||||
#if NET6_0_OR_GREATER
|
||||
, ISpanFormattable
|
||||
#endif
|
||||
public readonly struct Luid : IEquatable<Luid>, ISpanFormattable
|
||||
{
|
||||
/// <summary>
|
||||
/// The low bits of the luid.
|
||||
@@ -63,7 +60,6 @@ public readonly struct Luid : IEquatable<Luid>
|
||||
return ((((long)this.highPart) << 32) | this.lowPart).ToString();
|
||||
}
|
||||
|
||||
#if NET6_0_OR_GREATER
|
||||
/// <inheritdoc/>
|
||||
public string ToString(string? format, IFormatProvider? formatProvider)
|
||||
{
|
||||
@@ -75,7 +71,6 @@ public readonly struct Luid : IEquatable<Luid>
|
||||
{
|
||||
return ((((long)this.highPart) << 32) | this.lowPart).TryFormat(destination, out charsWritten, format, provider);
|
||||
}
|
||||
#endif
|
||||
|
||||
/// <summary>
|
||||
/// Check whether two <see cref="Luid"/> values are equal.
|
||||
|
||||
@@ -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
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする