Remove unnecessary ref parameters (change to in)

このコミットが含まれているのは:
Sergio Pedri committed 2023-11-20 20:51:39 +01:00
1 親 ed9702339e
コミット 55b696ffd6
3ファイル変更
+16 -23

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

+5 -8
ファイルの表示
@@ -1,5 +1,4 @@
using System;
using System.Runtime.CompilerServices;
using ComputeSharp.Descriptors;
using ComputeSharp.Interop;
@@ -24,7 +23,7 @@ public static partial class GraphicsDeviceExtensions
using ComputeContext context = device.CreateComputeContext();
context.Run(x, ref Unsafe.AsRef(in shader));
context.Run(x, in shader);
}
/// <summary>
@@ -42,7 +41,7 @@ public static partial class GraphicsDeviceExtensions
using ComputeContext context = device.CreateComputeContext();
context.Run(x, y, ref Unsafe.AsRef(in shader));
context.Run(x, y, in shader);
}
/// <summary>
@@ -61,7 +60,7 @@ public static partial class GraphicsDeviceExtensions
using ComputeContext context = device.CreateComputeContext();
context.Run(x, y, z, ref Unsafe.AsRef(in shader));
context.Run(x, y, z, in shader);
}
/// <summary>
@@ -80,9 +79,7 @@ public static partial class GraphicsDeviceExtensions
using ComputeContext context = device.CreateComputeContext();
Unsafe.SkipInit(out T shader);
context.Run(texture, ref shader);
context.Run(texture, default(T));
}
/// <summary>
@@ -102,7 +99,7 @@ public static partial class GraphicsDeviceExtensions
using ComputeContext context = device.CreateComputeContext();
context.Run(texture, ref Unsafe.AsRef(in shader));
context.Run(texture, in shader);
}
/// <summary>
+6 -8
ファイルの表示
@@ -121,11 +121,10 @@ public struct ComputeContext : IDisposable, IAsyncDisposable
/// </summary>
/// <param name="x">The number of iterations to run on the X axis.</param>
/// <param name="shader">The input <typeparamref name="T"/> instance representing the compute shader to run.</param>
internal readonly unsafe void Run<T>(int x, ref T shader)
internal readonly unsafe void Run<T>(int x, in T shader)
where T : struct, IComputeShader, IComputeShaderDescriptor<T>
{
Run(x, 1, 1, ref shader);
Run(x, 1, 1, in shader);
}
/// <summary>
@@ -134,11 +133,10 @@ public struct ComputeContext : IDisposable, IAsyncDisposable
/// <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>
internal readonly unsafe void Run<T>(int x, int y, ref T shader)
internal readonly unsafe void Run<T>(int x, int y, in T shader)
where T : struct, IComputeShader, IComputeShaderDescriptor<T>
{
Run(x, y, 1, ref shader);
Run(x, y, 1, in shader);
}
/// <summary>
@@ -149,7 +147,7 @@ public struct ComputeContext : IDisposable, IAsyncDisposable
/// <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>
internal readonly unsafe void Run<T>(int x, int y, int z, ref T shader)
internal readonly unsafe void Run<T>(int x, int y, int z, in T shader)
where T : struct, IComputeShader, IComputeShaderDescriptor<T>
{
default(InvalidOperationException).ThrowIf(this.device is null);
@@ -189,7 +187,7 @@ public struct ComputeContext : IDisposable, IAsyncDisposable
/// <typeparam name="TPixel">The type of pixel to work on.</typeparam>
/// <param name="texture">The target texture to invoke the pixel shader upon.</param>
/// <param name="shader">The input <typeparamref name="T"/> instance representing the pixel shader to run.</param>
internal readonly unsafe void Run<T, TPixel>(IReadWriteNormalizedTexture2D<TPixel> texture, ref T shader)
internal readonly unsafe void Run<T, TPixel>(IReadWriteNormalizedTexture2D<TPixel> texture, in T shader)
where T : struct, IComputeShader<TPixel>, IComputeShaderDescriptor<T>
where TPixel : unmanaged
{
+5 -7
ファイルの表示
@@ -487,7 +487,7 @@ public static class ComputeContextExtensions
public static void For<T>(this in ComputeContext context, int x, in T shader)
where T : struct, IComputeShader, IComputeShaderDescriptor<T>
{
context.Run(x, ref Unsafe.AsRef(in shader));
context.Run(x, in shader);
}
/// <summary>
@@ -501,7 +501,7 @@ public static class ComputeContextExtensions
public static void For<T>(this in ComputeContext context, int x, int y, in T shader)
where T : struct, IComputeShader, IComputeShaderDescriptor<T>
{
context.Run(x, y, ref Unsafe.AsRef(in shader));
context.Run(x, y, in shader);
}
/// <summary>
@@ -516,7 +516,7 @@ public static class ComputeContextExtensions
public static void For<T>(this in ComputeContext context, int x, int y, int z, in T shader)
where T : struct, IComputeShader, IComputeShaderDescriptor<T>
{
context.Run(x, y, z, ref Unsafe.AsRef(in shader));
context.Run(x, y, z, in shader);
}
/// <summary>
@@ -532,9 +532,7 @@ public static class ComputeContextExtensions
{
default(ArgumentNullException).ThrowIfNull(texture);
Unsafe.SkipInit(out T shader);
context.Run(texture, ref shader);
context.Run(texture, default(T));
}
/// <summary>
@@ -551,7 +549,7 @@ public static class ComputeContextExtensions
{
default(ArgumentNullException).ThrowIfNull(texture);
context.Run(texture, ref Unsafe.AsRef(in shader));
context.Run(texture, in shader);
}
/// <summary>