Minor bug fixes and code tweaks
このコミットが含まれているのは:
1 親
41384e347c
コミット
79ea9ad34e
4ファイル変更
+14
-14
検索条件に一致するファイルはありません
@@ -87,8 +87,8 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
public override unsafe void SetData(Buffer<T> source)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
source.GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
ThrowIfDeviceMismatch(source.GraphicsDevice);
|
||||
ThrowIfDisposed();
|
||||
source.ThrowIfDisposed();
|
||||
|
||||
|
||||
@@ -36,7 +36,7 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
/// <summary>
|
||||
/// The default <see cref="D3D12_RESOURCE_STATES"/> value for the current resource.
|
||||
/// </summary>
|
||||
private readonly D3D12_RESOURCE_STATES D3D12ResourceStates;
|
||||
private readonly D3D12_RESOURCE_STATES D3D12ResourceState;
|
||||
|
||||
/// <summary>
|
||||
/// Creates a new <see cref="Texture2D{T}"/> instance with the specified parameters.
|
||||
@@ -61,7 +61,7 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
DXGIFormatHelper.GetForType<T>(),
|
||||
(uint)width,
|
||||
(uint)height,
|
||||
out D3D12ResourceStates);
|
||||
out D3D12ResourceState);
|
||||
|
||||
device.AllocateShaderResourceViewDescriptorHandles(out D3D12_CPU_DESCRIPTOR_HANDLE d3D12CpuDescriptorHandle, out D3D12GpuDescriptorHandle);
|
||||
|
||||
@@ -243,9 +243,9 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
|
||||
using (CommandList copyCommandList = new(GraphicsDevice, D3D12_COMMAND_LIST_TYPE_COMPUTE))
|
||||
{
|
||||
copyCommandList.ResourceBarrier(D3D12Resource, D3D12ResourceStates, D3D12_RESOURCE_STATE_COPY_SOURCE);
|
||||
copyCommandList.ResourceBarrier(D3D12Resource, D3D12ResourceState, D3D12_RESOURCE_STATE_COPY_SOURCE);
|
||||
copyCommandList.CopyTextureRegion(d3D12Resource.Get(), (uint)Unsafe.SizeOf<T>(), D3D12Resource, DXGIFormatHelper.GetForType<T>(), (uint)x, (uint)y, (uint)width, (uint)height);
|
||||
copyCommandList.ResourceBarrier(D3D12Resource, D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12ResourceStates);
|
||||
copyCommandList.ResourceBarrier(D3D12Resource, D3D12_RESOURCE_STATE_COPY_SOURCE, D3D12ResourceState);
|
||||
copyCommandList.ExecuteAndWaitForCompletion();
|
||||
}
|
||||
|
||||
@@ -382,9 +382,9 @@ namespace ComputeSharp.Graphics.Buffers.Abstract
|
||||
|
||||
using CommandList copyCommandList = new(GraphicsDevice, D3D12_COMMAND_LIST_TYPE_COMPUTE);
|
||||
|
||||
copyCommandList.ResourceBarrier(D3D12Resource, D3D12ResourceStates, D3D12_RESOURCE_STATE_COPY_DEST);
|
||||
copyCommandList.ResourceBarrier(D3D12Resource, D3D12ResourceState, D3D12_RESOURCE_STATE_COPY_DEST);
|
||||
copyCommandList.CopyTextureRegion(D3D12Resource, DXGIFormatHelper.GetForType<T>(), (uint)x, (uint)y, d3D12Resource.Get(), (uint)width, (uint)height, (uint)Unsafe.SizeOf<T>());
|
||||
copyCommandList.ResourceBarrier(D3D12Resource, D3D12_RESOURCE_STATE_COPY_DEST, D3D12ResourceStates);
|
||||
copyCommandList.ResourceBarrier(D3D12Resource, D3D12_RESOURCE_STATE_COPY_DEST, D3D12ResourceState);
|
||||
copyCommandList.ExecuteAndWaitForCompletion();
|
||||
}
|
||||
|
||||
|
||||
@@ -119,8 +119,8 @@ namespace ComputeSharp
|
||||
public override unsafe void SetData(Buffer<T> source)
|
||||
{
|
||||
GraphicsDevice.ThrowIfDisposed();
|
||||
source.GraphicsDevice.ThrowIfDisposed();
|
||||
|
||||
ThrowIfDeviceMismatch(source.GraphicsDevice);
|
||||
ThrowIfDisposed();
|
||||
source.ThrowIfDisposed();
|
||||
|
||||
|
||||
@@ -25,7 +25,7 @@ namespace ComputeSharp.Tests.Internals
|
||||
float value = 10;
|
||||
using ReadWriteBuffer<float> buffer = Gpu.Default.AllocateReadWriteBuffer<float>(1);
|
||||
|
||||
Shader1 shader1 = new Shader1 { A = value, B = buffer };
|
||||
Shader1 shader1 = new() { A = value, B = buffer };
|
||||
|
||||
int
|
||||
hash1 = ShaderHashCodeProvider.GetHashCode(shader1),
|
||||
@@ -33,7 +33,7 @@ namespace ComputeSharp.Tests.Internals
|
||||
|
||||
Assert.IsTrue(hash1 == hash2);
|
||||
|
||||
Shader1 shader2 = new Shader1 { A = value, B = buffer };
|
||||
Shader1 shader2 = new() { A = value, B = buffer };
|
||||
|
||||
int hash3 = ShaderHashCodeProvider.GetHashCode(shader2);
|
||||
|
||||
@@ -55,11 +55,11 @@ namespace ComputeSharp.Tests.Internals
|
||||
[TestMethod]
|
||||
public void ShaderWithCapturedDelegates()
|
||||
{
|
||||
Func<float, float> f = x => x * x;
|
||||
Func<float, float> f = static x => x * x;
|
||||
|
||||
using ReadWriteBuffer<float> buffer = Gpu.Default.AllocateReadWriteBuffer<float>(1);
|
||||
|
||||
Shader2 shader1 = new Shader2 { A = 1, B = buffer, F = f };
|
||||
Shader2 shader1 = new() { A = 1, B = buffer, F = f };
|
||||
|
||||
int
|
||||
hash1 = ShaderHashCodeProvider.GetHashCode(shader1),
|
||||
@@ -67,9 +67,9 @@ namespace ComputeSharp.Tests.Internals
|
||||
|
||||
Assert.IsTrue(hash1 == hash2);
|
||||
|
||||
f = x => x + 1;
|
||||
f = static x => x + 1;
|
||||
|
||||
Shader2 shader2 = new Shader2 { A = 1, B = buffer, F = f };
|
||||
Shader2 shader2 = new() { A = 1, B = buffer, F = f };
|
||||
|
||||
int hash3 = ShaderHashCodeProvider.GetHashCode(shader2);
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする