diff --git a/ComputeSharp.sln b/ComputeSharp.sln
index 6b4f3208..3a191376 100644
--- a/ComputeSharp.sln
+++ b/ComputeSharp.sln
@@ -96,7 +96,7 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.SourceGenerati
EndProject
Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.SourceGeneration.Hlsl", "src\ComputeSharp.SourceGeneration.Hlsl\ComputeSharp.SourceGeneration.Hlsl.shproj", "{9AC496A3-BBF0-4C8F-A50D-A20BF01C5E05}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComputeSharp.D2D1Interop.Tests", "tests\ComputeSharp.D2D1Interop.Tests\ComputeSharp.D2D1Interop.Tests.csproj", "{209C95A3-FA53-431B-B688-3299CA6C29D2}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.D2D1Interop.Tests", "tests\ComputeSharp.D2D1Interop.Tests\ComputeSharp.D2D1Interop.Tests.csproj", "{209C95A3-FA53-431B-B688-3299CA6C29D2}"
EndProject
Global
GlobalSection(SharedMSBuildProjectFiles) = preSolution
@@ -109,7 +109,6 @@ Global
src\ComputeSharp.NetStandard\ComputeSharp.NetStandard.projitems*{314eb353-e7e3-4146-8111-685cc83ec1de}*SharedItemsImports = 5
src\TerraFX.Interop.Windows\TerraFX.Interop.Windows.projitems*{314eb353-e7e3-4146-8111-685cc83ec1de}*SharedItemsImports = 5
src\ComputeSharp.Core.NetStandard\ComputeSharp.Core.NetStandard.projitems*{3acacf03-6b20-40ba-b8ec-11ac1624d2c9}*SharedItemsImports = 13
- src\ComputeSharp.D2D1Interop.NetStandard\ComputeSharp.D2D1Interop.NetStandard.projitems*{4d7d9ba8-a821-4b1c-9ee2-cbcf5849906e}*SharedItemsImports = 5
src\TerraFX.Interop.Windows.D2D1Interop\TerraFX.Interop.Windows.D2D1Interop.projitems*{4d7d9ba8-a821-4b1c-9ee2-cbcf5849906e}*SharedItemsImports = 5
src\TerraFX.Interop.Windows\TerraFX.Interop.Windows.projitems*{514ff00e-bbf0-4d55-a47c-eeeb6208adce}*SharedItemsImports = 13
src\ComputeSharp.SourceGeneration\ComputeSharp.SourceGeneration.projitems*{51d5a422-d3a5-4c4d-8a6d-a048940bf279}*SharedItemsImports = 13
diff --git a/src/ComputeSharp.D2D1Interop/ComputeSharp.D2D1Interop.csproj b/src/ComputeSharp.D2D1Interop/ComputeSharp.D2D1Interop.csproj
index 6679dc5a..a2eea4a2 100644
--- a/src/ComputeSharp.D2D1Interop/ComputeSharp.D2D1Interop.csproj
+++ b/src/ComputeSharp.D2D1Interop/ComputeSharp.D2D1Interop.csproj
@@ -1,6 +1,6 @@
- netstandard2.0;net6.0
+ net6.0
bin\Release
ComputeSharp.D2D1Interop.xml
AnyCPU;x64;ARM64
diff --git a/tests/ComputeSharp.D2D1Interop.Tests/Helpers/D2D1InteropServices2.cs b/src/ComputeSharp.D2D1Interop/Shaders/Interop/D2D1InteropServices.Effects.cs
similarity index 90%
rename from tests/ComputeSharp.D2D1Interop.Tests/Helpers/D2D1InteropServices2.cs
rename to src/ComputeSharp.D2D1Interop/Shaders/Interop/D2D1InteropServices.Effects.cs
index 29852a12..2ffb12bd 100644
--- a/tests/ComputeSharp.D2D1Interop.Tests/Helpers/D2D1InteropServices2.cs
+++ b/src/ComputeSharp.D2D1Interop/Shaders/Interop/D2D1InteropServices.Effects.cs
@@ -1,15 +1,14 @@
using System;
using System.Text;
-using ComputeSharp.D2D1Interop.Tests.Extensions;
+using ComputeSharp.D2D1Interop.Extensions;
+using ComputeSharp.D2D1Interop.Tests.Helpers;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
-namespace ComputeSharp.D2D1Interop.Tests.Helpers;
+namespace ComputeSharp.D2D1Interop;
-///
-/// Provides methods to extract reflection info on D2D1 shaders generated using this library.
-///
-internal static class D2D1InteropServices2
+///
+unsafe partial class D2D1InteropServices
{
///
/// Registers an effect from an input D2D1 pixel shader, by calling ID2D1Factory1::RegisterEffectFromString.
@@ -56,12 +55,12 @@ internal static class D2D1InteropServices2
D2D1_PROPERTY_BINDING d2D1PropertyBinding;
d2D1PropertyBinding.propertyName = (ushort*)pPropertyName;
d2D1PropertyBinding.getFunction =
- (delegate* unmanaged)
- (delegate* unmanaged)
+ (delegate* unmanaged[Stdcall])
+ (delegate* unmanaged[Stdcall])
&PixelShaderEffect.GetConstantBuffer;
d2D1PropertyBinding.setFunction =
- (delegate* unmanaged)
- (delegate* unmanaged)
+ (delegate* unmanaged[Stdcall])
+ (delegate* unmanaged[Stdcall])
&PixelShaderEffect.SetConstantBuffer;
Guid shaderId = typeof(T).GUID;
diff --git a/src/ComputeSharp.D2D1Interop/Shaders/Interop/D2D1InteropServices.cs b/src/ComputeSharp.D2D1Interop/Shaders/Interop/D2D1InteropServices.cs
index 9b26ca18..134b5b20 100644
--- a/src/ComputeSharp.D2D1Interop/Shaders/Interop/D2D1InteropServices.cs
+++ b/src/ComputeSharp.D2D1Interop/Shaders/Interop/D2D1InteropServices.cs
@@ -12,7 +12,7 @@ namespace ComputeSharp.D2D1Interop;
///
/// Provides methods to extract reflection info on D2D1 shaders generated using this library.
///
-public static unsafe class D2D1InteropServices
+public static unsafe partial class D2D1InteropServices
{
///
/// Loads the bytecode from an input D2D1 pixel shader.
diff --git a/tests/ComputeSharp.D2D1Interop.Tests/Helpers/PixelShaderEffect.ID2D1DrawTransformMethods.cs b/src/ComputeSharp.D2D1Interop/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs
similarity index 100%
rename from tests/ComputeSharp.D2D1Interop.Tests/Helpers/PixelShaderEffect.ID2D1DrawTransformMethods.cs
rename to src/ComputeSharp.D2D1Interop/Shaders/Interop/Effects/PixelShaderEffect.ID2D1DrawTransformMethods.cs
diff --git a/tests/ComputeSharp.D2D1Interop.Tests/Helpers/PixelShaderEffect.ID2D1EffectImplMethods.cs b/src/ComputeSharp.D2D1Interop/Shaders/Interop/Effects/PixelShaderEffect.ID2D1EffectImplMethods.cs
similarity index 100%
rename from tests/ComputeSharp.D2D1Interop.Tests/Helpers/PixelShaderEffect.ID2D1EffectImplMethods.cs
rename to src/ComputeSharp.D2D1Interop/Shaders/Interop/Effects/PixelShaderEffect.ID2D1EffectImplMethods.cs
diff --git a/tests/ComputeSharp.D2D1Interop.Tests/Helpers/PixelShaderEffect.cs b/src/ComputeSharp.D2D1Interop/Shaders/Interop/Effects/PixelShaderEffect.cs
similarity index 94%
rename from tests/ComputeSharp.D2D1Interop.Tests/Helpers/PixelShaderEffect.cs
rename to src/ComputeSharp.D2D1Interop/Shaders/Interop/Effects/PixelShaderEffect.cs
index 7bc9d786..cec6e777 100644
--- a/tests/ComputeSharp.D2D1Interop.Tests/Helpers/PixelShaderEffect.cs
+++ b/src/ComputeSharp.D2D1Interop/Shaders/Interop/Effects/PixelShaderEffect.cs
@@ -17,7 +17,7 @@ internal unsafe partial struct PixelShaderEffect
///
/// The resulting effect factory.
/// The HRESULT for the operation.
- [UnmanagedFunctionPointer(CallingConvention.Winapi)]
+ [UnmanagedFunctionPointer(CallingConvention.StdCall)]
private delegate int FactoryDelegate(IUnknown** effectImpl);
///
@@ -73,9 +73,9 @@ internal unsafe partial struct PixelShaderEffect
///
/// Gets the factory for the current effect.
///
- public static delegate* unmanaged Factory
+ public static delegate* unmanaged[Stdcall] Factory
{
- get => (delegate* unmanaged)Marshal.GetFunctionPointerForDelegate(EffectFactory);
+ get => (delegate* unmanaged[Stdcall])Marshal.GetFunctionPointerForDelegate(EffectFactory);
}
///
@@ -185,7 +185,7 @@ internal unsafe partial struct PixelShaderEffect
private ID2D1DrawInfo* d2D1DrawInfo;
///
- /// The factory method for .
+ /// The factory method for .
///
/// The for the shader.
/// The shader bytecode.
@@ -213,7 +213,7 @@ internal unsafe partial struct PixelShaderEffect
}
///
- [UnmanagedCallersOnly]
+ [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })]
public static int GetConstantBuffer(IUnknown* effect, byte* data, uint dataSize, uint* actualSize)
{
PixelShaderEffect* @this = (PixelShaderEffect*)effect;
@@ -235,7 +235,7 @@ internal unsafe partial struct PixelShaderEffect
}
///
- [UnmanagedCallersOnly]
+ [UnmanagedCallersOnly(CallConvs = new[] { typeof(CallConvStdcall) })]
public static int SetConstantBuffer(IUnknown* effect, byte* data, uint dataSize)
{
PixelShaderEffect* @this = (PixelShaderEffect*)effect;
@@ -255,7 +255,7 @@ internal unsafe partial struct PixelShaderEffect
return S.S_OK;
}
- ///
+ ///
private int QueryInterface(Guid* riid, void** ppvObject)
{
if (ppvObject is null)
@@ -291,13 +291,13 @@ internal unsafe partial struct PixelShaderEffect
return E.E_NOINTERFACE;
}
- ///
+ ///
private uint AddRef()
{
return (uint)Interlocked.Increment(ref this.referenceCount);
}
- ///
+ ///
private uint Release()
{
uint referenceCount = (uint)Interlocked.Decrement(ref this.referenceCount);
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1_1/D2D1_PROPERTY_TYPE.cs b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1_1/D2D1_PROPERTY_TYPE.cs
new file mode 100644
index 00000000..e7c40874
--- /dev/null
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1_1/D2D1_PROPERTY_TYPE.cs
@@ -0,0 +1,12 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/d2d1_1.h in the Windows SDK for Windows 10.0.22000.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+namespace TerraFX.Interop.DirectX
+{
+ internal enum D2D1_PROPERTY_TYPE : uint
+ {
+ D2D1_PROPERTY_TYPE_BLOB = 9
+ }
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1_1/ID2D1DeviceContext.cs b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1_1/ID2D1DeviceContext.cs
new file mode 100644
index 00000000..e612b6d4
--- /dev/null
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1_1/ID2D1DeviceContext.cs
@@ -0,0 +1,29 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/d2d1_1.h in the Windows SDK for Windows 10.0.22000.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using TerraFX.Interop.Windows;
+
+#pragma warning disable CS0649
+
+namespace TerraFX.Interop.DirectX
+{
+ [Guid("E8F7FE7A-191C-466D-AD95-975678BDA998")]
+ [NativeTypeName("struct ID2D1DeviceContext : ID2D1RenderTarget")]
+ [NativeInheritance("ID2D1RenderTarget")]
+ internal unsafe partial struct ID2D1DeviceContext
+ {
+ public void** lpVtbl;
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(63)]
+ public HRESULT CreateEffect([NativeTypeName("const IID &")] Guid* effectId, ID2D1Effect** effect)
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[63]))((ID2D1DeviceContext*)Unsafe.AsPointer(ref this), effectId, effect);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1_1/ID2D1Effect.cs b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1_1/ID2D1Effect.cs
new file mode 100644
index 00000000..faa1afde
--- /dev/null
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1_1/ID2D1Effect.cs
@@ -0,0 +1,29 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/d2d1_1.h in the Windows SDK for Windows 10.0.22000.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using TerraFX.Interop.Windows;
+
+#pragma warning disable CS0649
+
+namespace TerraFX.Interop.DirectX
+{
+ [Guid("28211A43-7D89-476F-8181-2D6159B220AD")]
+ [NativeTypeName("struct ID2D1Effect : ID2D1Properties")]
+ [NativeInheritance("ID2D1Properties")]
+ internal unsafe partial struct ID2D1Effect
+ {
+ public void** lpVtbl;
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(9)]
+ public HRESULT SetValue([NativeTypeName("UINT32")] uint index, D2D1_PROPERTY_TYPE type, [NativeTypeName("const BYTE *")] byte* data, [NativeTypeName("UINT32")] uint dataSize)
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[9]))((ID2D1Effect*)Unsafe.AsPointer(ref this), index, type, data, dataSize);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1_1/ID2D1Factory1.cs b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1_1/ID2D1Factory1.cs
new file mode 100644
index 00000000..15c8bf2c
--- /dev/null
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1_1/ID2D1Factory1.cs
@@ -0,0 +1,29 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/d2d1_1.h in the Windows SDK for Windows 10.0.22000.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using TerraFX.Interop.Windows;
+
+#pragma warning disable CS0649
+
+namespace TerraFX.Interop.DirectX
+{
+ [Guid("BB12D362-DAEE-4B9A-AA1D-14BA401CFA1F")]
+ [NativeTypeName("struct ID2D1Factory1 : ID2D1Factory")]
+ [NativeInheritance("ID2D1Factory")]
+ internal unsafe partial struct ID2D1Factory1
+ {
+ public void** lpVtbl;
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(23)]
+ public HRESULT RegisterEffectFromString([NativeTypeName("const IID &")] Guid* classId, [NativeTypeName("PCWSTR")] ushort* propertyXml, [NativeTypeName("const D2D1_PROPERTY_BINDING *")] D2D1_PROPERTY_BINDING* bindings, [NativeTypeName("UINT32")] uint bindingsCount, [NativeTypeName("const PD2D1_EFFECT_FACTORY")] delegate* unmanaged[Stdcall] effectFactory)
+ {
+ return ((delegate* unmanaged[Stdcall], int>)(lpVtbl[23]))((ID2D1Factory1*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/D2D1_CHANGE_TYPE.cs b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/D2D1_CHANGE_TYPE.cs
new file mode 100644
index 00000000..071cdb7c
--- /dev/null
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/D2D1_CHANGE_TYPE.cs
@@ -0,0 +1,19 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+using System;
+
+namespace TerraFX.Interop.DirectX
+{
+ [Flags]
+ internal enum D2D1_CHANGE_TYPE : uint
+ {
+ D2D1_CHANGE_TYPE_NONE = 0,
+ D2D1_CHANGE_TYPE_PROPERTIES = 1,
+ D2D1_CHANGE_TYPE_CONTEXT = 2,
+ D2D1_CHANGE_TYPE_GRAPH = 3,
+ D2D1_CHANGE_TYPE_FORCE_DWORD = 0xffffffff,
+ }
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/D2D1_PIXEL_OPTIONS.cs b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/D2D1_PIXEL_OPTIONS.cs
new file mode 100644
index 00000000..446d86ae
--- /dev/null
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/D2D1_PIXEL_OPTIONS.cs
@@ -0,0 +1,17 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+using System;
+
+namespace TerraFX.Interop.DirectX
+{
+ [Flags]
+ internal enum D2D1_PIXEL_OPTIONS : uint
+ {
+ D2D1_PIXEL_OPTIONS_NONE = 0,
+ D2D1_PIXEL_OPTIONS_TRIVIAL_SAMPLING = 1,
+ D2D1_PIXEL_OPTIONS_FORCE_DWORD = 0xffffffff,
+ }
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/D2D1_PROPERTY_BINDING.cs b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/D2D1_PROPERTY_BINDING.cs
new file mode 100644
index 00000000..260517aa
--- /dev/null
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/D2D1_PROPERTY_BINDING.cs
@@ -0,0 +1,23 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+#pragma warning disable CS0649
+
+using TerraFX.Interop.Windows;
+
+namespace TerraFX.Interop.DirectX
+{
+ internal unsafe partial struct D2D1_PROPERTY_BINDING
+ {
+ [NativeTypeName("PCWSTR")]
+ public ushort* propertyName;
+
+ [NativeTypeName("PD2D1_PROPERTY_SET_FUNCTION")]
+ public delegate* unmanaged[Stdcall] setFunction;
+
+ [NativeTypeName("PD2D1_PROPERTY_GET_FUNCTION")]
+ public delegate* unmanaged[Stdcall] getFunction;
+ }
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1DrawInfo.cs b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1DrawInfo.cs
index 5f3fc333..2c94d473 100644
--- a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1DrawInfo.cs
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1DrawInfo.cs
@@ -7,6 +7,7 @@ using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using TerraFX.Interop.Windows;
+using static TerraFX.Interop.DirectX.D2D1_PIXEL_OPTIONS;
#pragma warning disable CS0649
@@ -25,5 +26,12 @@ namespace TerraFX.Interop.DirectX
{
return ((delegate* unmanaged[Stdcall])(lpVtbl[7]))((ID2D1DrawInfo*)Unsafe.AsPointer(ref this), buffer, bufferCount);
}
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(10)]
+ public HRESULT SetPixelShader([NativeTypeName("const GUID &")] Guid* shaderId, D2D1_PIXEL_OPTIONS pixelOptions = D2D1_PIXEL_OPTIONS_NONE)
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[10]))((ID2D1DrawInfo*)Unsafe.AsPointer(ref this), shaderId, pixelOptions);
+ }
}
}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1DrawTransform.cs b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1DrawTransform.cs
new file mode 100644
index 00000000..064cece3
--- /dev/null
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1DrawTransform.cs
@@ -0,0 +1,81 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using TerraFX.Interop.Windows;
+
+#pragma warning disable CS0649
+
+namespace TerraFX.Interop.DirectX
+{
+ [Guid("36BFDCB6-9739-435D-A30D-A653BEFF6A6F")]
+ [NativeTypeName("struct ID2D1DrawTransform : ID2D1Transform")]
+ [NativeInheritance("ID2D1Transform")]
+ internal unsafe partial struct ID2D1DrawTransform
+ {
+ public void** lpVtbl;
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(0)]
+ public HRESULT QueryInterface([NativeTypeName("const IID &")] Guid* riid, void** ppvObject)
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[0]))((ID2D1DrawTransform*)Unsafe.AsPointer(ref this), riid, ppvObject);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(1)]
+ [return: NativeTypeName("ULONG")]
+ public uint AddRef()
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[1]))((ID2D1DrawTransform*)Unsafe.AsPointer(ref this));
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(2)]
+ [return: NativeTypeName("ULONG")]
+ public uint Release()
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[2]))((ID2D1DrawTransform*)Unsafe.AsPointer(ref this));
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(3)]
+ [return: NativeTypeName("UINT32")]
+ public uint GetInputCount()
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ID2D1DrawTransform*)Unsafe.AsPointer(ref this));
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(4)]
+ public HRESULT MapOutputRectToInputRects([NativeTypeName("const D2D1_RECT_L *")] RECT* outputRect, [NativeTypeName("D2D1_RECT_L *")] RECT* inputRects, [NativeTypeName("UINT32")] uint inputRectsCount)
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[4]))((ID2D1DrawTransform*)Unsafe.AsPointer(ref this), outputRect, inputRects, inputRectsCount);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(5)]
+ public HRESULT MapInputRectsToOutputRect([NativeTypeName("const D2D1_RECT_L *")] RECT* inputRects, [NativeTypeName("const D2D1_RECT_L *")] RECT* inputOpaqueSubRects, [NativeTypeName("UINT32")] uint inputRectCount, [NativeTypeName("D2D1_RECT_L *")] RECT* outputRect, [NativeTypeName("D2D1_RECT_L *")] RECT* outputOpaqueSubRect)
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[5]))((ID2D1DrawTransform*)Unsafe.AsPointer(ref this), inputRects, inputOpaqueSubRects, inputRectCount, outputRect, outputOpaqueSubRect);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(6)]
+ public HRESULT MapInvalidRect([NativeTypeName("UINT32")] uint inputIndex, [NativeTypeName("D2D1_RECT_L")] RECT invalidInputRect, [NativeTypeName("D2D1_RECT_L *")] RECT* invalidOutputRect)
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[6]))((ID2D1DrawTransform*)Unsafe.AsPointer(ref this), inputIndex, invalidInputRect, invalidOutputRect);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(7)]
+ public HRESULT SetDrawInfo(ID2D1DrawInfo* drawInfo)
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[7]))((ID2D1DrawTransform*)Unsafe.AsPointer(ref this), drawInfo);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1EffectContext.cs b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1EffectContext.cs
new file mode 100644
index 00000000..21bcf154
--- /dev/null
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1EffectContext.cs
@@ -0,0 +1,43 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using TerraFX.Interop.Windows;
+
+#pragma warning disable CS0649
+
+namespace TerraFX.Interop.DirectX
+{
+ [Guid("3D9F916B-27DC-4AD7-B4F1-64945340F563")]
+ [NativeTypeName("struct ID2D1EffectContext : IUnknown")]
+ [NativeInheritance("IUnknown")]
+ internal unsafe partial struct ID2D1EffectContext
+ {
+ public void** lpVtbl;
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(4)]
+ public HRESULT CreateEffect([NativeTypeName("const IID &")] Guid* effectId, void** effect)
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[4]))((ID2D1EffectContext*)Unsafe.AsPointer(ref this), effectId, effect);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(11)]
+ public HRESULT LoadPixelShader([NativeTypeName("const GUID &")] Guid* shaderId, [NativeTypeName("const BYTE *")] byte* shaderBuffer, [NativeTypeName("UINT32")] uint shaderBufferCount)
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[11]))((ID2D1EffectContext*)Unsafe.AsPointer(ref this), shaderId, shaderBuffer, shaderBufferCount);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(14)]
+ public int IsShaderLoaded([NativeTypeName("const GUID &")] Guid* shaderId)
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[14]))((ID2D1EffectContext*)Unsafe.AsPointer(ref this), shaderId);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1EffectImpl.cs b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1EffectImpl.cs
new file mode 100644
index 00000000..1480f720
--- /dev/null
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1EffectImpl.cs
@@ -0,0 +1,66 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using TerraFX.Interop.Windows;
+
+#pragma warning disable CS0649
+
+namespace TerraFX.Interop.DirectX
+{
+ [Guid("A248FD3F-3E6C-4E63-9F03-7F68ECC91DB9")]
+ [NativeTypeName("struct ID2D1EffectImpl : IUnknown")]
+ [NativeInheritance("IUnknown")]
+ internal unsafe partial struct ID2D1EffectImpl
+ {
+ public void** lpVtbl;
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(0)]
+ public HRESULT QueryInterface([NativeTypeName("const IID &")] Guid* riid, void** ppvObject)
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[0]))((ID2D1EffectImpl*)Unsafe.AsPointer(ref this), riid, ppvObject);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(1)]
+ [return: NativeTypeName("ULONG")]
+ public uint AddRef()
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[1]))((ID2D1EffectImpl*)Unsafe.AsPointer(ref this));
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(2)]
+ [return: NativeTypeName("ULONG")]
+ public uint Release()
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[2]))((ID2D1EffectImpl*)Unsafe.AsPointer(ref this));
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(3)]
+ public HRESULT Initialize(ID2D1EffectContext* effectContext, ID2D1TransformGraph* transformGraph)
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[3]))((ID2D1EffectImpl*)Unsafe.AsPointer(ref this), effectContext, transformGraph);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(4)]
+ public HRESULT PrepareForRender(D2D1_CHANGE_TYPE changeType)
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[4]))((ID2D1EffectImpl*)Unsafe.AsPointer(ref this), changeType);
+ }
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(5)]
+ public HRESULT SetGraph(ID2D1TransformGraph* transformGraph)
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[5]))((ID2D1EffectImpl*)Unsafe.AsPointer(ref this), transformGraph);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1Transform.cs b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1Transform.cs
new file mode 100644
index 00000000..0db52274
--- /dev/null
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1Transform.cs
@@ -0,0 +1,20 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+
+#pragma warning disable CS0649
+
+namespace TerraFX.Interop.DirectX
+{
+ [Guid("EF1A287D-342A-4F76-8FDB-DA0D6EA9F92B")]
+ [NativeTypeName("struct ID2D1Transform : ID2D1TransformNode")]
+ [NativeInheritance("ID2D1TransformNode")]
+ internal unsafe partial struct ID2D1Transform
+ {
+ public void** lpVtbl;
+ }
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1TransformGraph.cs b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1TransformGraph.cs
new file mode 100644
index 00000000..923993c1
--- /dev/null
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1TransformGraph.cs
@@ -0,0 +1,29 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+using System;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+using TerraFX.Interop.Windows;
+
+#pragma warning disable CS0649
+
+namespace TerraFX.Interop.DirectX
+{
+ [Guid("13D29038-C3E6-4034-9081-13B53A417992")]
+ [NativeTypeName("struct ID2D1TransformGraph : IUnknown")]
+ [NativeInheritance("IUnknown")]
+ internal unsafe partial struct ID2D1TransformGraph
+ {
+ public void** lpVtbl;
+
+ [MethodImpl(MethodImplOptions.AggressiveInlining)]
+ [VtblIndex(4)]
+ public HRESULT SetSingleTransformNode(ID2D1TransformNode* node)
+ {
+ return ((delegate* unmanaged[Stdcall])(lpVtbl[4]))((ID2D1TransformGraph*)Unsafe.AsPointer(ref this), node);
+ }
+ }
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1TransformNode.cs b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1TransformNode.cs
new file mode 100644
index 00000000..aa2a61c9
--- /dev/null
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/DirectX/um/d2d1effectauthor/ID2D1TransformNode.cs
@@ -0,0 +1,20 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from um/d2d1effectauthor.h in the Windows SDK for Windows 10.0.22000.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+using System;
+using System.Runtime.InteropServices;
+
+#pragma warning disable CS0649
+
+namespace TerraFX.Interop.DirectX
+{
+ [Guid("B2EFE1E7-729F-4102-949F-505FA21BF666")]
+ [NativeTypeName("struct ID2D1TransformNode : IUnknown")]
+ [NativeInheritance("IUnknown")]
+ internal unsafe partial struct ID2D1TransformNode
+ {
+ public void** lpVtbl;
+ }
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/TerraFX.Interop.Windows.D2D1Interop.projitems b/src/TerraFX.Interop.Windows.D2D1Interop/TerraFX.Interop.Windows.D2D1Interop.projitems
index 79eec306..208d7c76 100644
--- a/src/TerraFX.Interop.Windows.D2D1Interop/TerraFX.Interop.Windows.D2D1Interop.projitems
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/TerraFX.Interop.Windows.D2D1Interop.projitems
@@ -10,6 +10,19 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
@@ -33,5 +46,8 @@
+
+
+
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/Windows/shared/windef/RECT.cs b/src/TerraFX.Interop.Windows.D2D1Interop/Windows/shared/windef/RECT.cs
new file mode 100644
index 00000000..614ff8b9
--- /dev/null
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/Windows/shared/windef/RECT.cs
@@ -0,0 +1,24 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from shared/windef.h in the Windows SDK for Windows 10.0.22000.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+#pragma warning disable CS0649
+
+namespace TerraFX.Interop.Windows
+{
+ internal struct RECT
+ {
+ [NativeTypeName("LONG")]
+ public int left;
+
+ [NativeTypeName("LONG")]
+ public int top;
+
+ [NativeTypeName("LONG")]
+ public int right;
+
+ [NativeTypeName("LONG")]
+ public int bottom;
+ }
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/Windows/shared/winerror/E.cs b/src/TerraFX.Interop.Windows.D2D1Interop/Windows/shared/winerror/E.cs
new file mode 100644
index 00000000..83bdfaaa
--- /dev/null
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/Windows/shared/winerror/E.cs
@@ -0,0 +1,22 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from shared/winerror.h in the Windows SDK for Windows 10.0.22000.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+namespace TerraFX.Interop.Windows
+{
+ internal static class E
+ {
+ [NativeTypeName("#define E_NOTIMPL _HRESULT_TYPEDEF_(0x80004001L)")]
+ public const int E_NOTIMPL = unchecked((int)(0x80004001));
+
+ [NativeTypeName("#define E_INVALIDARG _HRESULT_TYPEDEF_(0x80070057L)")]
+ public const int E_INVALIDARG = unchecked((int)(0x80070057));
+
+ [NativeTypeName("#define E_NOINTERFACE _HRESULT_TYPEDEF_(0x80004002L)")]
+ public const int E_NOINTERFACE = unchecked((int)(0x80004002));
+
+ [NativeTypeName("#define E_POINTER _HRESULT_TYPEDEF_(0x80004003L)")]
+ public const int E_POINTER = unchecked((int)(0x80004003));
+ }
+}
\ No newline at end of file
diff --git a/src/TerraFX.Interop.Windows.D2D1Interop/Windows/shared/winerror/Windows.cs b/src/TerraFX.Interop.Windows.D2D1Interop/Windows/shared/winerror/Windows.cs
new file mode 100644
index 00000000..b02c142b
--- /dev/null
+++ b/src/TerraFX.Interop.Windows.D2D1Interop/Windows/shared/winerror/Windows.cs
@@ -0,0 +1,15 @@
+// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
+
+// Ported from shared/winerror.h in the Windows SDK for Windows 10.0.22000.0
+// Original source is Copyright © Microsoft. All rights reserved.
+
+namespace TerraFX.Interop.Windows
+{
+ internal static partial class Windows
+ {
+ public static bool SUCCEEDED(HRESULT hr)
+ {
+ return hr >= 0;
+ }
+ }
+}
\ No newline at end of file
diff --git a/tests/ComputeSharp.D2D1Interop.Tests/Helpers/D2D1ShaderTestHelper.cs b/tests/ComputeSharp.D2D1Interop.Tests/Helpers/D2D1ShaderTestHelper.cs
index d9e75a4b..4ad1cc80 100644
--- a/tests/ComputeSharp.D2D1Interop.Tests/Helpers/D2D1ShaderTestHelper.cs
+++ b/tests/ComputeSharp.D2D1Interop.Tests/Helpers/D2D1ShaderTestHelper.cs
@@ -112,15 +112,15 @@ internal static class D2D1ShaderTestHelper
wicBitmapSource: (IWICBitmapSource*)wicBitmap.Get(),
bitmap: d2D1BitmapSource.GetAddressOf()).Assert();
- D2D1InteropServices2.RegisterPixelShaderEffectForD2D1Factory1(d2D1Factory2.Get(), out _);
+ D2D1InteropServices.RegisterPixelShaderEffectForD2D1Factory1(d2D1Factory2.Get(), out _);
using ComPtr d2D1Effect = default;
- D2D1InteropServices2.CreatePixelShaderEffectFromD2D1DeviceContext(
+ D2D1InteropServices.CreatePixelShaderEffectFromD2D1DeviceContext(
d2D1DeviceContext.Get(),
(void**)d2D1Effect.GetAddressOf());
- D2D1InteropServices2.SetConstantBufferForD2D1Effect(in shader, d2D1Effect.Get());
+ D2D1InteropServices.SetConstantBufferForD2D1Effect(in shader, d2D1Effect.Get());
d2D1Effect.Get()->SetInput(0, (ID2D1Image*)d2D1BitmapSource.Get());