Fixed DEVICE_REMOVED during shader dispatch

このコミットが含まれているのは:
Sergio Pedri committed 2020-08-27 15:32:38 +02:00
1 親 f759e8b495
コミット d11691e307
4ファイル変更
+14 -3

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

+3
ファイルの表示
@@ -29,6 +29,7 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
using (CommandList copyCommandList = new CommandList(GraphicsDevice, CommandListType.Copy))
{
copyCommandList.CopyBufferRegion(this, offset * ElementSizeInBytes, transferBuffer, 0, count * ElementSizeInBytes);
copyCommandList.ExecuteAndWaitForCompletion();
}
using MappedResource resource = transferBuffer.MapResource();
@@ -49,6 +50,7 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
using CommandList copyCommandList = new CommandList(GraphicsDevice, CommandListType.Copy);
copyCommandList.CopyBufferRegion(transferBuffer, 0, this, offset * ElementSizeInBytes, count * ElementSizeInBytes);
copyCommandList.ExecuteAndWaitForCompletion();
}
/// <inheritdoc/>
@@ -60,6 +62,7 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
using CommandList copyCommandList = new CommandList(GraphicsDevice, CommandListType.Copy);
copyCommandList.CopyBufferRegion(buffer, 0, this, 0, SizeInBytes);
copyCommandList.ExecuteAndWaitForCompletion();
}
else SetDataWithCpuBuffer(buffer);
}
+1
ファイルの表示
@@ -99,6 +99,7 @@ namespace ComputeSharp
using CommandList copyCommandList = new CommandList(GraphicsDevice, CommandListType.Copy);
copyCommandList.CopyBufferRegion(buffer, 0, this, 0, SizeInBytes);
copyCommandList.ExecuteAndWaitForCompletion();
}
else SetDataWithCpuBuffer(buffer);
}
+9 -3
ファイルの表示
@@ -88,7 +88,7 @@ namespace ComputeSharp.Graphics.Commands
}
/// <summary>
/// Executes the pending command list using the specified thread group values
/// Dispatches the pending shader using the specified thread group values
/// </summary>
/// <param name="threadGroupCountX">The number of thread groups to schedule for the X axis</param>
/// <param name="threadGroupCountY">The number of thread groups to schedule for the Y axis</param>
@@ -98,13 +98,19 @@ namespace ComputeSharp.Graphics.Commands
NativeCommandList.Dispatch(threadGroupCountX, threadGroupCountY, threadGroupCountZ);
}
/// <inheritdoc/>
public override void Dispose()
/// <summary>
/// Executes the commands in the current commands list, and waits for completion
/// </summary>
public void ExecuteAndWaitForCompletion()
{
NativeCommandList.Close();
GraphicsDevice.ExecuteCommandList(this);
}
/// <inheritdoc/>
public override void Dispose()
{
switch (CommandListType)
{
case CommandListType.Direct:
+1
ファイルの表示
@@ -125,6 +125,7 @@ namespace ComputeSharp.Shaders
// Dispatch and wait for completion
commandList.Dispatch(groupsX, groupsY, groupsZ);
commandList.ExecuteAndWaitForCompletion();
}
}
}