Switch ComputeSharp.Tests.DeviceLost to Vortice.Win32
このコミットが含まれているのは:
1 親
d1f5031a97
コミット
cd07b46f6a
6ファイル変更
+26
-53
検索条件に一致するファイルはありません
@@ -11,6 +11,8 @@
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.4.1" />
|
||||
<PackageReference Include="MSTest.TestAdapter" Version="3.0.2" />
|
||||
<PackageReference Include="MSTest.TestFramework" Version="3.0.2" />
|
||||
<PackageReference Include="Vortice.Win32.Graphics.Direct3D12" Version="1.9.13" />
|
||||
<PackageReference Include="Vortice.Win32.Graphics.Dxgi" Version="1.9.13" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
@@ -19,16 +21,6 @@
|
||||
<ProjectReference Include="..\..\src\ComputeSharp\ComputeSharp.csproj" />
|
||||
<ProjectReference Include="..\..\src\ComputeSharp.SourceGenerators\ComputeSharp.SourceGenerators.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" PrivateAssets="contentfiles;build" />
|
||||
</ItemGroup>
|
||||
|
||||
<!-- When the .NET Standard 2.0 version of ComputeSharp is resolved, the TerraFX APIs are internal, as they
|
||||
are referenced from the shared project. The same reference is needed here to make all tests build fine. -->
|
||||
<Import Condition="'$(TargetFramework)' != 'net6.0' AND '$(TargetFramework)' != 'net7.0'" Project="..\..\src\TerraFX.Interop.Windows\TerraFX.Interop.Windows.projitems" />
|
||||
<Import Condition="'$(TargetFramework)' != 'net6.0' AND '$(TargetFramework)' != 'net7.0'" Project="..\..\src\ComputeSharp.NetStandard\ComputeSharp.NetStandard.projitems" />
|
||||
|
||||
<!-- Only when the local TerraFX is referenced, ignore warnings from there -->
|
||||
<PropertyGroup Condition="'$(TargetFramework)' != 'net6.0' AND '$(TargetFramework)' != 'net7.0'">
|
||||
<NoWarn>$(NoWarn);CS0649</NoWarn>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<Compile Include="..\..\src\ComputeSharp.Core\Properties\Polyfills\UnscopedRefAttribute.cs" Link="Properties\Polyfills\UnscopedRefAttribute.cs" />
|
||||
|
||||
@@ -4,11 +4,15 @@ using ComputeSharp.Tests.Attributes;
|
||||
using ComputeSharp.Tests.DeviceLost.Helpers;
|
||||
using ComputeSharp.Tests.Extensions;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using TerraFX.Interop.DirectX;
|
||||
using TerraFX.Interop.Windows;
|
||||
using Win32;
|
||||
using Win32.Graphics.Direct3D12;
|
||||
|
||||
#pragma warning disable IDE0065
|
||||
|
||||
namespace ComputeSharp.Tests.DeviceLost;
|
||||
|
||||
using Win32 = Win32.Apis;
|
||||
|
||||
[TestClass]
|
||||
[TestCategory("DeviceDisposal")]
|
||||
public partial class DeviceDisposalTests
|
||||
@@ -51,7 +55,7 @@ public partial class DeviceDisposalTests
|
||||
|
||||
graphicsDevice.Dispose();
|
||||
|
||||
InteropServices.GetID3D12Device(graphicsDevice, Windows.__uuidof<ID3D12Device>(), (void**)d3D12Device.GetAddressOf());
|
||||
InteropServices.GetID3D12Device(graphicsDevice, Win32.__uuidof<ID3D12Device>(), (void**)d3D12Device.GetAddressOf());
|
||||
}
|
||||
|
||||
[CombinatorialTestMethod]
|
||||
|
||||
@@ -5,8 +5,8 @@ using ComputeSharp.Tests.Attributes;
|
||||
using ComputeSharp.Tests.DeviceLost.Helpers;
|
||||
using ComputeSharp.Tests.Extensions;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using TerraFX.Interop.DirectX;
|
||||
using TerraFX.Interop.Windows;
|
||||
using Win32;
|
||||
using Win32.Graphics.Direct3D12;
|
||||
|
||||
namespace ComputeSharp.Tests.DeviceLost;
|
||||
|
||||
|
||||
@@ -2,11 +2,16 @@ using System;
|
||||
using System.Threading.Tasks;
|
||||
using ComputeSharp.Tests.DeviceLost.Helpers;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using TerraFX.Interop.DirectX;
|
||||
using TerraFX.Interop.Windows;
|
||||
using Win32;
|
||||
using Win32.Graphics.Direct3D12;
|
||||
|
||||
#pragma warning disable IDE0065
|
||||
|
||||
namespace ComputeSharp.Tests.DeviceLost;
|
||||
|
||||
using DXGI = Win32.Graphics.Dxgi.Apis;
|
||||
using HRESULT = Win32.HResult;
|
||||
|
||||
[TestClass]
|
||||
[TestCategory("GetDefaultDevice")]
|
||||
public class GetDefaultDeviceTests
|
||||
@@ -75,7 +80,7 @@ public class GetDefaultDeviceTests
|
||||
HRESULT removalReason = d3D12Device.Get()->GetDeviceRemovedReason();
|
||||
|
||||
// Sanity check that the device is in fact removed
|
||||
Assert.AreEqual(DXGI.DXGI_ERROR_DEVICE_REMOVED, (int)removalReason);
|
||||
Assert.AreEqual(DXGI.DXGI_ERROR_DEVICE_REMOVED, removalReason);
|
||||
}
|
||||
|
||||
// Calling GraphicsDevice.GetDefault() will now throw, because the native device has not been disposed properly
|
||||
|
||||
@@ -2,11 +2,15 @@ using System;
|
||||
using System.Threading.Tasks;
|
||||
using ComputeSharp.Interop;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using TerraFX.Interop.DirectX;
|
||||
using TerraFX.Interop.Windows;
|
||||
using Win32;
|
||||
using Win32.Graphics.Direct3D12;
|
||||
|
||||
#pragma warning disable IDE0065
|
||||
|
||||
namespace ComputeSharp.Tests.DeviceLost.Helpers;
|
||||
|
||||
using Win32 = Win32.Apis;
|
||||
|
||||
/// <summary>
|
||||
/// A helper to do common checks on native device objects.
|
||||
/// </summary>
|
||||
@@ -21,7 +25,7 @@ internal static class GraphicsDeviceHelper
|
||||
{
|
||||
fixed (ID3D12Device** ppvObject = d3D12Device)
|
||||
{
|
||||
InteropServices.GetID3D12Device(graphicsDevice, Windows.__uuidof<ID3D12Device>(), (void**)ppvObject);
|
||||
InteropServices.GetID3D12Device(graphicsDevice, Win32.__uuidof<ID3D12Device>(), (void**)ppvObject);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1,32 +0,0 @@
|
||||
// Copyright © Tanner Gooding and Contributors. Licensed under the MIT License (MIT). See License.md in the repository root for more information.
|
||||
|
||||
// Ported from um/d3d12.h in the Windows SDK for Windows 10.0.20348.0
|
||||
// Original source is Copyright © Microsoft. All rights reserved.
|
||||
|
||||
#if !NET6_0_OR_GREATER
|
||||
|
||||
using System;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
namespace TerraFX.Interop.DirectX;
|
||||
|
||||
[Guid("8B4F173B-2FEA-4B80-8F58-4307191AB95D")]
|
||||
public unsafe partial struct ID3D12Device5
|
||||
{
|
||||
public void** lpVtbl;
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public uint Release()
|
||||
{
|
||||
return ((delegate* unmanaged[Stdcall]<ID3D12Device5*, uint>)this.lpVtbl[2])((ID3D12Device5*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void RemoveDevice()
|
||||
{
|
||||
((delegate* unmanaged[Stdcall]<ID3D12Device5*, void>)this.lpVtbl[58])((ID3D12Device5*)Unsafe.AsPointer(ref this));
|
||||
}
|
||||
}
|
||||
|
||||
#endif
|
||||
新しいイシューから参照
ユーザーをブロックする