Use IComObject in remaining D2D types

Also adopt collection expressions for all IIDs
このコミットが含まれているのは:
Sergio Pedri committed 2023-11-23 20:26:44 +01:00
1 親 1a841c1c83
コミット 3ad17eaa6d
8ファイル変更
+77 -57

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

@@ -6,7 +6,7 @@ using TerraFX.Interop;
using WinRT;
using WinRT.Interop;
#pragma warning disable CS0649, IDE1006
#pragma warning disable CS0649, IDE0055, IDE1006
namespace ABI.Microsoft.Graphics.Canvas;
@@ -22,7 +22,8 @@ internal unsafe struct ICanvasFactoryNative : IUnknown.Interface
{
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0x0D, 0x44, 0x5C, 0x69,
0xB3, 0x04,
0xDD, 0x4E,
@@ -33,7 +34,7 @@ internal unsafe struct ICanvasFactoryNative : IUnknown.Interface
0x9F,
0x72,
0x02
};
];
return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
}
@@ -132,7 +132,7 @@ internal unsafe partial struct D2D1DrawInfoUpdateContextImpl
// ID2D1DrawInfoUpdateContext
if (riid->Equals(Windows.__uuidof<IUnknown>()) ||
riid->Equals(ID2D1DrawInfoUpdateContext.Guid))
riid->Equals(Windows.__uuidof<ID2D1DrawInfoUpdateContext>()))
{
_ = Interlocked.Increment(ref this.referenceCount);
@@ -142,7 +142,7 @@ internal unsafe partial struct D2D1DrawInfoUpdateContextImpl
}
// ID2D1DrawInfoUpdateContextInternal
if (riid->Equals(ID2D1DrawInfoUpdateContextInternal.Guid))
if (riid->Equals(Windows.__uuidof<ID2D1DrawInfoUpdateContextInternal>()))
{
_ = Interlocked.Increment(ref this.referenceCount);
@@ -3,23 +3,23 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using ComputeSharp.Win32;
#pragma warning disable CS0649
#pragma warning disable CS0649, IDE0055
namespace ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers;
/// <summary>
/// The updater for <see cref="ID2D1DrawInfo"/> type to use with built-in effects.
/// </summary>
internal unsafe struct ID2D1DrawInfoUpdateContext
internal unsafe struct ID2D1DrawInfoUpdateContext : IComObject
{
/// <summary>
/// Gets the <see cref="System.Guid"/> for <see cref="ID2D1DrawInfoUpdateContext"/> (<c>430C5B40-AE16-485F-90E6-4FA4915144B6</c>).
/// </summary>
public static ref readonly Guid Guid
/// <inheritdoc/>
static Guid* IComObject.IID
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0x40, 0x5B, 0x0C, 0x43,
0x16, 0xAE,
0x5F, 0x48,
@@ -30,9 +30,9 @@ internal unsafe struct ID2D1DrawInfoUpdateContext
0x51,
0x44,
0xB6
};
];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
}
}
@@ -3,23 +3,23 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using ComputeSharp.Win32;
#pragma warning disable CS0649
#pragma warning disable CS0649, IDE0055
namespace ComputeSharp.D2D1.Shaders.Interop.Effects.TransformMappers;
/// <summary>
/// An internal version of <see cref="ID2D1DrawInfoUpdateContext"/> that supports being closed, to manage lifetime scopes.
/// </summary>
internal unsafe struct ID2D1DrawInfoUpdateContextInternal
internal unsafe struct ID2D1DrawInfoUpdateContextInternal : IComObject
{
/// <summary>
/// Gets the <see cref="System.Guid"/> for <see cref="ID2D1DrawInfoUpdateContextInternal"/> (<c>CF2F5BB0-3F5E-4D6E-8FF1-D9A7EB6C0250</c>).
/// </summary>
public static ref readonly Guid Guid
/// <inheritdoc/>
static Guid* IComObject.IID
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0xB0, 0x5B, 0x2F, 0xCF,
0x5E, 0x3F,
0x6E, 0x4D,
@@ -30,9 +30,9 @@ internal unsafe struct ID2D1DrawInfoUpdateContextInternal
0x6C,
0x02,
0x50
};
];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
return (Guid*)Unsafe.AsPointer(ref MemoryMarshal.GetReference(data));
}
}
+6 -4
ファイルの表示
@@ -17,7 +17,8 @@ internal static partial class CLSID
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0x20, 0x3C, 0xC2, 0x61,
0x69, 0xAE,
0x8E, 0x4D,
@@ -29,7 +30,7 @@ internal static partial class CLSID
0xF6,
0x38,
0xF2
};
];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
@@ -41,7 +42,8 @@ internal static partial class CLSID
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0xC7, 0xC5, 0x26, 0x6C,
0xE0, 0x34,
0xFC, 0x46,
@@ -53,7 +55,7 @@ internal static partial class CLSID
0x06,
0xE2,
0x28
};
];
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
}
+3 -2
ファイルの表示
@@ -18,7 +18,8 @@ internal static partial class CLSID
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0xAF, 0xD6, 0x45, 0x62,
0xE0, 0x66,
0xFD, 0x48,
@@ -30,7 +31,7 @@ internal static partial class CLSID
0x96,
0x74,
0x8C
};
];
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
+8 -4
ファイルの表示
@@ -14,9 +14,11 @@ internal static partial class IID
{
public static ref readonly Guid IID_ISequentialStream
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0x30, 0x3A, 0x73, 0x0C,
0x1C, 0x2A,
0xCE, 0x11,
@@ -28,7 +30,7 @@ internal static partial class IID
0x44,
0x77,
0x3D
};
];
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
@@ -37,9 +39,11 @@ internal static partial class IID
public static ref readonly Guid IID_IStream
{
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0x0C, 0x00, 0x00, 0x00,
0x00, 0x00,
0x00, 0x00,
@@ -51,7 +55,7 @@ internal static partial class IID
0x00,
0x00,
0x46
};
];
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
+36 -24
ファイルの表示
@@ -18,7 +18,8 @@ internal static partial class GUID
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0x7E, 0xD8, 0xF1, 0x0A,
0xFE, 0xFC,
0x88, 0x41,
@@ -30,7 +31,7 @@ internal static partial class GUID
0x71,
0xCB,
0xE3
};
];
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
@@ -43,7 +44,8 @@ internal static partial class GUID
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0xF4, 0xFA, 0x7C, 0x1B,
0x3F, 0x71,
0x3C, 0x47,
@@ -55,7 +57,7 @@ internal static partial class GUID
0x5F,
0xAE,
0xAF
};
];
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
@@ -68,7 +70,8 @@ internal static partial class GUID
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0xAA, 0xA5, 0xE4, 0x19,
0x62, 0x56,
0xC5, 0x4F,
@@ -80,7 +83,7 @@ internal static partial class GUID
0x8E,
0x10,
0x57
};
];
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
@@ -93,7 +96,8 @@ internal static partial class GUID
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0x30, 0xCC, 0x3B, 0x16,
0xE9, 0xE2,
0x0B, 0x4F,
@@ -105,7 +109,7 @@ internal static partial class GUID
0xB7,
0x88,
0xA3
};
];
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
@@ -118,7 +122,8 @@ internal static partial class GUID
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0xAA, 0x7C, 0xA3, 0x57,
0x7A, 0x36,
0x40, 0x45,
@@ -130,7 +135,7 @@ internal static partial class GUID
0x09,
0x3A,
0x4B
};
];
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
@@ -143,7 +148,8 @@ internal static partial class GUID
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0x95, 0xCB, 0x67, 0x99,
0x85, 0x2E,
0xC8, 0x4A,
@@ -155,7 +161,7 @@ internal static partial class GUID
0xD4,
0x25,
0xC9
};
];
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
@@ -168,7 +174,8 @@ internal static partial class GUID
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0x24, 0xC3, 0xDD, 0x6F,
0x03, 0x4E,
0xFE, 0x4B,
@@ -180,7 +187,7 @@ internal static partial class GUID
0x8D,
0xC9,
0x08
};
];
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
@@ -193,7 +200,8 @@ internal static partial class GUID
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0x24, 0xC3, 0xDD, 0x6F,
0x03, 0x4E,
0xFE, 0x4B,
@@ -205,7 +213,7 @@ internal static partial class GUID
0x8D,
0xC9,
0x0B
};
];
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
@@ -218,7 +226,8 @@ internal static partial class GUID
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0x24, 0xC3, 0xDD, 0x6F,
0x03, 0x4E,
0xFE, 0x4B,
@@ -230,7 +239,7 @@ internal static partial class GUID
0x8D,
0xC9,
0x0C
};
];
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
@@ -243,7 +252,8 @@ internal static partial class GUID
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0x24, 0xC3, 0xDD, 0x6F,
0x03, 0x4E,
0xFE, 0x4B,
@@ -255,7 +265,7 @@ internal static partial class GUID
0x8D,
0xC9,
0x0F
};
];
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
@@ -268,7 +278,8 @@ internal static partial class GUID
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0x2D, 0xAD, 0xC7, 0xF5,
0x8D, 0x6A,
0xDD, 0x43,
@@ -280,7 +291,7 @@ internal static partial class GUID
0x26,
0x1A,
0xE9
};
];
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));
@@ -293,7 +304,8 @@ internal static partial class GUID
[MethodImpl(MethodImplOptions.AggressiveInlining)]
get
{
ReadOnlySpan<byte> data = new byte[] {
ReadOnlySpan<byte> data =
[
0x24, 0xC3, 0xDD, 0x6F,
0x03, 0x4E,
0xFE, 0x4B,
@@ -305,7 +317,7 @@ internal static partial class GUID
0x8D,
0xC9,
0x16
};
];
Debug.Assert(data.Length == Unsafe.SizeOf<Guid>());
return ref Unsafe.As<byte, Guid>(ref MemoryMarshal.GetReference(data));