ComputeSharp.Graphics project switched to Vortice.Windows
このコミットが含まれているのは:
1 親
1f312787ac
コミット
07b3608fe0
13ファイル変更
+103
-108
検索条件に一致するファイルはありません
@@ -1,5 +1,5 @@
|
||||
using System;
|
||||
using SharpDX.Direct3D12;
|
||||
using Vortice.DirectX.Direct3D12;
|
||||
|
||||
namespace ComputeSharp.Graphics.Commands.Abstract
|
||||
{
|
||||
|
||||
@@ -2,29 +2,29 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.Contracts;
|
||||
using ComputeSharp.Graphics.Commands.Abstract;
|
||||
using SharpDX.Direct3D12;
|
||||
using Vortice.DirectX.Direct3D12;
|
||||
|
||||
namespace ComputeSharp.Graphics.Commands
|
||||
{
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> that acts as a pool to get new <see cref="CommandAllocator"/> instances wheen needed
|
||||
/// A <see langword="class"/> that acts as a pool to get new <see cref="ID3D12CommandAllocator"/> instances wheen needed
|
||||
/// </summary>
|
||||
internal sealed class CommandAllocatorPool : CommandController
|
||||
{
|
||||
/// <summary>
|
||||
/// The queue of currently pooled <see cref="CommandAllocator"/> instances
|
||||
/// The queue of currently pooled <see cref="ID3D12CommandAllocator"/> instances
|
||||
/// </summary>
|
||||
private readonly Queue<(CommandAllocator CommandAllocator, long FenceValue)> CommandAllocatorQueue = new Queue<(CommandAllocator, long)>();
|
||||
private readonly Queue<(ID3D12CommandAllocator CommandAllocator, long FenceValue)> CommandAllocatorQueue = new Queue<(ID3D12CommandAllocator, long)>();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public CommandAllocatorPool(GraphicsDevice device, CommandListType commandListType) : base(device, commandListType) { }
|
||||
|
||||
/// <summary>
|
||||
/// Adds a new <see cref="CommandAllocator"/> item to the internal pool queue
|
||||
/// Adds a new <see cref="ID3D12CommandAllocator"/> item to the internal pool queue
|
||||
/// </summary>
|
||||
/// <param name="commandAllocator">The input <see cref="CommandAllocator"/> to enqueue</param>
|
||||
/// <param name="fenceValue">The fence value for the input <see cref="CommandAllocator"/></param>
|
||||
public void Enqueue(CommandAllocator commandAllocator, long fenceValue)
|
||||
/// <param name="commandAllocator">The input <see cref="ID3D12CommandAllocator"/> to enqueue</param>
|
||||
/// <param name="fenceValue">The fence value for the input <see cref="ID3D12CommandAllocator"/></param>
|
||||
public void Enqueue(ID3D12CommandAllocator commandAllocator, long fenceValue)
|
||||
{
|
||||
lock (CommandAllocatorQueue)
|
||||
{
|
||||
@@ -33,16 +33,16 @@ namespace ComputeSharp.Graphics.Commands
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a new or reused <see cref="CommandAllocator"/> item to use to issue GPU commands
|
||||
/// Gets a new or reused <see cref="ID3D12CommandAllocator"/> item to use to issue GPU commands
|
||||
/// </summary>
|
||||
[Pure]
|
||||
public CommandAllocator GetCommandAllocator()
|
||||
public ID3D12CommandAllocator GetCommandAllocator()
|
||||
{
|
||||
lock (CommandAllocatorQueue)
|
||||
{
|
||||
if (CommandAllocatorQueue.Count > 0)
|
||||
{
|
||||
(CommandAllocator commandAllocator, long fenceValue) = CommandAllocatorQueue.Peek();
|
||||
(ID3D12CommandAllocator commandAllocator, long fenceValue) = CommandAllocatorQueue.Peek();
|
||||
|
||||
long completedValue = CommandListType switch
|
||||
{
|
||||
@@ -70,7 +70,7 @@ namespace ComputeSharp.Graphics.Commands
|
||||
{
|
||||
lock (CommandAllocatorQueue)
|
||||
{
|
||||
foreach ((CommandAllocator commandAllocator, long _) in CommandAllocatorQueue)
|
||||
foreach ((ID3D12CommandAllocator commandAllocator, long _) in CommandAllocatorQueue)
|
||||
{
|
||||
commandAllocator.Dispose();
|
||||
}
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
using System;
|
||||
using ComputeSharp.Graphics.Buffers.Abstract;
|
||||
using ComputeSharp.Graphics.Commands.Abstract;
|
||||
using SharpDX.Direct3D12;
|
||||
using Vortice.DirectX.Direct3D12;
|
||||
|
||||
namespace ComputeSharp.Graphics.Commands
|
||||
{
|
||||
@@ -22,23 +22,23 @@ namespace ComputeSharp.Graphics.Commands
|
||||
};
|
||||
NativeCommandList = GraphicsDevice.NativeDevice.CreateCommandList(CommandListType, CommandAllocator, null);
|
||||
|
||||
// Set the heap descriptor if the command list is for copy operations
|
||||
// Set the heap descriptor if the command list is not for copy operations
|
||||
if (CommandListType != CommandListType.Copy)
|
||||
{
|
||||
NativeCommandList.SetDescriptorHeaps(GraphicsDevice.ShaderResourceViewAllocator.DescriptorHeap);
|
||||
NativeCommandList.SetDescriptorHeaps(1, new[] { GraphicsDevice.ShaderResourceViewAllocator.DescriptorHeap });
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SharpDX.Direct3D12.CommandAllocator"/> object in use by the current instance
|
||||
/// Gets the <see cref="ID3D12CommandAllocator"/> object in use by the current instance
|
||||
/// </summary>
|
||||
public CommandAllocator CommandAllocator { get; }
|
||||
public ID3D12CommandAllocator CommandAllocator { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="GraphicsCommandList"/> object in use by the current instance
|
||||
/// Gets the <see cref="ID3D12GraphicsCommandList"/> object in use by the current instance
|
||||
/// </summary>
|
||||
public GraphicsCommandList NativeCommandList { get; }
|
||||
public ID3D12GraphicsCommandList NativeCommandList { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Copies a memory region from one resource to another
|
||||
@@ -71,7 +71,7 @@ namespace ComputeSharp.Graphics.Commands
|
||||
public void SetPipelineState(PipelineState pipelineState)
|
||||
{
|
||||
NativeCommandList.SetComputeRootSignature(pipelineState.RootSignature);
|
||||
NativeCommandList.PipelineState = pipelineState.NativePipelineState;
|
||||
NativeCommandList.SetPipelineState(pipelineState.NativePipelineState);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
using SharpDX.Direct3D12;
|
||||
using Vortice.DirectX.Direct3D12;
|
||||
|
||||
namespace ComputeSharp.Graphics.Commands
|
||||
{
|
||||
@@ -11,25 +11,19 @@ namespace ComputeSharp.Graphics.Commands
|
||||
/// Creates a new <see cref="PipelineState"/> instance with the specified parameters
|
||||
/// </summary>
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> to use</param>
|
||||
/// <param name="rootSignature">The <see cref="SharpDX.Direct3D12.RootSignature"/> value for the current shader</param>
|
||||
/// <param name="rootSignature">The <see cref="ID3D12RootSignature"/> value for the current shader</param>
|
||||
/// <param name="computeShader">The bytecode for the compute shader to run</param>
|
||||
public PipelineState(GraphicsDevice device, RootSignature rootSignature, ShaderBytecode computeShader)
|
||||
public PipelineState(GraphicsDevice device, ID3D12RootSignature rootSignature, ShaderBytecode computeShader)
|
||||
{
|
||||
RootSignaturePointer = rootSignature;
|
||||
RootSignature = rootSignature;
|
||||
ComputeShader = computeShader;
|
||||
RootSignature = RootSignaturePointer;
|
||||
|
||||
NativePipelineState = device.NativeDevice.CreateComputePipelineState(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SharpDX.Direct3D12.RootSignature"/> value for the current shader
|
||||
/// Gets the <see cref="ID3D12PipelineState"/> instance for the current <see cref="PipelineState"/> object
|
||||
/// </summary>
|
||||
public RootSignature RootSignature { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets the <see cref="SharpDX.Direct3D12.PipelineState"/> instance for the current <see cref="PipelineState"/> object
|
||||
/// </summary>
|
||||
public SharpDX.Direct3D12.PipelineState NativePipelineState { get; }
|
||||
public ID3D12PipelineState NativePipelineState { get; }
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする