Minor code refactoring
このコミットが含まれているのは:
1 親
09c1822b5d
コミット
1cf3b897b8
6ファイル変更
+9
-23
検索条件に一致するファイルはありません
@@ -16,7 +16,7 @@
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-rc0001" />
|
||||
<PackageReference Include="SixLabors.ImageSharp" Version="1.0.0-rc0002" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
||||
@@ -4,7 +4,6 @@ using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using SixLabors.ImageSharp;
|
||||
using SixLabors.ImageSharp.Advanced;
|
||||
using SixLabors.ImageSharp.Memory;
|
||||
using SixLabors.ImageSharp.PixelFormats;
|
||||
using SixLabors.ImageSharp.Processing.Processors;
|
||||
|
||||
|
||||
@@ -25,10 +25,11 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
public override void GetData(Span<T> span, int offset, int count)
|
||||
{
|
||||
using Buffer<T> transferBuffer = new Buffer<T>(GraphicsDevice, count, count * ElementSizeInBytes, BufferType.ReadBack);
|
||||
using CommandList copyCommandList = new CommandList(GraphicsDevice, CommandListType.Copy);
|
||||
|
||||
copyCommandList.CopyBufferRegion(this, offset * ElementSizeInBytes, transferBuffer, 0, count * ElementSizeInBytes);
|
||||
copyCommandList.Flush();
|
||||
using (CommandList copyCommandList = new CommandList(GraphicsDevice, CommandListType.Copy))
|
||||
{
|
||||
copyCommandList.CopyBufferRegion(this, offset * ElementSizeInBytes, transferBuffer, 0, count * ElementSizeInBytes);
|
||||
}
|
||||
|
||||
using MappedResource resource = transferBuffer.MapResource();
|
||||
|
||||
@@ -48,7 +49,6 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
using CommandList copyCommandList = new CommandList(GraphicsDevice, CommandListType.Copy);
|
||||
|
||||
copyCommandList.CopyBufferRegion(transferBuffer, 0, this, offset * ElementSizeInBytes, count * ElementSizeInBytes);
|
||||
copyCommandList.Flush();
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
@@ -60,7 +60,6 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
using CommandList copyCommandList = new CommandList(GraphicsDevice, CommandListType.Copy);
|
||||
|
||||
copyCommandList.CopyBufferRegion(buffer, 0, this, 0, SizeInBytes);
|
||||
copyCommandList.Flush();
|
||||
}
|
||||
else SetDataWithCpuBuffer(buffer);
|
||||
}
|
||||
|
||||
@@ -99,7 +99,6 @@ namespace ComputeSharp
|
||||
using CommandList copyCommandList = new CommandList(GraphicsDevice, CommandListType.Copy);
|
||||
|
||||
copyCommandList.CopyBufferRegion(buffer, 0, this, 0, SizeInBytes);
|
||||
copyCommandList.Flush();
|
||||
}
|
||||
else SetDataWithCpuBuffer(buffer);
|
||||
}
|
||||
|
||||
@@ -88,23 +88,13 @@ namespace ComputeSharp.Graphics.Commands
|
||||
NativeCommandList.Dispatch(threadGroupCountX, threadGroupCountY, threadGroupCountZ);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Executes the pending operations and waits for them to be completed
|
||||
/// </summary>
|
||||
public void Flush()
|
||||
{
|
||||
Close();
|
||||
GraphicsDevice.ExecuteCommandList(this);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Closes the current native command list
|
||||
/// </summary>
|
||||
public void Close() => NativeCommandList.Close();
|
||||
|
||||
/// <inheritdoc/>
|
||||
public override void Dispose()
|
||||
{
|
||||
NativeCommandList.Close();
|
||||
|
||||
GraphicsDevice.ExecuteCommandList(this);
|
||||
|
||||
switch (CommandListType)
|
||||
{
|
||||
case CommandListType.Direct:
|
||||
|
||||
@@ -125,7 +125,6 @@ namespace ComputeSharp.Shaders
|
||||
|
||||
// Dispatch and wait for completion
|
||||
commandList.Dispatch(groupsX, groupsY, groupsZ);
|
||||
commandList.Flush();
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする