Add WASDK test project

このコミットが含まれているのは:
Sergio Pedri committed 2023-04-27 03:36:50 +02:00
1 親 50c60ec544
コミット b8aab80dbd
8ファイル変更
+115 -3

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

+13
ファイルの表示
@@ -154,6 +154,8 @@ Project("{D954291E-2A0B-460D-934E-DC6B0785DB48}") = "ComputeSharp.D2D1.UI.Tests"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "ComputeSharp.D2D1.Uwp.Tests", "tests\ComputeSharp.D2D1.Uwp.Tests\ComputeSharp.D2D1.Uwp.Tests.csproj", "{4D4BB2F6-5653-4DB5-A8DD-90D58D8FE4D3}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "ComputeSharp.D2D1.WinUI.Tests", "tests\ComputeSharp.D2D1.WinUI.Tests\ComputeSharp.D2D1.WinUI.Tests.csproj", "{4D5019D5-3D1F-48C0-B134-7F01F93A3573}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
@@ -430,6 +432,14 @@ Global
{4D4BB2F6-5653-4DB5-A8DD-90D58D8FE4D3}.Release|x64.ActiveCfg = Release|x64
{4D4BB2F6-5653-4DB5-A8DD-90D58D8FE4D3}.Release|x64.Build.0 = Release|x64
{4D4BB2F6-5653-4DB5-A8DD-90D58D8FE4D3}.Release|x64.Deploy.0 = Release|x64
{4D5019D5-3D1F-48C0-B134-7F01F93A3573}.Debug|ARM64.ActiveCfg = Debug|ARM64
{4D5019D5-3D1F-48C0-B134-7F01F93A3573}.Debug|ARM64.Build.0 = Debug|ARM64
{4D5019D5-3D1F-48C0-B134-7F01F93A3573}.Debug|x64.ActiveCfg = Debug|x64
{4D5019D5-3D1F-48C0-B134-7F01F93A3573}.Debug|x64.Build.0 = Debug|x64
{4D5019D5-3D1F-48C0-B134-7F01F93A3573}.Release|ARM64.ActiveCfg = Release|ARM64
{4D5019D5-3D1F-48C0-B134-7F01F93A3573}.Release|ARM64.Build.0 = Release|ARM64
{4D5019D5-3D1F-48C0-B134-7F01F93A3573}.Release|x64.ActiveCfg = Release|x64
{4D5019D5-3D1F-48C0-B134-7F01F93A3573}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -469,6 +479,7 @@ Global
{9EA5AE9D-C39A-4F43-B03E-0A848EA2558A} = {0ED8F632-5E17-46BE-8CC3-B14A82D4AEB1}
{346AEB10-A4EA-427E-8578-F60915DB3053} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
{4D4BB2F6-5653-4DB5-A8DD-90D58D8FE4D3} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
{4D5019D5-3D1F-48C0-B134-7F01F93A3573} = {F8EFBB27-4EE2-4463-A75B-7EFDFB55D0F7}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {4664C5E3-0340-4E22-BCFD-98AAEDF5F2DC}
@@ -487,6 +498,8 @@ Global
src\ComputeSharp.NetStandard\ComputeSharp.NetStandard.projitems*{4d4bb2f6-5653-4db5-a8dd-90d58d8fe4d3}*SharedItemsImports = 4
src\TerraFX.Interop.Windows.D2D1\TerraFX.Interop.Windows.D2D1.projitems*{4d4bb2f6-5653-4db5-a8dd-90d58d8fe4d3}*SharedItemsImports = 4
tests\ComputeSharp.D2D1.UI.Tests\ComputeSharp.D2D1.UI.Tests.projitems*{4d4bb2f6-5653-4db5-a8dd-90d58d8fe4d3}*SharedItemsImports = 4
samples\ComputeSharp.SwapChain.Shaders.D2D1.Shared\ComputeSharp.SwapChain.Shaders.D2D1.Shared.projitems*{4d5019d5-3d1f-48c0-b134-7f01f93a3573}*SharedItemsImports = 5
tests\ComputeSharp.D2D1.UI.Tests\ComputeSharp.D2D1.UI.Tests.projitems*{4d5019d5-3d1f-48c0-b134-7f01f93a3573}*SharedItemsImports = 5
src\TerraFX.Interop.Windows.D2D1\TerraFX.Interop.Windows.D2D1.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
+4
ファイルの表示
@@ -1,4 +1,8 @@
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp;
#else
using ComputeSharp.D2D1.WinUI;
#endif
using Microsoft.Graphics.Canvas;
using Microsoft.VisualStudio.TestTools.UnitTesting;
+53 -2
ファイルの表示
@@ -1,9 +1,15 @@
using System;
using System.Runtime.InteropServices;
#if WINDOWS_UWP
using System.Runtime.InteropServices.WindowsRuntime;
#endif
using Microsoft.Graphics.Canvas;
using TerraFX.Interop.DirectX;
using TerraFX.Interop.Windows;
#if !WINDOWS_UWP
using WinRT;
using WinRT.Interop;
#endif
#nullable enable
@@ -22,11 +28,17 @@ internal static class Win2DHelper
/// <returns>The resulting managed wrapper for <paramref name="d2D1Image"/>.</returns>
public static unsafe object GetOrCreate(ID2D1Image* d2D1Image, CanvasDevice? canvasDevice = null)
{
IActivationFactory activationFactory = WindowsRuntimeMarshal.GetActivationFactory(typeof(CanvasDevice));
using ComPtr<IUnknown> activationFactoryUnknown = default;
#if WINDOWS_UWP
IActivationFactory activationFactory = WindowsRuntimeMarshal.GetActivationFactory(typeof(CanvasDevice));
activationFactoryUnknown.Attach((IUnknown*)Marshal.GetIUnknownForObject(activationFactory));
#else
ICanvasFactoryNative activationFactory = CanvasDevice.As<ICanvasFactoryNative>();
activationFactoryUnknown.Attach((IUnknown*)MarshalInterface<ICanvasFactoryNative>.FromManaged(activationFactory));
#endif
using ComPtr<IUnknown> canvasFactoryNativeUnknown = default;
@@ -41,7 +53,11 @@ internal static class Win2DHelper
if (canvasDevice is not null)
{
#if WINDOWS_UWP
canvasDeviceUnknown.Attach((IUnknown*)Marshal.GetIUnknownForObject(canvasDevice));
#else
canvasDeviceUnknown.Attach((IUnknown*)MarshalInspectable<CanvasDevice>.FromManaged(canvasDevice));
#endif
}
using ComPtr<IUnknown> canvasDeviceInterfaceUnknown = default;
@@ -67,7 +83,11 @@ internal static class Win2DHelper
Marshal.ThrowExceptionForHR(hresult);
// Get or create a managed object for the native object
#if WINDOWS_UWP
return Marshal.GetObjectForIUnknown((IntPtr)wrapperUnknown.Get());
#else
return MarshalInspectable<object>.FromAbi((IntPtr)wrapperUnknown.Get());
#endif
}
/// <summary>
@@ -80,7 +100,11 @@ internal static class Win2DHelper
{
using ComPtr<IUnknown> effectUnknown = default;
#if WINDOWS_UWP
effectUnknown.Attach((IUnknown*)Marshal.GetIUnknownForObject(canvasImage));
#else
effectUnknown.Attach((IUnknown*)MarshalInterface<ICanvasImage>.FromManaged(canvasImage));
#endif
using ComPtr<IUnknown> canvasImageInteropUnknown = default;
@@ -93,7 +117,11 @@ internal static class Win2DHelper
using ComPtr<IUnknown> canvasDeviceUnknown = default;
#if WINDOWS_UWP
canvasDeviceUnknown.Attach((IUnknown*)Marshal.GetIUnknownForObject(canvasDevice));
#else
canvasDeviceUnknown.Attach((IUnknown*)MarshalInspectable<CanvasDevice>.FromManaged(canvasDevice));
#endif
using ComPtr<IUnknown> canvasDeviceInterfaceUnknown = default;
@@ -116,4 +144,27 @@ internal static class Win2DHelper
Marshal.ThrowExceptionForHR(hresult);
}
#if !WINDOWS_UWP
/// <summary>
/// The managed interface for <see cref="ICanvasFactoryNative"/>.
/// </summary>
[Guid("695C440D-04B3-4EDD-BFD9-63E51E9F7202")]
[WindowsRuntimeType]
[WindowsRuntimeHelperType(typeof(ICanvasFactoryNative))]
public interface ICanvasFactoryNative
{
/// <summary>
/// The vtable type for <see cref="Interface"/>.
/// </summary>
[Guid("695C440D-04B3-4EDD-BFD9-63E51E9F7202")]
public readonly struct Vftbl
{
/// <summary>
/// Allows CsWinRT to retrieve a pointer to the projection vtable (the name is hardcoded by convention).
/// </summary>
public static readonly IntPtr AbiToProjectionVftablePtr = IUnknownVftbl.AbiToProjectionVftblPtr;
}
}
#endif
}
+4
ファイルの表示
@@ -3,7 +3,11 @@ using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using ComputeSharp.D2D1.Interop;
using ComputeSharp.D2D1.UI.Tests.Helpers;
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp;
#else
using ComputeSharp.D2D1.WinUI;
#endif
using Microsoft.Graphics.Canvas;
using Microsoft.VisualStudio.TestTools.UnitTesting;
using TerraFX.Interop.DirectX;
+13 -1
ファイルの表示
@@ -1,8 +1,13 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using System.Threading.Tasks;
using ComputeSharp.D2D1.UI.Tests.Helpers;
#if WINDOWS_UWP
using ComputeSharp.D2D1.Uwp;
#else
using ComputeSharp.D2D1.WinUI;
#endif
using ComputeSharp.SwapChain.Shaders.D2D1;
using Microsoft.Graphics.Canvas;
using Microsoft.VisualStudio.TestTools.UnitTesting;
@@ -73,7 +78,7 @@ public class ShadersTests
await RunTestAsync<TerracedHills>(wrapperType, 0.000026f);
}
private static async Task RunTestAsync<T>(WrapperType wrapperType, float threshold = 0.00001f)
private static async Task RunTestAsync<[DynamicallyAccessedMembers(DynamicallyAccessedMemberTypes.PublicConstructors)] T>(WrapperType wrapperType, float threshold = 0.00001f)
where T : unmanaged, ID2D1PixelShader
{
T shader = (T)Activator.CreateInstance(typeof(T), 0f, new int2(1280, 720))!;
@@ -134,6 +139,13 @@ public class ShadersTests
{
this.effect!.ConstantBuffer = this.constantBuffer;
}
protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
this.effect?.Dispose();
}
}
public enum WrapperType
+1
ファイルの表示
@@ -18,6 +18,7 @@
<ProjectTypeGuids>{A5A43C5B-DE2A-4C0C-9213-0A381AF9435A};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<UnitTestPlatformVersion Condition="'$(UnitTestPlatformVersion)' == ''">$(VisualStudioVersion)</UnitTestPlatformVersion>
<AppxPackageSigningEnabled>false</AppxPackageSigningEnabled>
<PolySharpIncludeRuntimeSupportedAttributes>true</PolySharpIncludeRuntimeSupportedAttributes>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM64'">
<DebugSymbols>true</DebugSymbols>
+24
ファイルの表示
@@ -0,0 +1,24 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFramework>net6.0-windows10.0.22621</TargetFramework>
<Platforms>x64;ARM64</Platforms>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.1.0" />
<PackageReference Include="MSTest.TestAdapter" Version="2.2.8" />
<PackageReference Include="MSTest.TestFramework" Version="2.2.8" />
<PackageReference Include="TerraFX.Interop.Windows" Version="10.0.22621.1" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\ComputeSharp.Core.SourceGenerators\ComputeSharp.Core.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
<ProjectReference Include="..\..\src\ComputeSharp.Core\ComputeSharp.Core.csproj" />
<ProjectReference Include="..\..\src\ComputeSharp.D2D1.SourceGenerators\ComputeSharp.D2D1.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
<ProjectReference Include="..\..\src\ComputeSharp.D2D1.WinUI\ComputeSharp.D2D1.WinUI.csproj" />
<ProjectReference Include="..\..\src\ComputeSharp.D2D1\ComputeSharp.D2D1.csproj" />
</ItemGroup>
<Import Project="..\ComputeSharp.D2D1.UI.Tests\ComputeSharp.D2D1.UI.Tests.projitems" Label="Shared" />
<Import Project="..\..\samples\ComputeSharp.SwapChain.Shaders.D2D1.Shared\ComputeSharp.SwapChain.Shaders.D2D1.Shared.projitems" Label="Shared" />
</Project>
+3
ファイルの表示
@@ -17,5 +17,8 @@
<!-- Ignore warnings for usings outside of a namespace (needed for some Vortice.Win32 type aliases) -->
<NoWarn>$(NoWarn);IDE0065</NoWarn>
<!-- Unnecessary #nullable enable directives (for shared projects across UWP) -->
<NoWarn>$(NoWarn);IDE0240</NoWarn>
</PropertyGroup>
</Project>