Fixed missing call to SetDescriptorHeaps for reused lists

このコミットが含まれているのは:
Sergio Pedri committed 2021-07-17 15:44:33 +02:00
1 親 3e6c6e6fe5
コミット 013a518f3d
3ファイル変更
+21 -19

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

+7
ファイルの表示
@@ -2,6 +2,7 @@
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using TerraFX.Interop;
using static TerraFX.Interop.D3D12_COMMAND_LIST_TYPE;
namespace ComputeSharp.Graphics.Commands
{
@@ -47,6 +48,12 @@ namespace ComputeSharp.Graphics.Commands
d3D12CommandListType,
out *(ID3D12GraphicsCommandList**)Unsafe.AsPointer(ref this.d3D12GraphicsCommandList),
out *(ID3D12CommandAllocator**)Unsafe.AsPointer(ref this.d3D12CommandAllocator));
// Set the heap descriptor if the command list is not for copy operations
if (d3D12CommandListType is not D3D12_COMMAND_LIST_TYPE_COPY)
{
device.SetDescriptorHeapForCommandList(this.d3D12GraphicsCommandList);
}
}
/// <summary>
+1 -17
ファイルの表示
@@ -4,7 +4,6 @@ using System.Runtime.CompilerServices;
using ComputeSharp.Core.Extensions;
using ComputeSharp.Graphics.Extensions;
using TerraFX.Interop;
using static TerraFX.Interop.D3D12_COMMAND_LIST_TYPE;
namespace ComputeSharp.Graphics.Commands.Interop
{
@@ -18,11 +17,6 @@ namespace ComputeSharp.Graphics.Commands.Interop
/// </summary>
private readonly D3D12_COMMAND_LIST_TYPE d3D12CommandListType;
/// <summary>
/// The <see cref="ID3D12DescriptorHeap"/> object in use for the current instance.
/// </summary>
private readonly ID3D12DescriptorHeap* d3D12DescriptorHeap;
/// <summary>
/// The queue of <see cref="D3D12CommandListBundle"/> items with the available command lists.
/// </summary>
@@ -32,11 +26,9 @@ namespace ComputeSharp.Graphics.Commands.Interop
/// Creates a new <see cref="ID3D12CommandListPool"/> instance with the specified parameters.
/// </summary>
/// <param name="d3D12CommandListType">The command list type to use.</param>
/// <param name="d3D12DescriptorHeap">The <see cref="ID3D12DescriptorHeap"/> object in use for the current instance.</param>
public ID3D12CommandListPool(D3D12_COMMAND_LIST_TYPE d3D12CommandListType, ID3D12DescriptorHeap* d3D12DescriptorHeap)
public ID3D12CommandListPool(D3D12_COMMAND_LIST_TYPE d3D12CommandListType)
{
this.d3D12CommandListType = d3D12CommandListType;
this.d3D12DescriptorHeap = d3D12DescriptorHeap;
this.d3D12CommandListBundleQueue = new Queue<D3D12CommandListBundle>();
}
@@ -105,14 +97,6 @@ namespace ComputeSharp.Graphics.Commands.Interop
using ComPtr<ID3D12CommandAllocator> d3D12CommandAllocatorComPtr = d3D12Device->CreateCommandAllocator(this.d3D12CommandListType);
using ComPtr<ID3D12GraphicsCommandList> d3D12CommandListComPtr = d3D12Device->CreateCommandList(this.d3D12CommandListType, d3D12CommandAllocatorComPtr.Get());
// Set the heap descriptor if the command list is not for copy operations
if (this.d3D12CommandListType is not D3D12_COMMAND_LIST_TYPE_COPY)
{
ID3D12DescriptorHeap* d3D12DescriptorHeap = this.d3D12DescriptorHeap;
d3D12CommandListComPtr.Get()->SetDescriptorHeaps(1, &d3D12DescriptorHeap);
}
fixed (ID3D12GraphicsCommandList** d3D12CommandListPtr = &d3D12CommandList)
fixed (ID3D12CommandAllocator** d3D12CommandAllocatorPtr = &d3D12CommandAllocator)
{
+13 -2
ファイルの表示
@@ -98,8 +98,8 @@ namespace ComputeSharp
this.d3D12CopyFence = d3D12Device->CreateFence();
this.shaderResourceViewDescriptorAllocator = new ID3D12DescriptorHandleAllocator(d3D12Device);
this.computeCommandListPool = new ID3D12CommandListPool(D3D12_COMMAND_LIST_TYPE_COMPUTE, this.shaderResourceViewDescriptorAllocator.D3D12DescriptorHeap);
this.copyCommandListPool = new ID3D12CommandListPool(D3D12_COMMAND_LIST_TYPE_COPY, null);
this.computeCommandListPool = new ID3D12CommandListPool(D3D12_COMMAND_LIST_TYPE_COMPUTE);
this.copyCommandListPool = new ID3D12CommandListPool(D3D12_COMMAND_LIST_TYPE_COPY);
Luid = Luid.FromLUID(dxgiDescription1->AdapterLuid);
Name = new string((char*)dxgiDescription1->Description);
@@ -292,6 +292,17 @@ namespace ComputeSharp
}
}
/// <summary>
/// Sets the descriptor heap for a given <see cref="ID3D12GraphicsCommandList"/> instance.
/// </summary>
/// <param name="d3D12GraphicsCommandList">The input <see cref="ID3D12GraphicsCommandList"/> instance to use.</param>
internal void SetDescriptorHeapForCommandList(ID3D12GraphicsCommandList* d3D12GraphicsCommandList)
{
ID3D12DescriptorHeap* d3D12DescriptorHeap = this.shaderResourceViewDescriptorAllocator.D3D12DescriptorHeap;
d3D12GraphicsCommandList->SetDescriptorHeaps(1, &d3D12DescriptorHeap);
}
/// <summary>
/// Executes a given command list and waits for the operation to be completed.
/// </summary>