Reduced thread contention with parallel dispatches
このコミットが含まれているのは:
1 親
a51af3351e
コミット
d935bc1a09
3ファイル変更
+20
-6
検索条件に一致するファイルはありません
@@ -45,15 +45,26 @@ namespace ComputeSharp.Graphics.Commands.Interop
|
||||
{
|
||||
if (this.d3D12CommandListBundleQueue.TryDequeue(out D3D12CommandListBundle d3D12CommandListBundle))
|
||||
{
|
||||
d3D12CommandListBundle.D3D12CommandAllocator->Reset().Assert();
|
||||
d3D12CommandListBundle.D3D12CommandList->Reset(d3D12CommandListBundle.D3D12CommandAllocator, d3D12PipelineState).Assert();
|
||||
|
||||
d3D12CommandList = d3D12CommandListBundle.D3D12CommandList;
|
||||
d3D12CommandAllocator = d3D12CommandListBundle.D3D12CommandAllocator;
|
||||
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
d3D12CommandAllocator = null;
|
||||
d3D12CommandList = null;
|
||||
}
|
||||
}
|
||||
|
||||
// Reset the command allocator and command list outside of the lock, or create a new pair if one to be reused
|
||||
// wasn't available. These operations are relatively expensive, so doing so here reduces thread contention
|
||||
// when multiple shader executions are being dispatched in parallel on the same device.
|
||||
if (d3D12CommandAllocator is not null)
|
||||
{
|
||||
d3D12CommandAllocator->Reset().Assert();
|
||||
d3D12CommandList->Reset(d3D12CommandAllocator, d3D12PipelineState).Assert();
|
||||
}
|
||||
else
|
||||
{
|
||||
CreateCommandListAndAllocator(d3D12Device, d3D12PipelineState, out d3D12CommandList, out d3D12CommandAllocator);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,7 +1,9 @@
|
||||
using System.ComponentModel;
|
||||
using System.Diagnostics;
|
||||
using System.Runtime.CompilerServices;
|
||||
#if DEBUG
|
||||
using ComputeSharp.Graphics.Helpers;
|
||||
#endif
|
||||
using Microsoft.Toolkit.Diagnostics;
|
||||
using HRESULT = System.Int32;
|
||||
|
||||
|
||||
@@ -5,6 +5,7 @@ using System.Runtime.InteropServices;
|
||||
using ComputeSharp.Core.Extensions;
|
||||
using TerraFX.Interop;
|
||||
using FX = TerraFX.Interop.Windows;
|
||||
using HRESULT = System.Int32;
|
||||
|
||||
namespace ComputeSharp.Graphics.Helpers
|
||||
{
|
||||
@@ -33,7 +34,7 @@ namespace ComputeSharp.Graphics.Helpers
|
||||
|
||||
FX.CreateDXGIFactory2(IDXGIFactoryCreationFlags, FX.__uuidof<IDXGIFactory4>(), dxgiFactory4.GetVoidAddressOf()).Assert();
|
||||
|
||||
int result = dxgiFactory4.CopyTo(dxgiFactory6);
|
||||
HRESULT result = dxgiFactory4.CopyTo(dxgiFactory6);
|
||||
|
||||
if (result == FX.S_OK)
|
||||
{
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする