Added check to avoid disposing of default device
このコミットが含まれているのは:
1 親
aa55ac5043
コミット
c2a1980596
3ファイル変更
+18
-1
検索条件に一致するファイルはありません
@@ -203,6 +203,8 @@ namespace ComputeSharp.Graphics
|
||||
/// <inheritdoc/>
|
||||
protected override void OnDispose()
|
||||
{
|
||||
if (DeviceHelper.GetDefaultDeviceLuid() == Luid) return;
|
||||
|
||||
DeviceHelper.NotifyDisposedDevice(this);
|
||||
|
||||
this.d3D12Device.Dispose();
|
||||
|
||||
@@ -13,7 +13,7 @@ namespace ComputeSharp.Graphics
|
||||
/// <param name="description">The available info for the associate device.</param>
|
||||
internal unsafe GraphicsDeviceInfo(DXGI_ADAPTER_DESC1* dxgiDescription1)
|
||||
{
|
||||
Luid = *(Luid*)&dxgiDescription1->AdapterLuid;
|
||||
Luid = Luid.FromLUID(dxgiDescription1->AdapterLuid);
|
||||
Name = new string((char*)dxgiDescription1->Description);
|
||||
MemorySize = dxgiDescription1->DedicatedVideoMemory;
|
||||
}
|
||||
|
||||
@@ -26,6 +26,21 @@ namespace ComputeSharp.Graphics.Helpers
|
||||
return TryGetDefaultDevice(null, &dxgiDescription1);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="Luid"/> of the default device.
|
||||
/// </summary>
|
||||
/// <returns>The <see cref="Luid"/> of the default device supporting at least DX12.0.</returns>
|
||||
/// <remarks>This methods assumes that a default device is available.</remarks>
|
||||
[Pure]
|
||||
public static unsafe Luid GetDefaultDeviceLuid()
|
||||
{
|
||||
DXGI_ADAPTER_DESC1 dxgiDescription1;
|
||||
|
||||
_ = TryGetDefaultDevice(null, &dxgiDescription1);
|
||||
|
||||
return Luid.FromLUID(dxgiDescription1.AdapterLuid);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the default <see cref="GraphicsDevice"/> instance.
|
||||
/// </summary>
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする