Move GPU disposal tests to DeviceLost test project

このコミットが含まれているのは:
Sergio Pedri committed 2022-07-31 23:26:13 +02:00
1 親 2623754991
コミット 37823f366c
9ファイル変更
+47 -167

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

+4
ファイルの表示
@@ -86,6 +86,10 @@ public partial class DeviceDisposalTests
using var r3 = graphicsDevice.AllocateReadWriteBuffer<float>(128);
using var r4 = graphicsDevice.AllocateReadOnlyTexture2D<float>(128, 128);
using var r5 = graphicsDevice.AllocateReadWriteTexture2D<float>(128, 128);
using var r6 = graphicsDevice.AllocateUploadBuffer<float>(128);
using var r7 = graphicsDevice.AllocateReadBackBuffer<float>(128);
using var r8 = graphicsDevice.AllocateUploadTexture2D<float>(128, 128);
using var r9 = graphicsDevice.AllocateReadBackTexture2D<float>(128, 128);
InteropServices.GetID3D12Device(graphicsDevice, Windows.__uuidof<ID3D12Device>(), (void**)d3D12Device.GetAddressOf());
}
+43
ファイルの表示
@@ -73,4 +73,47 @@ public class GetDefaultDeviceTests
GetDefault_VerifyContract_Part2();
}
[TestMethod]
public unsafe void GetDefault_DisposeAndUseNewInstance()
{
using (ComPtr<ID3D12Device> d3D12Device = default)
{
GraphicsDevice device = GraphicsDevice.GetDefault();
using (device.AllocateReadOnlyBuffer<float>(128))
{
}
InteropServices.GetID3D12Device(device, Windows.__uuidof<ID3D12Device>(), (void**)d3D12Device.GetAddressOf());
device.Dispose();
_ = d3D12Device.Get()->AddRef();
uint refCount = d3D12Device.Get()->Release();
Assert.AreEqual(refCount, 1u);
}
// Just same test but twice, just for good measure
using (ComPtr<ID3D12Device> d3D12Device = default)
{
GraphicsDevice device = GraphicsDevice.GetDefault();
using (device.AllocateReadOnlyBuffer<float>(128))
{
}
InteropServices.GetID3D12Device(device, Windows.__uuidof<ID3D12Device>(), (void**)d3D12Device.GetAddressOf());
device.Dispose();
_ = d3D12Device.Get()->AddRef();
uint refCount = d3D12Device.Get()->Release();
Assert.AreEqual(refCount, 1u);
}
}
}