Move PixelShaderEffect and interop APIs to ComputeSharp.D2D1Interop
Also added necessary polyfills
このコミットが含まれているのは:
1 親
33c87516f8
コミット
61b51c706b
26ファイル変更
+526
-26
検索条件に一致するファイルはありません
+1
-2
@@ -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
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
<PropertyGroup>
|
||||
<TargetFrameworks>netstandard2.0;net6.0</TargetFrameworks>
|
||||
<TargetFrameworks>net6.0</TargetFrameworks>
|
||||
<OutputPath>bin\Release</OutputPath>
|
||||
<DocumentationFile>ComputeSharp.D2D1Interop.xml</DocumentationFile>
|
||||
<Platforms>AnyCPU;x64;ARM64</Platforms>
|
||||
|
||||
+9
-10
@@ -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;
|
||||
|
||||
/// <summary>
|
||||
/// Provides methods to extract reflection info on D2D1 shaders generated using this library.
|
||||
/// </summary>
|
||||
internal static class D2D1InteropServices2
|
||||
/// <inheritdoc/>
|
||||
unsafe partial class D2D1InteropServices
|
||||
{
|
||||
/// <summary>
|
||||
/// Registers an effect from an input D2D1 pixel shader, by calling <c>ID2D1Factory1::RegisterEffectFromString</c>.
|
||||
@@ -56,12 +55,12 @@ internal static class D2D1InteropServices2
|
||||
D2D1_PROPERTY_BINDING d2D1PropertyBinding;
|
||||
d2D1PropertyBinding.propertyName = (ushort*)pPropertyName;
|
||||
d2D1PropertyBinding.getFunction =
|
||||
(delegate* unmanaged<IUnknown*, byte*, uint, uint*, HRESULT>)
|
||||
(delegate* unmanaged<IUnknown*, byte*, uint, uint*, int>)
|
||||
(delegate* unmanaged[Stdcall]<IUnknown*, byte*, uint, uint*, HRESULT>)
|
||||
(delegate* unmanaged[Stdcall]<IUnknown*, byte*, uint, uint*, int>)
|
||||
&PixelShaderEffect.GetConstantBuffer;
|
||||
d2D1PropertyBinding.setFunction =
|
||||
(delegate* unmanaged<IUnknown*, byte*, uint, HRESULT>)
|
||||
(delegate* unmanaged<IUnknown*, byte*, uint, int>)
|
||||
(delegate* unmanaged[Stdcall]<IUnknown*, byte*, uint, HRESULT>)
|
||||
(delegate* unmanaged[Stdcall]<IUnknown*, byte*, uint, int>)
|
||||
&PixelShaderEffect.SetConstantBuffer;
|
||||
|
||||
Guid shaderId = typeof(T).GUID;
|
||||
@@ -12,7 +12,7 @@ namespace ComputeSharp.D2D1Interop;
|
||||
/// <summary>
|
||||
/// Provides methods to extract reflection info on D2D1 shaders generated using this library.
|
||||
/// </summary>
|
||||
public static unsafe class D2D1InteropServices
|
||||
public static unsafe partial class D2D1InteropServices
|
||||
{
|
||||
/// <summary>
|
||||
/// Loads the bytecode from an input D2D1 pixel shader.
|
||||
|
||||
差分なしでファイル名を変更。
差分なしでファイル名を変更。
+9
-9
@@ -17,7 +17,7 @@ internal unsafe partial struct PixelShaderEffect
|
||||
/// </summary>
|
||||
/// <param name="effectImpl">The resulting effect factory.</param>
|
||||
/// <returns>The <c>HRESULT</c> for the operation.</returns>
|
||||
[UnmanagedFunctionPointer(CallingConvention.Winapi)]
|
||||
[UnmanagedFunctionPointer(CallingConvention.StdCall)]
|
||||
private delegate int FactoryDelegate(IUnknown** effectImpl);
|
||||
|
||||
/// <summary>
|
||||
@@ -73,9 +73,9 @@ internal unsafe partial struct PixelShaderEffect
|
||||
/// <summary>
|
||||
/// Gets the factory for the current effect.
|
||||
/// </summary>
|
||||
public static delegate* unmanaged<IUnknown**, HRESULT> Factory
|
||||
public static delegate* unmanaged[Stdcall]<IUnknown**, HRESULT> Factory
|
||||
{
|
||||
get => (delegate* unmanaged<IUnknown**, HRESULT>)Marshal.GetFunctionPointerForDelegate(EffectFactory);
|
||||
get => (delegate* unmanaged[Stdcall]<IUnknown**, HRESULT>)Marshal.GetFunctionPointerForDelegate(EffectFactory);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -185,7 +185,7 @@ internal unsafe partial struct PixelShaderEffect
|
||||
private ID2D1DrawInfo* d2D1DrawInfo;
|
||||
|
||||
/// <summary>
|
||||
/// The factory method for <see cref="ID2D1Factory2.RegisterEffectFromString"/>.
|
||||
/// The factory method for <see cref="ID2D1Factory1.RegisterEffectFromString"/>.
|
||||
/// </summary>
|
||||
/// <param name="shaderId">The <see cref="Guid"/> for the shader.</param>
|
||||
/// <param name="bytecode">The shader bytecode.</param>
|
||||
@@ -213,7 +213,7 @@ internal unsafe partial struct PixelShaderEffect
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="D2D1_PROPERTY_BINDING.getFunction"/>
|
||||
[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
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="D2D1_PROPERTY_BINDING.getFunction"/>
|
||||
[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;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ID2D1EffectImpl.QueryInterface"/>
|
||||
/// <inheritdoc cref="IUnknown.QueryInterface"/>
|
||||
private int QueryInterface(Guid* riid, void** ppvObject)
|
||||
{
|
||||
if (ppvObject is null)
|
||||
@@ -291,13 +291,13 @@ internal unsafe partial struct PixelShaderEffect
|
||||
return E.E_NOINTERFACE;
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ID2D1EffectImpl.AddRef"/>
|
||||
/// <inheritdoc cref="IUnknown.AddRef"/>
|
||||
private uint AddRef()
|
||||
{
|
||||
return (uint)Interlocked.Increment(ref this.referenceCount);
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="ID2D1EffectImpl.Release"/>
|
||||
/// <inheritdoc cref="IUnknown.Release"/>
|
||||
private uint Release()
|
||||
{
|
||||
uint referenceCount = (uint)Interlocked.Decrement(ref this.referenceCount);
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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]<ID2D1DeviceContext*, Guid*, ID2D1Effect**, int>)(lpVtbl[63]))((ID2D1DeviceContext*)Unsafe.AsPointer(ref this), effectId, effect);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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]<ID2D1Effect*, uint, D2D1_PROPERTY_TYPE, byte*, uint, int>)(lpVtbl[9]))((ID2D1Effect*)Unsafe.AsPointer(ref this), index, type, data, dataSize);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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]<IUnknown**, HRESULT> effectFactory)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ID2D1Factory1*, Guid*, ushort*, D2D1_PROPERTY_BINDING*, uint, delegate* unmanaged[Stdcall]<IUnknown**, HRESULT>, int>)(lpVtbl[23]))((ID2D1Factory1*)Unsafe.AsPointer(ref this), classId, propertyXml, bindings, bindingsCount, effectFactory);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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,
|
||||
}
|
||||
}
|
||||
+17
@@ -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,
|
||||
}
|
||||
}
|
||||
+23
@@ -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]<IUnknown*, byte*, uint, HRESULT> setFunction;
|
||||
|
||||
[NativeTypeName("PD2D1_PROPERTY_GET_FUNCTION")]
|
||||
public delegate* unmanaged[Stdcall]<IUnknown*, byte*, uint, uint*, HRESULT> getFunction;
|
||||
}
|
||||
}
|
||||
@@ -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]<ID2D1DrawInfo*, byte*, uint, int>)(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]<ID2D1DrawInfo*, Guid*, D2D1_PIXEL_OPTIONS, int>)(lpVtbl[10]))((ID2D1DrawInfo*)Unsafe.AsPointer(ref this), shaderId, pixelOptions);
|
||||
}
|
||||
}
|
||||
}
|
||||
+81
@@ -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]<ID2D1DrawTransform*, Guid*, void**, int>)(lpVtbl[0]))((ID2D1DrawTransform*)Unsafe.AsPointer(ref this), riid, ppvObject);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(1)]
|
||||
[return: NativeTypeName("ULONG")]
|
||||
public uint AddRef()
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ID2D1DrawTransform*, uint>)(lpVtbl[1]))((ID2D1DrawTransform*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(2)]
|
||||
[return: NativeTypeName("ULONG")]
|
||||
public uint Release()
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ID2D1DrawTransform*, uint>)(lpVtbl[2]))((ID2D1DrawTransform*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(3)]
|
||||
[return: NativeTypeName("UINT32")]
|
||||
public uint GetInputCount()
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ID2D1DrawTransform*, uint>)(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]<ID2D1DrawTransform*, RECT*, RECT*, uint, int>)(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]<ID2D1DrawTransform*, RECT*, RECT*, uint, RECT*, RECT*, int>)(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]<ID2D1DrawTransform*, uint, RECT, RECT*, int>)(lpVtbl[6]))((ID2D1DrawTransform*)Unsafe.AsPointer(ref this), inputIndex, invalidInputRect, invalidOutputRect);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(7)]
|
||||
public HRESULT SetDrawInfo(ID2D1DrawInfo* drawInfo)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ID2D1DrawTransform*, ID2D1DrawInfo*, int>)(lpVtbl[7]))((ID2D1DrawTransform*)Unsafe.AsPointer(ref this), drawInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
+43
@@ -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]<ID2D1EffectContext*, Guid*, void**, int>)(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]<ID2D1EffectContext*, Guid*, byte*, uint, int>)(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]<ID2D1EffectContext*, Guid*, int>)(lpVtbl[14]))((ID2D1EffectContext*)Unsafe.AsPointer(ref this), shaderId);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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]<ID2D1EffectImpl*, Guid*, void**, int>)(lpVtbl[0]))((ID2D1EffectImpl*)Unsafe.AsPointer(ref this), riid, ppvObject);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(1)]
|
||||
[return: NativeTypeName("ULONG")]
|
||||
public uint AddRef()
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ID2D1EffectImpl*, uint>)(lpVtbl[1]))((ID2D1EffectImpl*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(2)]
|
||||
[return: NativeTypeName("ULONG")]
|
||||
public uint Release()
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ID2D1EffectImpl*, uint>)(lpVtbl[2]))((ID2D1EffectImpl*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(3)]
|
||||
public HRESULT Initialize(ID2D1EffectContext* effectContext, ID2D1TransformGraph* transformGraph)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ID2D1EffectImpl*, ID2D1EffectContext*, ID2D1TransformGraph*, int>)(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]<ID2D1EffectImpl*, D2D1_CHANGE_TYPE, int>)(lpVtbl[4]))((ID2D1EffectImpl*)Unsafe.AsPointer(ref this), changeType);
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
[VtblIndex(5)]
|
||||
public HRESULT SetGraph(ID2D1TransformGraph* transformGraph)
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ID2D1EffectImpl*, ID2D1TransformGraph*, int>)(lpVtbl[5]))((ID2D1EffectImpl*)Unsafe.AsPointer(ref this), transformGraph);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
+29
@@ -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]<ID2D1TransformGraph*, ID2D1TransformNode*, int>)(lpVtbl[4]))((ID2D1TransformGraph*)Unsafe.AsPointer(ref this), node);
|
||||
}
|
||||
}
|
||||
}
|
||||
+20
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,19 @@
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\DirectX\um\d3d11shader\D3D.cs" Link="DirectX\um\d3d11shader\D3D.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1effectauthor\D2D1_CHANGE_TYPE.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1effectauthor\D2D1_PIXEL_OPTIONS.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1effectauthor\D2D1_PROPERTY_BINDING.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1effectauthor\ID2D1DrawTransform.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1effectauthor\ID2D1EffectContext.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1effectauthor\ID2D1EffectImpl.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1effectauthor\ID2D1Transform.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1effectauthor\ID2D1TransformGraph.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1effectauthor\ID2D1TransformNode.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1_1\D2D1_PROPERTY_TYPE.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1_1\ID2D1DeviceContext.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1_1\ID2D1Effect.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d2d1_1\ID2D1Factory1.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d3dcommon\D3D_INCLUDE_TYPE.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d3dcommon\D3D_SHADER_MACRO.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)DirectX\um\d3d11shadeer\D3D11_SHADER_DESC.cs" />
|
||||
@@ -33,5 +46,8 @@
|
||||
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\Windows\other\helper-types\NativeTypeNameAttribute.cs" Link="Windows\other\helper-types\NativeTypeNameAttribute.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\Windows\shared\winerror\S.cs" Link="Windows\shared\winerror\S.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)..\TerraFX.Interop.Windows\Windows\other\helper-types\VtblIndexAttribute.cs" Link="Windows\other\helper-types\VtblIndexAttribute.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Windows\shared\windef\RECT.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Windows\shared\winerror\E.cs" />
|
||||
<Compile Include="$(MSBuildThisFileDirectory)Windows\shared\winerror\Windows.cs" />
|
||||
</ItemGroup>
|
||||
</Project>
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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));
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -112,15 +112,15 @@ internal static class D2D1ShaderTestHelper
|
||||
wicBitmapSource: (IWICBitmapSource*)wicBitmap.Get(),
|
||||
bitmap: d2D1BitmapSource.GetAddressOf()).Assert();
|
||||
|
||||
D2D1InteropServices2.RegisterPixelShaderEffectForD2D1Factory1<T>(d2D1Factory2.Get(), out _);
|
||||
D2D1InteropServices.RegisterPixelShaderEffectForD2D1Factory1<T>(d2D1Factory2.Get(), out _);
|
||||
|
||||
using ComPtr<ID2D1Effect> d2D1Effect = default;
|
||||
|
||||
D2D1InteropServices2.CreatePixelShaderEffectFromD2D1DeviceContext<T>(
|
||||
D2D1InteropServices.CreatePixelShaderEffectFromD2D1DeviceContext<T>(
|
||||
d2D1DeviceContext.Get(),
|
||||
(void**)d2D1Effect.GetAddressOf());
|
||||
|
||||
D2D1InteropServices2.SetConstantBufferForD2D1Effect(in shader, d2D1Effect.Get());
|
||||
D2D1InteropServices.SetConstantBufferForD2D1Effect(in shader, d2D1Effect.Get());
|
||||
|
||||
d2D1Effect.Get()->SetInput(0, (ID2D1Image*)d2D1BitmapSource.Get());
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする