Minor bug fixes in ComputeContext extensions
このコミットが含まれているのは:
1 親
3a4373d36d
コミット
49475dcd77
2ファイル変更
+10
-10
検索条件に一致するファイルはありません
@@ -129,7 +129,7 @@ public ref struct ComputeContext
|
||||
|
||||
PipelineData pipelineData = ShaderRunner<T>.GetPipelineData(this.device, threadsX, threadsY, threadsZ, ref shader);
|
||||
|
||||
ref CommandList commandList = ref GetCommandList(in this, this.device, pipelineData.D3D12PipelineState);
|
||||
ref CommandList commandList = ref GetCommandList(in this, pipelineData.D3D12PipelineState);
|
||||
|
||||
commandList.D3D12GraphicsCommandList->SetComputeRootSignature(pipelineData.D3D12RootSignature);
|
||||
|
||||
@@ -166,7 +166,7 @@ public ref struct ComputeContext
|
||||
|
||||
PipelineData pipelineData = ShaderRunner<T>.GetPipelineData(this.device, threadsX, threadsY, threadsZ, ref shader);
|
||||
|
||||
ref CommandList commandList = ref GetCommandList(in this, this.device, pipelineData.D3D12PipelineState);
|
||||
ref CommandList commandList = ref GetCommandList(in this, pipelineData.D3D12PipelineState);
|
||||
|
||||
commandList.D3D12GraphicsCommandList->SetComputeRootSignature(pipelineData.D3D12RootSignature);
|
||||
|
||||
@@ -183,6 +183,7 @@ public ref struct ComputeContext
|
||||
}
|
||||
|
||||
/// <inheritdoc cref="IDisposable.Dispose"/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public void Dispose()
|
||||
{
|
||||
ThrowInvalidOperationExceptionIfDeviceIsNull();
|
||||
@@ -199,11 +200,10 @@ public ref struct ComputeContext
|
||||
/// Gets the current <see cref="CommandList"/> instance, and initializes it as needed.
|
||||
/// </summary>
|
||||
/// <param name="this">The current <see cref="ComputeContext"/> instance.</param>
|
||||
/// <param name="device">The <see cref="GraphicsDevice"/> to use to run the shader.</param>
|
||||
/// <param name="pipelineState">The input <see cref="ID3D12PipelineState"/> to load.</param>
|
||||
/// <returns>A reference to the <see cref="CommandList"/> instance to use.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
private static unsafe ref CommandList GetCommandList(in ComputeContext @this, GraphicsDevice device, ID3D12PipelineState* pipelineState)
|
||||
private static unsafe ref CommandList GetCommandList(in ComputeContext @this, ID3D12PipelineState* pipelineState)
|
||||
{
|
||||
// This method has to take the context by readonly reference to allow callers to be marked as readonly.
|
||||
// This is needed to skip the hidden copies done by Roslyn, which would break the dispatching, as the
|
||||
@@ -217,7 +217,7 @@ public ref struct ComputeContext
|
||||
}
|
||||
else
|
||||
{
|
||||
context.commandList = new CommandList(device, pipelineState);
|
||||
context.commandList = new CommandList(context.device, pipelineState);
|
||||
}
|
||||
|
||||
return ref context.commandList;
|
||||
|
||||
@@ -28,7 +28,7 @@ public static partial class ComputeContextExtensions
|
||||
/// <param name="x">The number of iterations to run on the X axis.</param>
|
||||
/// <param name="y">The number of iterations to run on the Y axis.</param>
|
||||
/// <param name="shader">The input <typeparamref name="T"/> instance representing the compute shader to run.</param>
|
||||
public static void For<T>(this ComputeContext context, int x, int y, in T shader)
|
||||
public static void For<T>(this in ComputeContext context, int x, int y, in T shader)
|
||||
where T : struct, IComputeShader
|
||||
{
|
||||
context.Run(x, y, 1, ref Unsafe.AsRef(in shader));
|
||||
@@ -43,7 +43,7 @@ public static partial class ComputeContextExtensions
|
||||
/// <param name="y">The number of iterations to run on the Y axis.</param>
|
||||
/// <param name="z">The number of iterations to run on the Z axis.</param>
|
||||
/// <param name="shader">The input <typeparamref name="T"/> instance representing the compute shader to run.</param>
|
||||
public static void For<T>(this ComputeContext context, int x, int y, int z, in T shader)
|
||||
public static void For<T>(this in ComputeContext context, int x, int y, int z, in T shader)
|
||||
where T : struct, IComputeShader
|
||||
{
|
||||
context.Run(x, y, z, ref Unsafe.AsRef(in shader));
|
||||
@@ -61,7 +61,7 @@ public static partial class ComputeContextExtensions
|
||||
/// <param name="threadsY">The number of threads in each thread group for the Y axis.</param>
|
||||
/// <param name="threadsZ">The number of threads in each thread group for the Z axis.</param>
|
||||
/// <param name="shader">The input <typeparamref name="T"/> instance representing the compute shader to run.</param>
|
||||
public static void For<T>(this ComputeContext context, int x, int y, int z, int threadsX, int threadsY, int threadsZ, in T shader)
|
||||
public static void For<T>(this in ComputeContext context, int x, int y, int z, int threadsX, int threadsY, int threadsZ, in T shader)
|
||||
where T : struct, IComputeShader
|
||||
{
|
||||
context.Run(x, y, z, threadsX, threadsY, threadsZ, ref Unsafe.AsRef(in shader));
|
||||
@@ -74,7 +74,7 @@ public static partial class ComputeContextExtensions
|
||||
/// <typeparam name="TPixel">The type of pixels being processed by the shader.</typeparam>
|
||||
/// <param name="context">The <see cref="ComputeContext"/> to use to run the shader.</param>
|
||||
/// <param name="texture">The target texture to apply the pixel shader to.</param>
|
||||
public static void ForEach<T, TPixel>(this ComputeContext context, IReadWriteTexture2D<TPixel> texture)
|
||||
public static void ForEach<T, TPixel>(this in ComputeContext context, IReadWriteTexture2D<TPixel> texture)
|
||||
where T : struct, IPixelShader<TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
@@ -89,7 +89,7 @@ public static partial class ComputeContextExtensions
|
||||
/// <param name="context">The <see cref="ComputeContext"/> to use to run the shader.</param>
|
||||
/// <param name="texture">The target texture to apply the pixel shader to.</param>
|
||||
/// <param name="shader">The input <typeparamref name="T"/> instance representing the pixel shader to run.</param>
|
||||
public static void ForEach<T, TPixel>(this ComputeContext context, IReadWriteTexture2D<TPixel> texture, in T shader)
|
||||
public static void ForEach<T, TPixel>(this in ComputeContext context, IReadWriteTexture2D<TPixel> texture, in T shader)
|
||||
where T : struct, IPixelShader<TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする