Minor code refactoring

このコミットが含まれているのは:
Sergio Pedri committed 2020-11-14 23:07:07 +01:00
1 親 fdf9c07e37
コミット 9b0118bc5b
2ファイル変更
+27 -13

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

+3 -13
ファイルの表示
@@ -1,4 +1,5 @@
using System;
using ComputeSharp.Graphics.Extensions;
using System;
using System.Collections.Generic;
using System.Diagnostics.Contracts;
using System.Runtime.InteropServices;
@@ -69,18 +70,7 @@ namespace ComputeSharp.Graphics.Commands
}
}
// Create a new command allocator
ID3D12CommandAllocator* d3D12CommandAllocator;
Guid d3D12CommandAllocatorGuid = FX.IID_ID3D12CommandAllocator;
int result = d3D12Device->CreateCommandAllocator(
this.d3d12CommandListType,
&d3D12CommandAllocatorGuid,
(void**)&d3D12CommandAllocator);
if (FX.FAILED(result)) Marshal.ThrowExceptionForHR(result);
return d3D12CommandAllocator;
return d3D12Device->CreateCommandAllocator(this.d3d12CommandListType);
}
}
+24
ファイルの表示
@@ -132,6 +132,30 @@ namespace ComputeSharp.Graphics.Extensions
return d3D12Resource;
}
/// <summary>
/// Creates a new <see cref="ID3D12CommandAllocator"/> for a given device.
/// </summary>
/// <param name="d3d12device">The target <see cref="ID3D12Device"/> to use to create the command allocator.</param>
/// <param name="d3d12CommandListType">The type of command list to create.</param>
/// <returns>A pointer to the newly allocated <see cref="ID3D12CommandAllocator"/> instance.</returns>
/// <exception cref="Exception">Thrown when the creation of the command allocator fails.</exception>
public static ID3D12CommandAllocator* CreateCommandAllocator(
this ref ID3D12Device d3d12device,
D3D12_COMMAND_LIST_TYPE d3d12CommandListType)
{
ID3D12CommandAllocator* d3D12CommandAllocator;
Guid d3D12CommandAllocatorGuid = FX.IID_ID3D12CommandAllocator;
int result = d3d12device.CreateCommandAllocator(
d3d12CommandListType,
&d3D12CommandAllocatorGuid,
(void**)&d3D12CommandAllocator);
if (FX.FAILED(result)) Marshal.ThrowExceptionForHR(result);
return d3D12CommandAllocator;
}
/// <summary>
/// Checks the feature support of a given type for a given device.
/// </summary>