diff --git a/samples/ComputeSharp.SwapChain.Core.Shared/ViewModels/MainViewModel.cs b/samples/ComputeSharp.SwapChain.Core.Shared/ViewModels/MainViewModel.cs index 2e92d458..1f0291b3 100644 --- a/samples/ComputeSharp.SwapChain.Core.Shared/ViewModels/MainViewModel.cs +++ b/samples/ComputeSharp.SwapChain.Core.Shared/ViewModels/MainViewModel.cs @@ -32,7 +32,7 @@ public sealed class MainViewModel : ObservableObject /// public MainViewModel(IAnalyticsService analyticsService) { - Guard.IsNotNull(analyticsService, nameof(analyticsService)); + Guard.IsNotNull(analyticsService); this.analyticsService = analyticsService; this.isVerticalSyncEnabled = true; diff --git a/samples/ComputeSharp.SwapChain.Uwp/Extensions/AssemblyExtensions.cs b/samples/ComputeSharp.SwapChain.Uwp/Extensions/AssemblyExtensions.cs index cd39cfda..52587761 100644 --- a/samples/ComputeSharp.SwapChain.Uwp/Extensions/AssemblyExtensions.cs +++ b/samples/ComputeSharp.SwapChain.Uwp/Extensions/AssemblyExtensions.cs @@ -20,8 +20,8 @@ public static class AssemblyExtensions /// The contents of the specified file. public static bool TryReadAllTextFromManifestFile(this Assembly assembly, string filename, out string? text) { - Guard.IsNotNull(assembly, nameof(assembly)); - Guard.IsNotNull(filename, nameof(filename)); + Guard.IsNotNull(assembly); + Guard.IsNotNull(filename); try { diff --git a/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs b/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs index 2d1c39aa..3ffca6a7 100644 --- a/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs +++ b/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs @@ -29,7 +29,7 @@ partial class SwapChainManager { ThrowIfDisposed(); - Guard.IsNotNull(shaderRunner, nameof(shaderRunner)); + Guard.IsNotNull(shaderRunner); using (await this.setupSemaphore.LockAsync()) { diff --git a/src/ComputeSharp.UI/ShaderRunner{T}.cs b/src/ComputeSharp.UI/ShaderRunner{T}.cs index 4d3af1cd..da2d5fed 100644 --- a/src/ComputeSharp.UI/ShaderRunner{T}.cs +++ b/src/ComputeSharp.UI/ShaderRunner{T}.cs @@ -40,7 +40,7 @@ public sealed class ShaderRunner : IShaderRunner /// The instance used to create shaders to run. public ShaderRunner(Func shaderFactory) { - Guard.IsNotNull(shaderFactory, nameof(shaderFactory)); + Guard.IsNotNull(shaderFactory); this.shaderFactory = shaderFactory; } @@ -51,7 +51,7 @@ public sealed class ShaderRunner : IShaderRunner /// The instance used to create shaders to run. public ShaderRunner(Func shaderFactory) { - Guard.IsNotNull(shaderFactory, nameof(shaderFactory)); + Guard.IsNotNull(shaderFactory); this.statefulShaderFactory = shaderFactory; } diff --git a/src/ComputeSharp/Graphics/Extensions/BufferExtensions.cs b/src/ComputeSharp/Graphics/Extensions/BufferExtensions.cs index f6815dee..6045ba1e 100644 --- a/src/ComputeSharp/Graphics/Extensions/BufferExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/BufferExtensions.cs @@ -22,7 +22,7 @@ public static class BufferExtensions public static T[] ToArray(this Buffer source) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(source); return source.ToArray(0, source.Length); } @@ -38,8 +38,8 @@ public static class BufferExtensions public static T[] ToArray(this Buffer source, int offset, int count) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsGreaterThanOrEqualTo(count, 0, nameof(count)); + Guard.IsNotNull(source); + Guard.IsGreaterThanOrEqualTo(count, 0); T[] data = GC.AllocateUninitializedArray(count); @@ -57,8 +57,8 @@ public static class BufferExtensions public static void CopyTo(this Buffer source, T[] destination) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination.AsSpan(), 0); } @@ -75,8 +75,8 @@ public static class BufferExtensions public static void CopyTo(this Buffer source, T[] destination, int sourceOffset, int destinationOffset, int count) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); Span span = destination.AsSpan(destinationOffset, count); @@ -92,7 +92,7 @@ public static class BufferExtensions public static void CopyTo(this Buffer source, Span destination) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(source); source.CopyTo(destination, 0); } @@ -107,7 +107,7 @@ public static class BufferExtensions public static void CopyTo(this Buffer source, Span destination, int sourceOffset) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(source); source.CopyTo(ref MemoryMarshal.GetReference(destination), sourceOffset, destination.Length); } @@ -121,8 +121,8 @@ public static class BufferExtensions public static void CopyTo(this Buffer source, Buffer destination) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination, 0, 0, source.Length); } @@ -139,8 +139,8 @@ public static class BufferExtensions public static void CopyTo(this Buffer source, Buffer destination, int sourceOffset, int destinationOffset, int count) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination, sourceOffset, destinationOffset, count); } @@ -154,8 +154,8 @@ public static class BufferExtensions public static void CopyFrom(this Buffer destination, T[] source) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); destination.CopyFrom(source.AsSpan(), 0); } @@ -172,8 +172,8 @@ public static class BufferExtensions public static void CopyFrom(this Buffer destination, T[] source, int sourceOffset, int destinationOffset, int count) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); ReadOnlySpan span = source.AsSpan(sourceOffset, count); @@ -189,7 +189,7 @@ public static class BufferExtensions public static void CopyFrom(this Buffer destination, ReadOnlySpan source) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(destination); destination.CopyFrom(source, 0); } @@ -204,7 +204,7 @@ public static class BufferExtensions public static void CopyFrom(this Buffer destination, ReadOnlySpan source, int destinationOffset) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(destination); destination.CopyFrom(ref MemoryMarshal.GetReference(source), destinationOffset, source.Length); } @@ -218,8 +218,8 @@ public static class BufferExtensions public static void CopyFrom(this Buffer destination, Buffer source) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); source.CopyTo(destination, 0, 0, source.Length); } @@ -236,8 +236,8 @@ public static class BufferExtensions public static void CopyFrom(this Buffer destination, Buffer source, int sourceOffset, int destinationOffset, int count) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); source.CopyTo(destination, sourceOffset, destinationOffset, count); } diff --git a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs index adc2f244..393fe304 100644 --- a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs +++ b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs @@ -18,7 +18,7 @@ public static partial class GraphicsDeviceExtensions public static void For(this GraphicsDevice device, int x, in T shader) where T : struct, IComputeShader { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); using ComputeContext context = device.CreateComputeContext(); @@ -36,7 +36,7 @@ public static partial class GraphicsDeviceExtensions public static void For(this GraphicsDevice device, int x, int y, in T shader) where T : struct, IComputeShader { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); using ComputeContext context = device.CreateComputeContext(); @@ -55,7 +55,7 @@ public static partial class GraphicsDeviceExtensions public static void For(this GraphicsDevice device, int x, int y, int z, in T shader) where T : struct, IComputeShader { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); using ComputeContext context = device.CreateComputeContext(); @@ -77,7 +77,7 @@ public static partial class GraphicsDeviceExtensions public static void For(this GraphicsDevice device, int x, int y, int z, int threadsX, int threadsY, int threadsZ, in T shader) where T : struct, IComputeShader { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); using ComputeContext context = device.CreateComputeContext(); @@ -95,8 +95,8 @@ public static partial class GraphicsDeviceExtensions where T : struct, IPixelShader where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(device); + Guard.IsNotNull(texture); using ComputeContext context = device.CreateComputeContext(); @@ -115,8 +115,8 @@ public static partial class GraphicsDeviceExtensions where T : struct, IPixelShader where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(device); + Guard.IsNotNull(texture); using ComputeContext context = device.CreateComputeContext(); @@ -148,7 +148,7 @@ public static partial class GraphicsDeviceExtensions /// public static ComputeContext CreateComputeContext(this GraphicsDevice device) { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); device.ThrowIfDisposed(); diff --git a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs index 41191701..e1c65de6 100644 --- a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs +++ b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs @@ -20,7 +20,7 @@ public static partial class GraphicsDeviceExtensions public static ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return new(device, length, allocationMode); } @@ -35,8 +35,8 @@ public static partial class GraphicsDeviceExtensions public static ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, T[] source) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateConstantBuffer(source.AsSpan()); } @@ -51,7 +51,7 @@ public static partial class GraphicsDeviceExtensions public static ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, ReadOnlySpan source) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); ConstantBuffer buffer = new(device, source.Length, AllocationMode.Default); @@ -70,8 +70,8 @@ public static partial class GraphicsDeviceExtensions public static ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, Buffer source) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); ConstantBuffer constantBuffer = new(device, source.Length, AllocationMode.Default); @@ -91,7 +91,7 @@ public static partial class GraphicsDeviceExtensions public static ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return new(device, length, allocationMode); } @@ -106,8 +106,8 @@ public static partial class GraphicsDeviceExtensions public static ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, T[] source) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateReadOnlyBuffer(source.AsSpan()); } @@ -122,7 +122,7 @@ public static partial class GraphicsDeviceExtensions public static ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, ReadOnlySpan source) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); ReadOnlyBuffer buffer = new(device, source.Length, AllocationMode.Default); @@ -141,8 +141,8 @@ public static partial class GraphicsDeviceExtensions public static ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, Buffer source) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); ReadOnlyBuffer readWriteBuffer = new(device, source.Length, AllocationMode.Default); @@ -163,7 +163,7 @@ public static partial class GraphicsDeviceExtensions public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, int width, int height, AllocationMode allocationMode = AllocationMode.Default) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return new(device, width, height, allocationMode); } @@ -180,8 +180,8 @@ public static partial class GraphicsDeviceExtensions public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[] source, int width, int height) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateReadOnlyTexture2D(source.AsSpan(), width, height); } @@ -199,8 +199,8 @@ public static partial class GraphicsDeviceExtensions public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[] source, int offset, int width, int height) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateReadOnlyTexture2D(source.AsSpan(offset), width, height); } @@ -215,8 +215,8 @@ public static partial class GraphicsDeviceExtensions public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[,] source) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); ReadOnlyTexture2D texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default); @@ -237,7 +237,7 @@ public static partial class GraphicsDeviceExtensions public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, ReadOnlySpan source, int width, int height) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); ReadOnlyTexture2D texture = new(device, width, height, AllocationMode.Default); @@ -260,7 +260,7 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return new(device, width, height, allocationMode); } @@ -279,8 +279,8 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateReadOnlyTexture2D(source.AsSpan(), width, height); } @@ -300,8 +300,8 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateReadOnlyTexture2D(source.AsSpan(offset), width, height); } @@ -318,8 +318,8 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); ReadOnlyTexture2D texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default); @@ -342,7 +342,7 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); ReadOnlyTexture2D texture = new(device, width, height, AllocationMode.Default); @@ -364,7 +364,7 @@ public static partial class GraphicsDeviceExtensions public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, int width, int height, int depth, AllocationMode allocationMode = AllocationMode.Default) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return new(device, width, height, depth, allocationMode); } @@ -382,8 +382,8 @@ public static partial class GraphicsDeviceExtensions public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[] source, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateReadOnlyTexture3D(source.AsSpan(), width, height, depth); } @@ -402,8 +402,8 @@ public static partial class GraphicsDeviceExtensions public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[] source, int offset, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateReadOnlyTexture3D(source.AsSpan(offset), width, height, depth); } @@ -422,8 +422,8 @@ public static partial class GraphicsDeviceExtensions public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[,,] source) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); ReadOnlyTexture3D texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default); @@ -445,7 +445,7 @@ public static partial class GraphicsDeviceExtensions public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, ReadOnlySpan source, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); ReadOnlyTexture3D texture = new(device, width, height, depth, AllocationMode.Default); @@ -469,7 +469,7 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return new(device, width, height, depth, allocationMode); } @@ -489,8 +489,8 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateReadOnlyTexture3D(source.AsSpan(), width, height, depth); } @@ -511,8 +511,8 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateReadOnlyTexture3D(source.AsSpan(offset), width, height, depth); } @@ -533,8 +533,8 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); ReadOnlyTexture3D texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default); @@ -558,7 +558,7 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); ReadOnlyTexture3D texture = new(device, width, height, depth, AllocationMode.Default); @@ -578,7 +578,7 @@ public static partial class GraphicsDeviceExtensions public static ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return new(device, length, allocationMode); } @@ -593,8 +593,8 @@ public static partial class GraphicsDeviceExtensions public static ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, T[] source) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateReadWriteBuffer(source.AsSpan()); } @@ -609,7 +609,7 @@ public static partial class GraphicsDeviceExtensions public static ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, ReadOnlySpan source) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); ReadWriteBuffer buffer = new(device, source.Length, AllocationMode.Default); @@ -628,8 +628,8 @@ public static partial class GraphicsDeviceExtensions public static ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, Buffer source) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); ReadWriteBuffer readWriteBuffer = new(device, source.Length, AllocationMode.Default); @@ -650,7 +650,7 @@ public static partial class GraphicsDeviceExtensions public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, int width, int height, AllocationMode allocationMode = AllocationMode.Default) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return new(device, width, height, allocationMode); } @@ -667,8 +667,8 @@ public static partial class GraphicsDeviceExtensions public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[] source, int width, int height) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateReadWriteTexture2D(source.AsSpan(), width, height); } @@ -686,8 +686,8 @@ public static partial class GraphicsDeviceExtensions public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[] source, int offset, int width, int height) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateReadWriteTexture2D(source.AsSpan(offset), width, height); } @@ -702,8 +702,8 @@ public static partial class GraphicsDeviceExtensions public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[,] source) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); ReadWriteTexture2D texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default); @@ -724,7 +724,7 @@ public static partial class GraphicsDeviceExtensions public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, ReadOnlySpan source, int width, int height) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); ReadWriteTexture2D texture = new(device, width, height, AllocationMode.Default); @@ -747,7 +747,7 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return new(device, width, height, allocationMode); } @@ -766,8 +766,8 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateReadWriteTexture2D(source.AsSpan(), width, height); } @@ -787,8 +787,8 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateReadWriteTexture2D(source.AsSpan(offset), width, height); } @@ -805,8 +805,8 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); ReadWriteTexture2D texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default); @@ -829,7 +829,7 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); ReadWriteTexture2D texture = new(device, width, height, AllocationMode.Default); @@ -851,7 +851,7 @@ public static partial class GraphicsDeviceExtensions public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, int width, int height, int depth, AllocationMode allocationMode = AllocationMode.Default) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return new(device, width, height, depth, allocationMode); } @@ -869,8 +869,8 @@ public static partial class GraphicsDeviceExtensions public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[] source, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateReadWriteTexture3D(source.AsSpan(), width, height, depth); } @@ -889,8 +889,8 @@ public static partial class GraphicsDeviceExtensions public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[] source, int offset, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateReadWriteTexture3D(source.AsSpan(offset), width, height, depth); } @@ -909,8 +909,8 @@ public static partial class GraphicsDeviceExtensions public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[,,] source) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); ReadWriteTexture3D texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default); @@ -932,7 +932,7 @@ public static partial class GraphicsDeviceExtensions public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, ReadOnlySpan source, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); ReadWriteTexture3D texture = new(device, width, height, depth, AllocationMode.Default); @@ -956,7 +956,7 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return new(device, width, height, depth, allocationMode); } @@ -976,8 +976,8 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateReadWriteTexture3D(source.AsSpan(), width, height, depth); } @@ -998,8 +998,8 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); return device.AllocateReadWriteTexture3D(source.AsSpan(offset), width, height, depth); } @@ -1020,8 +1020,8 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(device); + Guard.IsNotNull(source); ReadWriteTexture3D texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default); @@ -1045,7 +1045,7 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); ReadWriteTexture3D texture = new(device, width, height, depth, AllocationMode.Default); @@ -1065,7 +1065,7 @@ public static partial class GraphicsDeviceExtensions public static UploadBuffer AllocateUploadBuffer(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return new(device, length, allocationMode); } @@ -1082,7 +1082,7 @@ public static partial class GraphicsDeviceExtensions public static UploadTexture2D AllocateUploadTexture2D(this GraphicsDevice device, int width, int height, AllocationMode allocationMode = AllocationMode.Default) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return new(device, width, height, allocationMode); } @@ -1100,7 +1100,7 @@ public static partial class GraphicsDeviceExtensions public static UploadTexture3D AllocateUploadTexture3D(this GraphicsDevice device, int width, int height, int depth, AllocationMode allocationMode = AllocationMode.Default) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return new(device, width, height, depth, allocationMode); } @@ -1116,7 +1116,7 @@ public static partial class GraphicsDeviceExtensions public static ReadBackBuffer AllocateReadBackBuffer(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return new(device, length, allocationMode); } @@ -1133,7 +1133,7 @@ public static partial class GraphicsDeviceExtensions public static ReadBackTexture2D AllocateReadBackTexture2D(this GraphicsDevice device, int width, int height, AllocationMode allocationMode = AllocationMode.Default) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return new(device, width, height, allocationMode); } @@ -1151,7 +1151,7 @@ public static partial class GraphicsDeviceExtensions public static ReadBackTexture3D AllocateReadBackTexture3D(this GraphicsDevice device, int width, int height, int depth, AllocationMode allocationMode = AllocationMode.Default) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return new(device, width, height, depth, allocationMode); } @@ -1168,8 +1168,8 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(filename, nameof(filename)); + Guard.IsNotNull(device); + Guard.IsNotNull(filename); return device.LoadReadOnlyTexture2D(filename.AsSpan()); } @@ -1186,7 +1186,7 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); using UploadTexture2D upload = WICHelper.Instance.LoadTexture(device, filename); @@ -1209,7 +1209,7 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); using UploadTexture2D upload = WICHelper.Instance.LoadTexture(device, span); @@ -1232,8 +1232,8 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(stream, nameof(stream)); + Guard.IsNotNull(device); + Guard.IsNotNull(stream); using UploadTexture2D upload = WICHelper.Instance.LoadTexture(device, stream); @@ -1256,8 +1256,8 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(filename, nameof(filename)); + Guard.IsNotNull(device); + Guard.IsNotNull(filename); return device.LoadReadWriteTexture2D(filename.AsSpan()); } @@ -1274,7 +1274,7 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); using UploadTexture2D upload = WICHelper.Instance.LoadTexture(device, filename); @@ -1297,7 +1297,7 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); using UploadTexture2D upload = WICHelper.Instance.LoadTexture(device, span); @@ -1320,8 +1320,8 @@ public static partial class GraphicsDeviceExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(stream, nameof(stream)); + Guard.IsNotNull(device); + Guard.IsNotNull(stream); using UploadTexture2D upload = WICHelper.Instance.LoadTexture(device, stream); @@ -1342,8 +1342,8 @@ public static partial class GraphicsDeviceExtensions public static UploadTexture2D LoadUploadTexture2D(this GraphicsDevice device, string filename) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(filename, nameof(filename)); + Guard.IsNotNull(device); + Guard.IsNotNull(filename); return device.LoadUploadTexture2D(filename.AsSpan()); } @@ -1358,7 +1358,7 @@ public static partial class GraphicsDeviceExtensions public static UploadTexture2D LoadUploadTexture2D(this GraphicsDevice device, ReadOnlySpan filename) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return WICHelper.Instance.LoadTexture(device, filename); } @@ -1373,7 +1373,7 @@ public static partial class GraphicsDeviceExtensions public static UploadTexture2D LoadUploadTexture2D(this GraphicsDevice device, ReadOnlySpan span) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); + Guard.IsNotNull(device); return WICHelper.Instance.LoadTexture(device, span); } @@ -1388,8 +1388,8 @@ public static partial class GraphicsDeviceExtensions public static UploadTexture2D LoadUploadTexture2D(this GraphicsDevice device, Stream stream) where T : unmanaged { - Guard.IsNotNull(device, nameof(device)); - Guard.IsNotNull(stream, nameof(stream)); + Guard.IsNotNull(device); + Guard.IsNotNull(stream); return WICHelper.Instance.LoadTexture(device, stream); } diff --git a/src/ComputeSharp/Graphics/Extensions/ReadBackBufferExtensions.cs b/src/ComputeSharp/Graphics/Extensions/ReadBackBufferExtensions.cs index 84a4feed..0940cf5d 100644 --- a/src/ComputeSharp/Graphics/Extensions/ReadBackBufferExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/ReadBackBufferExtensions.cs @@ -17,8 +17,8 @@ public static class ReadBackBufferExtensions public static void CopyFrom(this ReadBackBuffer destination, StructuredBuffer source) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); source.CopyTo(destination, 0, 0, source.Length); } @@ -35,8 +35,8 @@ public static class ReadBackBufferExtensions public static void CopyFrom(this ReadBackBuffer destination, StructuredBuffer source, int sourceOffset, int destinationOffset, int count) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); source.CopyTo(destination, sourceOffset, destinationOffset, count); } diff --git a/src/ComputeSharp/Graphics/Extensions/ReadBackTexture2DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/ReadBackTexture2DExtensions.cs index 92a56aaa..1d54bc19 100644 --- a/src/ComputeSharp/Graphics/Extensions/ReadBackTexture2DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/ReadBackTexture2DExtensions.cs @@ -21,8 +21,8 @@ public static class ReadBackTexture2DExtensions public static void CopyFrom(this ReadBackTexture2D destination, Texture2D source) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); source.CopyTo(destination, 0, 0, 0, 0, source.Width, source.Height); } @@ -40,8 +40,8 @@ public static class ReadBackTexture2DExtensions public static void CopyFrom(this ReadBackTexture2D destination, Texture2D source, int sourceOffsetX, int sourceOffsetY, int width, int height) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); source.CopyTo(destination, sourceOffsetX, sourceOffsetY, 0, 0, width, height); } @@ -61,8 +61,8 @@ public static class ReadBackTexture2DExtensions public static void CopyFrom(this ReadBackTexture2D destination, Texture2D source, int sourceOffsetX, int sourceOffsetY, int destinationOffsetX, int destinationOffsetY, int width, int height) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); source.CopyTo(destination, sourceOffsetX, sourceOffsetY, destinationOffsetX, destinationOffsetY, width, height); } @@ -76,8 +76,8 @@ public static class ReadBackTexture2DExtensions public static void Save(this ReadBackTexture2D texture, string filename) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); - Guard.IsNotNull(filename, nameof(filename)); + Guard.IsNotNull(texture); + Guard.IsNotNull(filename); WICHelper.Instance.SaveTexture(texture.View, filename.AsSpan()); } @@ -91,7 +91,7 @@ public static class ReadBackTexture2DExtensions public static void Save(this ReadBackTexture2D texture, ReadOnlySpan filename) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); WICHelper.Instance.SaveTexture(texture.View, filename); } @@ -106,8 +106,8 @@ public static class ReadBackTexture2DExtensions public static void Save(this ReadBackTexture2D texture, Stream stream, ImageFormat format) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); - Guard.IsNotNull(stream, nameof(stream)); + Guard.IsNotNull(texture); + Guard.IsNotNull(stream); WICHelper.Instance.SaveTexture(texture.View, stream, format); } @@ -122,8 +122,8 @@ public static class ReadBackTexture2DExtensions public static void Save(this ReadBackTexture2D texture, IBufferWriter writer, ImageFormat format) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); - Guard.IsNotNull(writer, nameof(writer)); + Guard.IsNotNull(texture); + Guard.IsNotNull(writer); WICHelper.Instance.SaveTexture(texture.View, writer, format); } diff --git a/src/ComputeSharp/Graphics/Extensions/ReadBackTexture3DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/ReadBackTexture3DExtensions.cs index 24ce19f3..76d35750 100644 --- a/src/ComputeSharp/Graphics/Extensions/ReadBackTexture3DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/ReadBackTexture3DExtensions.cs @@ -17,8 +17,8 @@ public static class ReadBackTexture3DExtensions public static void CopyFrom(this ReadBackTexture3D destination, Texture3D source) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); source.CopyTo(destination, 0, 0, 0, 0, 0, 0, source.Width, source.Height, source.Depth); } @@ -38,8 +38,8 @@ public static class ReadBackTexture3DExtensions public static void CopyFrom(this ReadBackTexture3D destination, Texture3D source, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); source.CopyTo(destination, sourceOffsetX, sourceOffsetY, sourceOffsetZ, 0, 0, 0, width, height, depth); } @@ -62,8 +62,8 @@ public static class ReadBackTexture3DExtensions public static void CopyFrom(this ReadBackTexture3D destination, Texture3D source, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int destinationOffsetX, int destinationOffsetY, int destinationOffsetZ, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); source.CopyTo(destination, sourceOffsetX, sourceOffsetY, sourceOffsetZ, destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth); } diff --git a/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture2DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture2DExtensions.cs index 2111ba5a..f301580f 100644 --- a/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture2DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture2DExtensions.cs @@ -29,7 +29,7 @@ public static class ReadWriteTexture2DExtensions /// Thrown if the current instance is not in a readonly state. public static IReadOnlyTexture2D AsReadOnly(this ReadWriteTexture2D texture) { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); return texture.AsReadOnly(); } @@ -55,7 +55,7 @@ public static class ReadWriteTexture2DExtensions /// Thrown if the current instance is not in a readonly state. public static IReadOnlyTexture2D AsReadOnly(this ReadWriteTexture2D texture) { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); return texture.AsReadOnly(); } @@ -81,7 +81,7 @@ public static class ReadWriteTexture2DExtensions /// Thrown if the current instance is not in a readonly state. public static IReadOnlyTexture2D AsReadOnly(this ReadWriteTexture2D texture) { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); return texture.AsReadOnly(); } @@ -107,7 +107,7 @@ public static class ReadWriteTexture2DExtensions /// Thrown if the current instance is not in a readonly state. public static IReadOnlyTexture2D AsReadOnly(this ReadWriteTexture2D texture) { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); return texture.AsReadOnly(); } @@ -137,7 +137,7 @@ public static class ReadWriteTexture2DExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); return texture.AsReadOnly(); } diff --git a/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture3DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture3DExtensions.cs index ad175807..3bb33cfd 100644 --- a/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture3DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture3DExtensions.cs @@ -29,7 +29,7 @@ public static class ReadWriteTexture3DExtensions /// Thrown if the current instance is not in a readonly state. public static IReadOnlyTexture3D AsReadOnly(this ReadWriteTexture3D texture) { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); return texture.AsReadOnly(); } @@ -55,7 +55,7 @@ public static class ReadWriteTexture3DExtensions /// Thrown if the current instance is not in a readonly state. public static IReadOnlyTexture3D AsReadOnly(this ReadWriteTexture3D texture) { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); return texture.AsReadOnly(); } @@ -81,7 +81,7 @@ public static class ReadWriteTexture3DExtensions /// Thrown if the current instance is not in a readonly state. public static IReadOnlyTexture3D AsReadOnly(this ReadWriteTexture3D texture) { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); return texture.AsReadOnly(); } @@ -107,7 +107,7 @@ public static class ReadWriteTexture3DExtensions /// Thrown if the current instance is not in a readonly state. public static IReadOnlyTexture3D AsReadOnly(this ReadWriteTexture3D texture) { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); return texture.AsReadOnly(); } @@ -137,7 +137,7 @@ public static class ReadWriteTexture3DExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); return texture.AsReadOnly(); } diff --git a/src/ComputeSharp/Graphics/Extensions/StructuredBufferExtensions.cs b/src/ComputeSharp/Graphics/Extensions/StructuredBufferExtensions.cs index f9ffe67a..1166042e 100644 --- a/src/ComputeSharp/Graphics/Extensions/StructuredBufferExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/StructuredBufferExtensions.cs @@ -17,8 +17,8 @@ public static class StructuredBufferExtensions public static void CopyTo(this StructuredBuffer source, ReadBackBuffer destination) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination, 0, 0, source.Length); } @@ -35,8 +35,8 @@ public static class StructuredBufferExtensions public static void CopyTo(this StructuredBuffer source, ReadBackBuffer destination, int sourceOffset, int destinationOffset, int count) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination, sourceOffset, destinationOffset, count); } @@ -50,8 +50,8 @@ public static class StructuredBufferExtensions public static void CopyFrom(this StructuredBuffer destination, UploadBuffer source) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); source.CopyTo(destination, 0, 0, source.Length); } @@ -68,8 +68,8 @@ public static class StructuredBufferExtensions public static void CopyFrom(this StructuredBuffer destination, UploadBuffer source, int sourceOffset, int destinationOffset, int count) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); source.CopyTo(destination, sourceOffset, destinationOffset, count); } diff --git a/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs index 8e829035..68b845c5 100644 --- a/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs @@ -22,7 +22,7 @@ public static class Texture2DExtensions public static T[,] ToArray(this Texture2D source) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(source); T[,] data = new T[source.Height, source.Width]; @@ -44,9 +44,9 @@ public static class Texture2DExtensions public static unsafe T[,] ToArray(this Texture2D source, int x, int y, int width, int height) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsGreaterThanOrEqualTo(width, 0, nameof(width)); - Guard.IsGreaterThanOrEqualTo(height, 0, nameof(height)); + Guard.IsNotNull(source); + Guard.IsGreaterThanOrEqualTo(width, 0); + Guard.IsGreaterThanOrEqualTo(height, 0); T[,] data = new T[height, width]; @@ -67,8 +67,8 @@ public static class Texture2DExtensions public static void CopyTo(this Texture2D source, T[,] destination) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); Guard.IsEqualTo(destination.GetLength(0), source.Height, nameof(destination)); Guard.IsEqualTo(destination.GetLength(1), source.Width, nameof(destination)); @@ -84,8 +84,8 @@ public static class Texture2DExtensions public static void CopyTo(this Texture2D source, T[] destination) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination.AsSpan(), 0, 0, source.Width, source.Height); } @@ -102,8 +102,8 @@ public static class Texture2DExtensions public static void CopyTo(this Texture2D source, T[] destination, Range x, Range y) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination.AsSpan(), x, y); } @@ -122,8 +122,8 @@ public static class Texture2DExtensions public static void CopyTo(this Texture2D source, T[] destination, int sourceOffsetX, int sourceOffsetY, int width, int height) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination.AsSpan(), sourceOffsetX, sourceOffsetY, width, height); } @@ -138,8 +138,8 @@ public static class Texture2DExtensions public static void CopyTo(this Texture2D source, T[] destination, int destinationOffset) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination.AsSpan(destinationOffset), 0, 0, source.Width, source.Height); } @@ -157,8 +157,8 @@ public static class Texture2DExtensions public static void CopyTo(this Texture2D source, T[] destination, int destinationOffset, Range x, Range y) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination.AsSpan(destinationOffset), x, y); } @@ -178,8 +178,8 @@ public static class Texture2DExtensions public static void CopyTo(this Texture2D source, T[] destination, int destinationOffset, int sourceOffsetX, int sourceOffsetY, int width, int height) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination.AsSpan(destinationOffset), sourceOffsetX, sourceOffsetY, width, height); } @@ -194,7 +194,7 @@ public static class Texture2DExtensions public static void CopyTo(this Texture2D source, Span destination) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(source); source.CopyTo(destination, 0, 0, source.Width, source.Height); } @@ -211,7 +211,7 @@ public static class Texture2DExtensions public static void CopyTo(this Texture2D source, Span destination, Range x, Range y) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(source); var (offsetX, width) = x.GetOffsetAndLength(source.Width); var (offsetY, height) = y.GetOffsetAndLength(source.Height); @@ -233,7 +233,7 @@ public static class Texture2DExtensions public static void CopyTo(this Texture2D source, Span destination, int sourceOffsetX, int sourceOffsetY, int width, int height) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(source); source.CopyTo(ref MemoryMarshal.GetReference(destination), destination.Length, sourceOffsetX, sourceOffsetY, width, height); } @@ -247,8 +247,8 @@ public static class Texture2DExtensions public static void CopyTo(this Texture2D source, Texture2D destination) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination, 0, 0, 0, 0, source.Width, source.Height); } @@ -266,8 +266,8 @@ public static class Texture2DExtensions public static void CopyTo(this Texture2D source, Texture2D destination, int sourceOffsetX, int sourceOffsetY, int width, int height) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination, sourceOffsetX, sourceOffsetY, 0, 0, width, height); } @@ -287,8 +287,8 @@ public static class Texture2DExtensions public static void CopyTo(this Texture2D source, Texture2D destination, int sourceOffsetX, int sourceOffsetY, int destinationOffsetX, int destinationOffsetY, int width, int height) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination, sourceOffsetX, sourceOffsetY, destinationOffsetX, destinationOffsetY, width, height); } @@ -302,8 +302,8 @@ public static class Texture2DExtensions public static void CopyTo(this Texture2D source, ReadBackTexture2D destination) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination, 0, 0, 0, 0, source.Width, source.Height); } @@ -321,8 +321,8 @@ public static class Texture2DExtensions public static void CopyTo(this Texture2D source, ReadBackTexture2D destination, int sourceOffsetX, int sourceOffsetY, int width, int height) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination, sourceOffsetX, sourceOffsetY, 0, 0, width, height); } @@ -342,8 +342,8 @@ public static class Texture2DExtensions public static void CopyTo(this Texture2D source, ReadBackTexture2D destination, int sourceOffsetX, int sourceOffsetY, int destinationOffsetX, int destinationOffsetY, int width, int height) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination, sourceOffsetX, sourceOffsetY, destinationOffsetX, destinationOffsetY, width, height); } @@ -357,8 +357,8 @@ public static class Texture2DExtensions public static unsafe void CopyFrom(this Texture2D destination, T[,] source) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); Guard.IsEqualTo(source.GetLength(0), destination.Height, nameof(source)); Guard.IsEqualTo(source.GetLength(1), destination.Width, nameof(source)); @@ -374,8 +374,8 @@ public static class Texture2DExtensions public static void CopyFrom(this Texture2D destination, T[] source) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); destination.CopyFrom(source.AsSpan(), 0, 0, destination.Width, destination.Height); } @@ -392,8 +392,8 @@ public static class Texture2DExtensions public static void CopyFrom(this Texture2D destination, T[] source, Range x, Range y) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); destination.CopyFrom(source.AsSpan(), x, y); } @@ -412,8 +412,8 @@ public static class Texture2DExtensions public static void CopyFrom(this Texture2D destination, T[] source, int destinationOffsetX, int destinationOffsetY, int width, int height) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); destination.CopyFrom(source.AsSpan(), destinationOffsetX, destinationOffsetY, width, height); } @@ -431,8 +431,8 @@ public static class Texture2DExtensions public static void CopyFrom(this Texture2D destination, T[] source, int sourceOffset, Range x, Range y) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); destination.CopyFrom(source.AsSpan(sourceOffset), x, y); } @@ -452,8 +452,8 @@ public static class Texture2DExtensions public static void CopyFrom(this Texture2D destination, T[] source, int sourceOffset, int destinationOffsetX, int destinationOffsetY, int width, int height) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); destination.CopyFrom(source.AsSpan(sourceOffset), destinationOffsetX, destinationOffsetY, width, height); } @@ -468,7 +468,7 @@ public static class Texture2DExtensions public static void CopyFrom(this Texture2D destination, ReadOnlySpan source) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(destination); destination.CopyFrom(source, 0, 0, destination.Width, destination.Height); } @@ -485,7 +485,7 @@ public static class Texture2DExtensions public static void CopyFrom(this Texture2D destination, ReadOnlySpan source, Range x, Range y) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(destination); var (offsetX, width) = x.GetOffsetAndLength(destination.Width); var (offsetY, height) = y.GetOffsetAndLength(destination.Height); @@ -507,7 +507,7 @@ public static class Texture2DExtensions public static void CopyFrom(this Texture2D destination, ReadOnlySpan source, int destinationOffsetX, int destinationOffsetY, int width, int height) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(destination); destination.CopyFrom(ref MemoryMarshal.GetReference(source), source.Length, destinationOffsetX, destinationOffsetY, width, height); } @@ -521,8 +521,8 @@ public static class Texture2DExtensions public static void CopyFrom(this Texture2D destination, Texture2D source) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); destination.CopyFrom(source, 0, 0, 0, 0, source.Width, source.Height); } @@ -540,8 +540,8 @@ public static class Texture2DExtensions public static void CopyFrom(this Texture2D destination, Texture2D source, int sourceOffsetX, int sourceOffsetY, int width, int height) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); source.CopyTo(destination, sourceOffsetX, sourceOffsetY, 0, 0, width, height); } @@ -561,8 +561,8 @@ public static class Texture2DExtensions public static void CopyFrom(this Texture2D destination, Texture2D source, int sourceOffsetX, int sourceOffsetY, int destinationOffsetX, int destinationOffsetY, int width, int height) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); source.CopyTo(destination, sourceOffsetX, sourceOffsetY, destinationOffsetX, destinationOffsetY, width, height); } @@ -576,8 +576,8 @@ public static class Texture2DExtensions public static void CopyFrom(this Texture2D destination, UploadTexture2D source) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); source.CopyTo(destination, 0, 0, 0, 0, source.Width, source.Height); } @@ -595,8 +595,8 @@ public static class Texture2DExtensions public static void CopyFrom(this Texture2D destination, UploadTexture2D source, int sourceOffsetX, int sourceOffsetY, int width, int height) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, 0, 0, width, height); } @@ -616,8 +616,8 @@ public static class Texture2DExtensions public static void CopyFrom(this Texture2D destination, UploadTexture2D source, int sourceOffsetX, int sourceOffsetY, int destinationOffsetX, int destinationOffsetY, int width, int height) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, destinationOffsetX, destinationOffsetY, width, height); } @@ -631,8 +631,8 @@ public static class Texture2DExtensions public static void Save(this Texture2D texture, string filename) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); - Guard.IsNotNull(filename, nameof(filename)); + Guard.IsNotNull(texture); + Guard.IsNotNull(filename); texture.Save(filename.AsSpan()); } @@ -646,7 +646,7 @@ public static class Texture2DExtensions public static void Save(this Texture2D texture, ReadOnlySpan filename) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); using ReadBackTexture2D readback = texture.GraphicsDevice.AllocateReadBackTexture2D(texture.Width, texture.Height); @@ -665,8 +665,8 @@ public static class Texture2DExtensions public static void Save(this Texture2D texture, Stream stream, ImageFormat format) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); - Guard.IsNotNull(stream, nameof(stream)); + Guard.IsNotNull(texture); + Guard.IsNotNull(stream); using ReadBackTexture2D readback = texture.GraphicsDevice.AllocateReadBackTexture2D(texture.Width, texture.Height); @@ -685,8 +685,8 @@ public static class Texture2DExtensions public static void Save(this Texture2D texture, IBufferWriter writer, ImageFormat format) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); - Guard.IsNotNull(writer, nameof(writer)); + Guard.IsNotNull(texture); + Guard.IsNotNull(writer); using ReadBackTexture2D readback = texture.GraphicsDevice.AllocateReadBackTexture2D(texture.Width, texture.Height); diff --git a/src/ComputeSharp/Graphics/Extensions/Texture3DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Texture3DExtensions.cs index ce0fc51c..1693ecf9 100644 --- a/src/ComputeSharp/Graphics/Extensions/Texture3DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Texture3DExtensions.cs @@ -24,7 +24,7 @@ public static class Texture3DExtensions public static T[,,] ToArray(this Texture3D source) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(source); T[,,] data = new T[source.Depth, source.Height, source.Width]; @@ -48,10 +48,10 @@ public static class Texture3DExtensions public static unsafe T[,,] ToArray(this Texture3D source, int x, int y, int z, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsGreaterThanOrEqualTo(width, 0, nameof(width)); - Guard.IsGreaterThanOrEqualTo(height, 0, nameof(height)); - Guard.IsGreaterThanOrEqualTo(depth, 0, nameof(depth)); + Guard.IsNotNull(source); + Guard.IsGreaterThanOrEqualTo(width, 0); + Guard.IsGreaterThanOrEqualTo(height, 0); + Guard.IsGreaterThanOrEqualTo(depth, 0); T[,,] data = new T[depth, height, width]; @@ -76,8 +76,8 @@ public static class Texture3DExtensions public static void CopyTo(this Texture3D source, T[,,] destination) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); Guard.IsEqualTo(destination.GetLength(0), source.Depth, nameof(destination)); Guard.IsEqualTo(destination.GetLength(1), source.Height, nameof(destination)); Guard.IsEqualTo(destination.GetLength(2), source.Width, nameof(destination)); @@ -95,8 +95,8 @@ public static class Texture3DExtensions public static void CopyTo(this Texture3D source, T[] destination, int destinationOffset) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination.AsSpan(destinationOffset), 0, 0, 0, source.Width, source.Height, source.Depth); } @@ -115,8 +115,8 @@ public static class Texture3DExtensions public static void CopyTo(this Texture3D source, T[] destination, int destinationOffset, Range x, Range y, Range z) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination.AsSpan(destinationOffset), x, y, z); } @@ -138,8 +138,8 @@ public static class Texture3DExtensions public static void CopyTo(this Texture3D source, T[] destination, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int destinationOffset, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination.AsSpan(destinationOffset), sourceOffsetX, sourceOffsetY, sourceOffsetZ, width, height, depth); } @@ -153,7 +153,7 @@ public static class Texture3DExtensions public static void CopyTo(this Texture3D source, Span destination) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(source); source.CopyTo(destination, 0, 0, 0, source.Width, source.Height, source.Depth); } @@ -171,7 +171,7 @@ public static class Texture3DExtensions public static void CopyTo(this Texture3D source, Span destination, Range x, Range y, Range z) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(source); var (offsetX, width) = x.GetOffsetAndLength(source.Width); var (offsetY, height) = y.GetOffsetAndLength(source.Height); @@ -196,7 +196,7 @@ public static class Texture3DExtensions public static void CopyTo(this Texture3D source, Span destination, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(source); source.CopyTo(ref MemoryMarshal.GetReference(destination), destination.Length, sourceOffsetX, sourceOffsetY, sourceOffsetZ, width, height, depth); } @@ -210,8 +210,8 @@ public static class Texture3DExtensions public static void CopyTo(this Texture3D source, Texture3D destination) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination, 0, 0, 0, 0, 0, 0, source.Width, source.Height, source.Depth); } @@ -231,8 +231,8 @@ public static class Texture3DExtensions public static void CopyTo(this Texture3D source, Texture3D destination, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination, sourceOffsetX, sourceOffsetY, sourceOffsetZ, 0, 0, 0, width, height, depth); } @@ -255,8 +255,8 @@ public static class Texture3DExtensions public static void CopyTo(this Texture3D source, Texture3D destination, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int destinationOffsetX, int destinationOffsetY, int destinationOffsetZ, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination, sourceOffsetX, sourceOffsetY, sourceOffsetZ, destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth); } @@ -270,8 +270,8 @@ public static class Texture3DExtensions public static void CopyTo(this Texture3D source, ReadBackTexture3D destination) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination, 0, 0, 0, 0, 0, 0, source.Width, source.Height, source.Depth); } @@ -291,8 +291,8 @@ public static class Texture3DExtensions public static void CopyTo(this Texture3D source, ReadBackTexture3D destination, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination, sourceOffsetX, sourceOffsetY, sourceOffsetZ, 0, 0, 0, width, height, depth); } @@ -315,8 +315,8 @@ public static class Texture3DExtensions public static void CopyTo(this Texture3D source, ReadBackTexture3D destination, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int destinationOffsetX, int destinationOffsetY, int destinationOffsetZ, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); source.CopyTo(destination, sourceOffsetX, sourceOffsetY, sourceOffsetZ, destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth); } @@ -334,8 +334,8 @@ public static class Texture3DExtensions public static void CopyFrom(this Texture3D destination, T[,,] source) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); Guard.IsEqualTo(source.GetLength(0), destination.Depth, nameof(source)); Guard.IsEqualTo(source.GetLength(1), destination.Height, nameof(source)); Guard.IsEqualTo(source.GetLength(2), destination.Width, nameof(source)); @@ -352,8 +352,8 @@ public static class Texture3DExtensions public static void CopyFrom(this Texture3D destination, T[] source) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); destination.CopyFrom(source.AsSpan(), 0, 0, 0, destination.Width, destination.Height, destination.Depth); } @@ -371,8 +371,8 @@ public static class Texture3DExtensions public static void CopyFrom(this Texture3D destination, T[] source, Range x, Range y, Range z) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); destination.CopyFrom(source.AsSpan(), x, y, z); } @@ -393,8 +393,8 @@ public static class Texture3DExtensions public static void CopyFrom(this Texture3D destination, T[] source, int destinationOffsetX, int destinationOffsetY, int destinationOffsetZ, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); destination.CopyFrom(source.AsSpan(), destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth); } @@ -413,8 +413,8 @@ public static class Texture3DExtensions public static void CopyFrom(this Texture3D destination, T[] source, int sourceOffset, Range x, Range y, Range z) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); destination.CopyFrom(source.AsSpan(sourceOffset), x, y, z); } @@ -436,8 +436,8 @@ public static class Texture3DExtensions public static void CopyFrom(this Texture3D destination, T[] source, int sourceOffset, int destinationOffsetX, int destinationOffsetY, int destinationOffsetZ, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); destination.CopyFrom(source.AsSpan(sourceOffset), destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth); } @@ -452,7 +452,7 @@ public static class Texture3DExtensions public static void CopyFrom(this Texture3D destination, ReadOnlySpan source) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(destination); destination.CopyFrom(source, 0, 0, 0, destination.Width, destination.Height, destination.Depth); } @@ -470,7 +470,7 @@ public static class Texture3DExtensions public static void CopyFrom(this Texture3D destination, ReadOnlySpan source, Range x, Range y, Range z) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(destination); var (offsetX, width) = x.GetOffsetAndLength(destination.Width); var (offsetY, height) = y.GetOffsetAndLength(destination.Height); @@ -495,7 +495,7 @@ public static class Texture3DExtensions public static void CopyFrom(this Texture3D destination, ReadOnlySpan source, int destinationOffsetX, int destinationOffsetY, int destinationOffsetZ, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(destination); destination.CopyFrom(ref MemoryMarshal.GetReference(source), source.Length, destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth); } @@ -509,8 +509,8 @@ public static class Texture3DExtensions public static void CopyFrom(this Texture3D destination, Texture3D source) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); source.CopyTo(destination, 0, 0, 0, 0, 0, 0, source.Width, source.Height, source.Depth); } @@ -530,8 +530,8 @@ public static class Texture3DExtensions public static void CopyFrom(this Texture3D destination, Texture3D source, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); source.CopyTo(destination, sourceOffsetX, sourceOffsetY, sourceOffsetZ, 0, 0, 0, width, height, depth); } @@ -554,8 +554,8 @@ public static class Texture3DExtensions public static void CopyFrom(this Texture3D destination, Texture3D source, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int destinationOffsetX, int destinationOffsetY, int destinationOffsetZ, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); source.CopyTo(destination, sourceOffsetX, sourceOffsetY, sourceOffsetZ, destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth); } @@ -569,8 +569,8 @@ public static class Texture3DExtensions public static void CopyFrom(this Texture3D destination, UploadTexture3D source) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); destination.CopyFrom(source, 0, 0, 0, 0, 0, 0, source.Width, source.Height, source.Depth); } @@ -590,8 +590,8 @@ public static class Texture3DExtensions public static void CopyFrom(this Texture3D destination, UploadTexture3D source, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, sourceOffsetZ, 0, 0, 0, width, height, depth); } @@ -614,8 +614,8 @@ public static class Texture3DExtensions public static void CopyFrom(this Texture3D destination, UploadTexture3D source, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int destinationOffsetX, int destinationOffsetY, int destinationOffsetZ, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(destination, nameof(destination)); - Guard.IsNotNull(source, nameof(source)); + Guard.IsNotNull(destination); + Guard.IsNotNull(source); destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, sourceOffsetZ, destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth); } diff --git a/src/ComputeSharp/Graphics/Extensions/UploadBufferExtensions.cs b/src/ComputeSharp/Graphics/Extensions/UploadBufferExtensions.cs index 7ddc84b2..118eeb9e 100644 --- a/src/ComputeSharp/Graphics/Extensions/UploadBufferExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/UploadBufferExtensions.cs @@ -17,8 +17,8 @@ public static class UploadBufferExtensions public static void CopyTo(this UploadBuffer source, StructuredBuffer destination) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); destination.CopyFrom(source, 0, 0, source.Length); } @@ -35,8 +35,8 @@ public static class UploadBufferExtensions public static void CopyTo(this UploadBuffer source, StructuredBuffer destination, int sourceOffset, int destinationOffset, int count) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); destination.CopyFrom(source, sourceOffset, destinationOffset, count); } diff --git a/src/ComputeSharp/Graphics/Extensions/UploadTexture2DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/UploadTexture2DExtensions.cs index 6c594494..1cd16e05 100644 --- a/src/ComputeSharp/Graphics/Extensions/UploadTexture2DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/UploadTexture2DExtensions.cs @@ -20,8 +20,8 @@ public static class UploadTexture2DExtensions public static void CopyTo(this UploadTexture2D source, Texture2D destination) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); destination.CopyFrom(source, 0, 0, 0, 0, source.Width, source.Height); } @@ -39,8 +39,8 @@ public static class UploadTexture2DExtensions public static void CopyTo(this UploadTexture2D source, Texture2D destination, int sourceOffsetX, int sourceOffsetY, int width, int height) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, 0, 0, width, height); } @@ -60,8 +60,8 @@ public static class UploadTexture2DExtensions public static void CopyTo(this UploadTexture2D source, Texture2D destination, int sourceOffsetX, int sourceOffsetY, int destinationOffsetX, int destinationOffsetY, int width, int height) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, destinationOffsetX, destinationOffsetY, width, height); } @@ -75,8 +75,8 @@ public static class UploadTexture2DExtensions public static void Load(this UploadTexture2D texture, string filename) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); - Guard.IsNotNull(filename, nameof(filename)); + Guard.IsNotNull(texture); + Guard.IsNotNull(filename); texture. Load(filename.AsSpan()); } @@ -90,7 +90,7 @@ public static class UploadTexture2DExtensions public static void Load(this UploadTexture2D texture, ReadOnlySpan filename) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); WICHelper.Instance.LoadTexture(texture.View, filename); } @@ -105,7 +105,7 @@ public static class UploadTexture2DExtensions public static void Load(this UploadTexture2D texture, ReadOnlySpan span) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); WICHelper.Instance.LoadTexture(texture.View, span); } @@ -119,8 +119,8 @@ public static class UploadTexture2DExtensions public static void Load(this UploadTexture2D texture, Stream stream) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); - Guard.IsNotNull(stream, nameof(stream)); + Guard.IsNotNull(texture); + Guard.IsNotNull(stream); WICHelper.Instance.LoadTexture(texture.View, stream); } diff --git a/src/ComputeSharp/Graphics/Extensions/UploadTexture3DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/UploadTexture3DExtensions.cs index 5837085e..43e54cbc 100644 --- a/src/ComputeSharp/Graphics/Extensions/UploadTexture3DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/UploadTexture3DExtensions.cs @@ -17,8 +17,8 @@ public static class UploadTexture3DExtensions public static void CopyTo(this UploadTexture3D source, Texture3D destination) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); destination.CopyFrom(source, 0, 0, 0, 0, 0, 0, source.Width, source.Height, source.Depth); } @@ -38,8 +38,8 @@ public static class UploadTexture3DExtensions public static void CopyTo(this UploadTexture3D source, Texture3D destination, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, sourceOffsetZ, 0, 0, 0, width, height, depth); } @@ -62,8 +62,8 @@ public static class UploadTexture3DExtensions public static void CopyTo(this UploadTexture3D source, Texture3D destination, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int destinationOffsetX, int destinationOffsetY, int destinationOffsetZ, int width, int height, int depth) where T : unmanaged { - Guard.IsNotNull(source, nameof(source)); - Guard.IsNotNull(destination, nameof(destination)); + Guard.IsNotNull(source); + Guard.IsNotNull(destination); destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, sourceOffsetZ, destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth); } diff --git a/src/ComputeSharp/Graphics/GraphicsDevice.GetDevice.cs b/src/ComputeSharp/Graphics/GraphicsDevice.GetDevice.cs index 08b900cd..242f51bd 100644 --- a/src/ComputeSharp/Graphics/GraphicsDevice.GetDevice.cs +++ b/src/ComputeSharp/Graphics/GraphicsDevice.GetDevice.cs @@ -47,7 +47,7 @@ partial class GraphicsDevice /// public static IEnumerable QueryDevices(Predicate predicate) { - Guard.IsNotNull(predicate, nameof(predicate)); + Guard.IsNotNull(predicate); return new DeviceHelper.DeviceQuery(predicate); } diff --git a/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs b/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs index f777e372..57b879ab 100644 --- a/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs @@ -62,7 +62,7 @@ public static class GraphicsResourceHelper public static unsafe ulong ValidateAndGetGpuDescriptorHandle(Buffer buffer, GraphicsDevice device) where T : unmanaged { - Guard.IsNotNull(buffer, nameof(buffer)); + Guard.IsNotNull(buffer); buffer.ThrowIfDisposed(); buffer.ThrowIfDeviceMismatch(device); @@ -83,7 +83,7 @@ public static class GraphicsResourceHelper public static unsafe ulong ValidateAndGetGpuDescriptorHandle(ReadOnlyTexture2D texture, GraphicsDevice device) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); texture.ThrowIfDisposed(); texture.ThrowIfDeviceMismatch(device); @@ -104,7 +104,7 @@ public static class GraphicsResourceHelper public static unsafe ulong ValidateAndGetGpuDescriptorHandle(ReadWriteTexture2D texture, GraphicsDevice device) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); texture.ThrowIfDisposed(); texture.ThrowIfDeviceMismatch(device); @@ -125,7 +125,7 @@ public static class GraphicsResourceHelper public static unsafe ulong ValidateAndGetGpuDescriptorHandle(IReadOnlyTexture2D texture, GraphicsDevice device) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); if (texture is IGraphicsResource resource) { @@ -148,7 +148,7 @@ public static class GraphicsResourceHelper public static unsafe ulong ValidateAndGetGpuDescriptorHandle(IReadOnlyNormalizedTexture2D texture, GraphicsDevice device) where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); if (texture is IGraphicsResource resource) { @@ -171,7 +171,7 @@ public static class GraphicsResourceHelper public static unsafe ulong ValidateAndGetGpuDescriptorHandle(IReadWriteNormalizedTexture2D texture, GraphicsDevice device) where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); if (texture is IGraphicsResource resource) { @@ -194,7 +194,7 @@ public static class GraphicsResourceHelper public static unsafe ulong ValidateAndGetGpuDescriptorHandle(ReadOnlyTexture3D texture, GraphicsDevice device) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); texture.ThrowIfDisposed(); texture.ThrowIfDeviceMismatch(device); @@ -215,7 +215,7 @@ public static class GraphicsResourceHelper public static unsafe ulong ValidateAndGetGpuDescriptorHandle(ReadWriteTexture3D texture, GraphicsDevice device) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); texture.ThrowIfDisposed(); texture.ThrowIfDeviceMismatch(device); @@ -236,7 +236,7 @@ public static class GraphicsResourceHelper public static unsafe ulong ValidateAndGetGpuDescriptorHandle(IReadOnlyTexture3D texture, GraphicsDevice device) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); if (texture is IGraphicsResource resource) { @@ -259,7 +259,7 @@ public static class GraphicsResourceHelper public static unsafe ulong ValidateAndGetGpuDescriptorHandle(IReadOnlyNormalizedTexture3D texture, GraphicsDevice device) where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); if (texture is IGraphicsResource resource) { @@ -282,7 +282,7 @@ public static class GraphicsResourceHelper public static unsafe ulong ValidateAndGetGpuDescriptorHandle(IReadWriteNormalizedTexture3D texture, GraphicsDevice device) where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); if (texture is IGraphicsResource resource) { diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs index 45b1dd44..4d5b5561 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs @@ -68,12 +68,12 @@ public unsafe abstract class Buffer : NativeObject, IGraphicsResource if (resourceType == ResourceType.Constant) { - Guard.IsBetweenOrEqualTo(length, 1, D3D12.D3D12_REQ_CONSTANT_BUFFER_ELEMENT_COUNT, nameof(length)); + Guard.IsBetweenOrEqualTo(length, 1, D3D12.D3D12_REQ_CONSTANT_BUFFER_ELEMENT_COUNT); } else { // The maximum length is set such that the aligned buffer size can't exceed uint.MaxValue - Guard.IsBetweenOrEqualTo(length, 1, (uint.MaxValue / elementSizeInBytes) & ~255, nameof(length)); + Guard.IsBetweenOrEqualTo(length, 1, (uint.MaxValue / elementSizeInBytes) & ~255); } if (TypeInfo.IsDoubleOrContainsDoubles && diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs index d1b2b403..98c99bdf 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs @@ -36,8 +36,8 @@ public abstract class StructuredBuffer : Buffer ThrowIfDisposed(); - Guard.IsBetweenOrEqualTo(count, 0, Length, nameof(count)); - Guard.IsInRange(sourceOffset, 0, Length, nameof(sourceOffset)); + Guard.IsBetweenOrEqualTo(count, 0, Length); + Guard.IsInRange(sourceOffset, 0, Length); Guard.IsLessThanOrEqualTo(sourceOffset + count, Length, nameof(sourceOffset)); if (GraphicsDevice.IsCacheCoherentUMA) @@ -110,11 +110,11 @@ public abstract class StructuredBuffer : Buffer destination.ThrowIfDeviceMismatch(GraphicsDevice); destination.ThrowIfDisposed(); - Guard.IsBetweenOrEqualTo(count, 0, Length, nameof(count)); - Guard.IsBetweenOrEqualTo(count, 0, destination.Length, nameof(count)); - Guard.IsInRange(sourceOffset, 0, Length, nameof(sourceOffset)); + Guard.IsBetweenOrEqualTo(count, 0, Length); + Guard.IsBetweenOrEqualTo(count, 0, destination.Length); + Guard.IsInRange(sourceOffset, 0, Length); Guard.IsLessThanOrEqualTo(sourceOffset + count, Length, nameof(sourceOffset)); - Guard.IsInRange(destinationOffset, 0, destination.Length, nameof(destinationOffset)); + Guard.IsInRange(destinationOffset, 0, destination.Length); Guard.IsLessThanOrEqualTo(destinationOffset + count, destination.Length, nameof(destinationOffset)); if (!destination.IsPaddingPresent) @@ -154,11 +154,11 @@ public abstract class StructuredBuffer : Buffer destination.ThrowIfDeviceMismatch(GraphicsDevice); destination.ThrowIfDisposed(); - Guard.IsBetweenOrEqualTo(count, 0, Length, nameof(count)); - Guard.IsBetweenOrEqualTo(count, 0, destination.Length, nameof(count)); - Guard.IsInRange(sourceOffset, 0, Length, nameof(sourceOffset)); + Guard.IsBetweenOrEqualTo(count, 0, Length); + Guard.IsBetweenOrEqualTo(count, 0, destination.Length); + Guard.IsInRange(sourceOffset, 0, Length); Guard.IsLessThanOrEqualTo(sourceOffset + count, Length, nameof(sourceOffset)); - Guard.IsInRange(destinationOffset, 0, destination.Length, nameof(destinationOffset)); + Guard.IsInRange(destinationOffset, 0, destination.Length); Guard.IsLessThanOrEqualTo(destinationOffset + count, destination.Length, nameof(destinationOffset)); if (GraphicsDevice.IsCacheCoherentUMA) @@ -194,8 +194,8 @@ public abstract class StructuredBuffer : Buffer ThrowIfDisposed(); - Guard.IsBetweenOrEqualTo(length, 0, Length, nameof(length)); - Guard.IsInRange(offset, 0, Length, nameof(offset)); + Guard.IsBetweenOrEqualTo(length, 0, Length); + Guard.IsInRange(offset, 0, Length); Guard.IsLessThanOrEqualTo(offset + length, Length, nameof(offset)); if (GraphicsDevice.IsCacheCoherentUMA) @@ -272,11 +272,11 @@ public abstract class StructuredBuffer : Buffer source.ThrowIfDeviceMismatch(GraphicsDevice); source.ThrowIfDisposed(); - Guard.IsBetweenOrEqualTo(count, 0, Length, nameof(count)); - Guard.IsBetweenOrEqualTo(count, 0, source.Length, nameof(count)); - Guard.IsInRange(sourceOffset, 0, source.Length, nameof(sourceOffset)); + Guard.IsBetweenOrEqualTo(count, 0, Length); + Guard.IsBetweenOrEqualTo(count, 0, source.Length); + Guard.IsInRange(sourceOffset, 0, source.Length); Guard.IsLessThanOrEqualTo(sourceOffset + count, source.Length, nameof(sourceOffset)); - Guard.IsInRange(destinationOffset, 0, Length, nameof(destinationOffset)); + Guard.IsInRange(destinationOffset, 0, Length); Guard.IsLessThanOrEqualTo(destinationOffset + count, Length, nameof(destinationOffset)); if (GraphicsDevice.IsCacheCoherentUMA) diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs index 8701eeed..dacc203e 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs @@ -74,8 +74,8 @@ public unsafe abstract class Texture2D : NativeObject, IGraphicsResource, Gra { device.ThrowIfDisposed(); - Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION, nameof(height)); + Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION); + Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION); if (!device.D3D12Device->IsDxgiFormatSupported(DXGIFormatHelper.GetForType(), d3D12FormatSupport)) { @@ -172,13 +172,13 @@ public unsafe abstract class Texture2D : NativeObject, IGraphicsResource, Gra ThrowIfDisposed(); - Guard.IsInRange(sourceOffsetX, 0, Width, nameof(sourceOffsetX)); - Guard.IsInRange(sourceOffsetY, 0, Height, nameof(sourceOffsetY)); - Guard.IsBetweenOrEqualTo(width, 1, Width, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, Height, nameof(height)); + Guard.IsInRange(sourceOffsetX, 0, Width); + Guard.IsInRange(sourceOffsetY, 0, Height); + Guard.IsBetweenOrEqualTo(width, 1, Width); + Guard.IsBetweenOrEqualTo(height, 1, Height); Guard.IsLessThanOrEqualTo(sourceOffsetX + width, Width, nameof(sourceOffsetX)); Guard.IsLessThanOrEqualTo(sourceOffsetY + height, Height, nameof(sourceOffsetY)); - Guard.IsGreaterThanOrEqualTo(size, (nint)width * height, nameof(size)); + Guard.IsGreaterThanOrEqualTo(size, (nint)width * height); GraphicsDevice.D3D12Device->GetCopyableFootprint( DXGIFormatHelper.GetForType(), @@ -264,14 +264,14 @@ public unsafe abstract class Texture2D : NativeObject, IGraphicsResource, Gra destination.ThrowIfDeviceMismatch(GraphicsDevice); destination.ThrowIfDisposed(); - Guard.IsInRange(sourceOffsetX, 0, Width, nameof(sourceOffsetX)); - Guard.IsInRange(sourceOffsetY, 0, Height, nameof(sourceOffsetY)); - Guard.IsInRange(destinationOffsetX, 0, destination.Width, nameof(destinationOffsetX)); - Guard.IsInRange(destinationOffsetY, 0, destination.Height, nameof(destinationOffsetY)); - Guard.IsBetweenOrEqualTo(width, 1, Width, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, Height, nameof(height)); - Guard.IsBetweenOrEqualTo(width, 1, destination.Width, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, destination.Height, nameof(height)); + Guard.IsInRange(sourceOffsetX, 0, Width); + Guard.IsInRange(sourceOffsetY, 0, Height); + Guard.IsInRange(destinationOffsetX, 0, destination.Width); + Guard.IsInRange(destinationOffsetY, 0, destination.Height); + Guard.IsBetweenOrEqualTo(width, 1, Width); + Guard.IsBetweenOrEqualTo(height, 1, Height); + Guard.IsBetweenOrEqualTo(width, 1, destination.Width); + Guard.IsBetweenOrEqualTo(height, 1, destination.Height); Guard.IsBetweenOrEqualTo(destinationOffsetX + width, 1, destination.Width, nameof(destinationOffsetX)); Guard.IsBetweenOrEqualTo(destinationOffsetY + height, 1, destination.Height, nameof(destinationOffsetY)); Guard.IsLessThanOrEqualTo(sourceOffsetX + width, Width, nameof(sourceOffsetX)); @@ -332,14 +332,14 @@ public unsafe abstract class Texture2D : NativeObject, IGraphicsResource, Gra destination.ThrowIfDeviceMismatch(GraphicsDevice); destination.ThrowIfDisposed(); - Guard.IsInRange(sourceOffsetX, 0, Width, nameof(sourceOffsetX)); - Guard.IsInRange(sourceOffsetY, 0, Height, nameof(sourceOffsetY)); - Guard.IsInRange(destinationOffsetX, 0, destination.Width, nameof(destinationOffsetX)); - Guard.IsInRange(destinationOffsetY, 0, destination.Height, nameof(destinationOffsetY)); - Guard.IsBetweenOrEqualTo(width, 1, Width, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, Height, nameof(height)); - Guard.IsBetweenOrEqualTo(width, 1, destination.Width, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, destination.Height, nameof(height)); + Guard.IsInRange(sourceOffsetX, 0, Width); + Guard.IsInRange(sourceOffsetY, 0, Height); + Guard.IsInRange(destinationOffsetX, 0, destination.Width); + Guard.IsInRange(destinationOffsetY, 0, destination.Height); + Guard.IsBetweenOrEqualTo(width, 1, Width); + Guard.IsBetweenOrEqualTo(height, 1, Height); + Guard.IsBetweenOrEqualTo(width, 1, destination.Width); + Guard.IsBetweenOrEqualTo(height, 1, destination.Height); Guard.IsBetweenOrEqualTo(destinationOffsetX + width, 1, destination.Width, nameof(destinationOffsetX)); Guard.IsBetweenOrEqualTo(destinationOffsetY + height, 1, destination.Height, nameof(destinationOffsetY)); Guard.IsLessThanOrEqualTo(sourceOffsetX + width, Width, nameof(sourceOffsetX)); @@ -392,13 +392,13 @@ public unsafe abstract class Texture2D : NativeObject, IGraphicsResource, Gra ThrowIfDisposed(); - Guard.IsInRange(destinationOffsetX, 0, Width, nameof(destinationOffsetX)); - Guard.IsInRange(destinationOffsetY, 0, Height, nameof(destinationOffsetY)); - Guard.IsBetweenOrEqualTo(width, 1, Width, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, Height, nameof(height)); + Guard.IsInRange(destinationOffsetX, 0, Width); + Guard.IsInRange(destinationOffsetY, 0, Height); + Guard.IsBetweenOrEqualTo(width, 1, Width); + Guard.IsBetweenOrEqualTo(height, 1, Height); Guard.IsLessThanOrEqualTo(destinationOffsetX + width, Width, nameof(destinationOffsetX)); Guard.IsLessThanOrEqualTo(destinationOffsetY + height, Height, nameof(destinationOffsetY)); - Guard.IsGreaterThanOrEqualTo(size, (nint)width * height, nameof(size)); + Guard.IsGreaterThanOrEqualTo(size, (nint)width * height); GraphicsDevice.D3D12Device->GetCopyableFootprint( DXGIFormatHelper.GetForType(), @@ -482,14 +482,14 @@ public unsafe abstract class Texture2D : NativeObject, IGraphicsResource, Gra source.ThrowIfDeviceMismatch(GraphicsDevice); source.ThrowIfDisposed(); - Guard.IsInRange(sourceOffsetX, 0, source.Width, nameof(sourceOffsetX)); - Guard.IsInRange(sourceOffsetY, 0, source.Height, nameof(sourceOffsetY)); - Guard.IsInRange(destinationOffsetX, 0, Width, nameof(destinationOffsetX)); - Guard.IsInRange(destinationOffsetY, 0, Height, nameof(destinationOffsetY)); - Guard.IsBetweenOrEqualTo(width, 1, Width, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, Height, nameof(height)); - Guard.IsBetweenOrEqualTo(width, 1, source.Width, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, source.Height, nameof(height)); + Guard.IsInRange(sourceOffsetX, 0, source.Width); + Guard.IsInRange(sourceOffsetY, 0, source.Height); + Guard.IsInRange(destinationOffsetX, 0, Width); + Guard.IsInRange(destinationOffsetY, 0, Height); + Guard.IsBetweenOrEqualTo(width, 1, Width); + Guard.IsBetweenOrEqualTo(height, 1, Height); + Guard.IsBetweenOrEqualTo(width, 1, source.Width); + Guard.IsBetweenOrEqualTo(height, 1, source.Height); Guard.IsLessThanOrEqualTo(sourceOffsetX + width, source.Width, nameof(sourceOffsetX)); Guard.IsLessThanOrEqualTo(sourceOffsetY + height, source.Height, nameof(sourceOffsetY)); Guard.IsLessThanOrEqualTo(destinationOffsetX + width, Width, nameof(destinationOffsetX)); diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs index 41e933bc..70e7361d 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs @@ -75,9 +75,9 @@ public unsafe abstract class Texture3D : NativeObject, IGraphicsResource, Gra { device.ThrowIfDisposed(); - Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(height)); - Guard.IsBetweenOrEqualTo(depth, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(depth)); + Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); + Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); + Guard.IsBetweenOrEqualTo(depth, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); if (!device.D3D12Device->IsDxgiFormatSupported(DXGIFormatHelper.GetForType(), d3D12FormatSupport)) { @@ -184,16 +184,16 @@ public unsafe abstract class Texture3D : NativeObject, IGraphicsResource, Gra ThrowIfDisposed(); - Guard.IsInRange(sourceOffsetX, 0, Width, nameof(sourceOffsetX)); - Guard.IsInRange(sourceOffsetY, 0, Height, nameof(sourceOffsetY)); - Guard.IsInRange(sourceOffsetZ, 0, Depth, nameof(sourceOffsetZ)); - Guard.IsBetweenOrEqualTo(width, 1, Width, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, Height, nameof(height)); - Guard.IsBetweenOrEqualTo(depth, 1, Depth, nameof(depth)); + Guard.IsInRange(sourceOffsetX, 0, Width); + Guard.IsInRange(sourceOffsetY, 0, Height); + Guard.IsInRange(sourceOffsetZ, 0, Depth); + Guard.IsBetweenOrEqualTo(width, 1, Width); + Guard.IsBetweenOrEqualTo(height, 1, Height); + Guard.IsBetweenOrEqualTo(depth, 1, Depth); Guard.IsLessThanOrEqualTo(sourceOffsetX + width, Width, nameof(sourceOffsetX)); Guard.IsLessThanOrEqualTo(sourceOffsetY + height, Height, nameof(sourceOffsetY)); Guard.IsLessThanOrEqualTo(sourceOffsetZ + depth, Depth, nameof(sourceOffsetZ)); - Guard.IsGreaterThanOrEqualTo(size, (nint)width * height * depth, nameof(size)); + Guard.IsGreaterThanOrEqualTo(size, (nint)width * height * depth); GraphicsDevice.D3D12Device->GetCopyableFootprint( DXGIFormatHelper.GetForType(), @@ -285,18 +285,18 @@ public unsafe abstract class Texture3D : NativeObject, IGraphicsResource, Gra destination.ThrowIfDeviceMismatch(GraphicsDevice); destination.ThrowIfDisposed(); - Guard.IsInRange(sourceOffsetX, 0, Width, nameof(sourceOffsetX)); - Guard.IsInRange(sourceOffsetY, 0, Height, nameof(sourceOffsetY)); - Guard.IsInRange(sourceOffsetZ, 0, Depth, nameof(sourceOffsetZ)); - Guard.IsInRange(destinationOffsetX, 0, destination.Width, nameof(destinationOffsetX)); - Guard.IsInRange(destinationOffsetY, 0, destination.Height, nameof(destinationOffsetY)); - Guard.IsInRange(destinationOffsetZ, 0, destination.Depth, nameof(destinationOffsetZ)); - Guard.IsBetweenOrEqualTo(width, 1, Width, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, Height, nameof(height)); - Guard.IsBetweenOrEqualTo(depth, 1, Depth, nameof(depth)); - Guard.IsBetweenOrEqualTo(width, 1, destination.Width, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, destination.Height, nameof(height)); - Guard.IsBetweenOrEqualTo(depth, 1, destination.Depth, nameof(depth)); + Guard.IsInRange(sourceOffsetX, 0, Width); + Guard.IsInRange(sourceOffsetY, 0, Height); + Guard.IsInRange(sourceOffsetZ, 0, Depth); + Guard.IsInRange(destinationOffsetX, 0, destination.Width); + Guard.IsInRange(destinationOffsetY, 0, destination.Height); + Guard.IsInRange(destinationOffsetZ, 0, destination.Depth); + Guard.IsBetweenOrEqualTo(width, 1, Width); + Guard.IsBetweenOrEqualTo(height, 1, Height); + Guard.IsBetweenOrEqualTo(depth, 1, Depth); + Guard.IsBetweenOrEqualTo(width, 1, destination.Width); + Guard.IsBetweenOrEqualTo(height, 1, destination.Height); + Guard.IsBetweenOrEqualTo(depth, 1, destination.Depth); Guard.IsBetweenOrEqualTo(destinationOffsetX + width, 1, destination.Width, nameof(destinationOffsetX)); Guard.IsBetweenOrEqualTo(destinationOffsetY + height, 1, destination.Height, nameof(destinationOffsetY)); Guard.IsBetweenOrEqualTo(destinationOffsetZ + depth, 1, destination.Depth, nameof(destinationOffsetZ)); @@ -362,18 +362,18 @@ public unsafe abstract class Texture3D : NativeObject, IGraphicsResource, Gra destination.ThrowIfDeviceMismatch(GraphicsDevice); destination.ThrowIfDisposed(); - Guard.IsInRange(sourceOffsetX, 0, Width, nameof(sourceOffsetX)); - Guard.IsInRange(sourceOffsetY, 0, Height, nameof(sourceOffsetY)); - Guard.IsInRange(sourceOffsetZ, 0, Depth, nameof(sourceOffsetZ)); - Guard.IsInRange(destinationOffsetX, 0, destination.Width, nameof(destinationOffsetX)); - Guard.IsInRange(destinationOffsetY, 0, destination.Height, nameof(destinationOffsetY)); - Guard.IsInRange(destinationOffsetZ, 0, destination.Depth, nameof(destinationOffsetZ)); - Guard.IsBetweenOrEqualTo(width, 1, Width, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, Height, nameof(height)); - Guard.IsBetweenOrEqualTo(depth, 1, Depth, nameof(depth)); - Guard.IsBetweenOrEqualTo(width, 1, destination.Width, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, destination.Height, nameof(height)); - Guard.IsBetweenOrEqualTo(depth, 1, destination.Depth, nameof(depth)); + Guard.IsInRange(sourceOffsetX, 0, Width); + Guard.IsInRange(sourceOffsetY, 0, Height); + Guard.IsInRange(sourceOffsetZ, 0, Depth); + Guard.IsInRange(destinationOffsetX, 0, destination.Width); + Guard.IsInRange(destinationOffsetY, 0, destination.Height); + Guard.IsInRange(destinationOffsetZ, 0, destination.Depth); + Guard.IsBetweenOrEqualTo(width, 1, Width); + Guard.IsBetweenOrEqualTo(height, 1, Height); + Guard.IsBetweenOrEqualTo(depth, 1, Depth); + Guard.IsBetweenOrEqualTo(width, 1, destination.Width); + Guard.IsBetweenOrEqualTo(height, 1, destination.Height); + Guard.IsBetweenOrEqualTo(depth, 1, destination.Depth); Guard.IsBetweenOrEqualTo(destinationOffsetX + width, 1, destination.Width, nameof(destinationOffsetX)); Guard.IsBetweenOrEqualTo(destinationOffsetY + height, 1, destination.Height, nameof(destinationOffsetY)); Guard.IsBetweenOrEqualTo(destinationOffsetZ + depth, 1, destination.Depth, nameof(destinationOffsetZ)); @@ -430,16 +430,16 @@ public unsafe abstract class Texture3D : NativeObject, IGraphicsResource, Gra ThrowIfDisposed(); - Guard.IsInRange(destinationOffsetX, 0, Width, nameof(destinationOffsetX)); - Guard.IsInRange(destinationOffsetY, 0, Height, nameof(destinationOffsetY)); - Guard.IsInRange(destinationOffsetZ, 0, Depth, nameof(destinationOffsetZ)); - Guard.IsBetweenOrEqualTo(width, 1, Width, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, Height, nameof(height)); - Guard.IsBetweenOrEqualTo(depth, 1, Depth, nameof(depth)); + Guard.IsInRange(destinationOffsetX, 0, Width); + Guard.IsInRange(destinationOffsetY, 0, Height); + Guard.IsInRange(destinationOffsetZ, 0, Depth); + Guard.IsBetweenOrEqualTo(width, 1, Width); + Guard.IsBetweenOrEqualTo(height, 1, Height); + Guard.IsBetweenOrEqualTo(depth, 1, Depth); Guard.IsLessThanOrEqualTo(destinationOffsetX + width, Width, nameof(destinationOffsetX)); Guard.IsLessThanOrEqualTo(destinationOffsetY + height, Height, nameof(destinationOffsetY)); Guard.IsLessThanOrEqualTo(destinationOffsetZ + depth, Depth, nameof(destinationOffsetZ)); - Guard.IsGreaterThanOrEqualTo(size, (nint)width * height * depth, nameof(size)); + Guard.IsGreaterThanOrEqualTo(size, (nint)width * height * depth); GraphicsDevice.D3D12Device->GetCopyableFootprint( DXGIFormatHelper.GetForType(), @@ -529,18 +529,18 @@ public unsafe abstract class Texture3D : NativeObject, IGraphicsResource, Gra source.ThrowIfDeviceMismatch(GraphicsDevice); source.ThrowIfDisposed(); - Guard.IsInRange(sourceOffsetX, 0, source.Width, nameof(sourceOffsetX)); - Guard.IsInRange(sourceOffsetY, 0, source.Height, nameof(sourceOffsetY)); - Guard.IsInRange(sourceOffsetZ, 0, source.Depth, nameof(sourceOffsetZ)); - Guard.IsInRange(destinationOffsetX, 0, Width, nameof(destinationOffsetX)); - Guard.IsInRange(destinationOffsetY, 0, Height, nameof(destinationOffsetY)); - Guard.IsInRange(destinationOffsetZ, 0, Depth, nameof(destinationOffsetZ)); - Guard.IsBetweenOrEqualTo(width, 1, Width, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, Height, nameof(height)); - Guard.IsBetweenOrEqualTo(depth, 1, Depth, nameof(depth)); - Guard.IsBetweenOrEqualTo(width, 1, source.Width, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, source.Height, nameof(height)); - Guard.IsBetweenOrEqualTo(depth, 1, source.Depth, nameof(depth)); + Guard.IsInRange(sourceOffsetX, 0, source.Width); + Guard.IsInRange(sourceOffsetY, 0, source.Height); + Guard.IsInRange(sourceOffsetZ, 0, source.Depth); + Guard.IsInRange(destinationOffsetX, 0, Width); + Guard.IsInRange(destinationOffsetY, 0, Height); + Guard.IsInRange(destinationOffsetZ, 0, Depth); + Guard.IsBetweenOrEqualTo(width, 1, Width); + Guard.IsBetweenOrEqualTo(height, 1, Height); + Guard.IsBetweenOrEqualTo(depth, 1, Depth); + Guard.IsBetweenOrEqualTo(width, 1, source.Width); + Guard.IsBetweenOrEqualTo(height, 1, source.Height); + Guard.IsBetweenOrEqualTo(depth, 1, source.Depth); Guard.IsLessThanOrEqualTo(sourceOffsetX + width, source.Width, nameof(sourceOffsetX)); Guard.IsLessThanOrEqualTo(sourceOffsetY + height, source.Height, nameof(sourceOffsetY)); Guard.IsLessThanOrEqualTo(sourceOffsetZ + depth, source.Depth, nameof(sourceOffsetZ)); diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs index 5e6bb771..edd1d028 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs @@ -47,7 +47,7 @@ public abstract unsafe class TransferBuffer : NativeObject, IGraphicsResource device.ThrowIfDisposed(); // The maximum length is set such that the aligned buffer size can't exceed uint.MaxValue - Guard.IsBetweenOrEqualTo(length, 1, (uint.MaxValue / (uint)sizeof(T)) & ~255, nameof(length)); + Guard.IsBetweenOrEqualTo(length, 1, (uint.MaxValue / (uint)sizeof(T)) & ~255); GraphicsDevice = device; Length = length; @@ -170,7 +170,7 @@ public abstract unsafe class TransferBuffer : NativeObject, IGraphicsResource /// public override MemoryHandle Pin(int elementIndex = 0) { - Guard.IsEqualTo(elementIndex, 0, nameof(elementIndex)); + Guard.IsEqualTo(elementIndex, 0); this.buffer.ThrowIfDisposed(); diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs index f7cd9af3..ec77a7af 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs @@ -52,8 +52,8 @@ public unsafe abstract class TransferTexture2D : NativeObject, IGraphicsResou { device.ThrowIfDisposed(); - Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION, nameof(height)); + Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION); + Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE2D_U_OR_V_DIMENSION); if (!device.D3D12Device->IsDxgiFormatSupported(DXGIFormatHelper.GetForType(), D3D12_FORMAT_SUPPORT1_TEXTURE2D)) { diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs index 86c324ad..e4f48331 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs @@ -53,9 +53,9 @@ public unsafe abstract class TransferTexture3D : NativeObject, IGraphicsResou { device.ThrowIfDisposed(); - Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(width)); - Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(height)); - Guard.IsBetweenOrEqualTo(depth, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION, nameof(depth)); + Guard.IsBetweenOrEqualTo(width, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); + Guard.IsBetweenOrEqualTo(height, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); + Guard.IsBetweenOrEqualTo(depth, 1, D3D12.D3D12_REQ_TEXTURE3D_U_V_OR_W_DIMENSION); if (!device.D3D12Device->IsDxgiFormatSupported(DXGIFormatHelper.GetForType(), D3D12_FORMAT_SUPPORT1_TEXTURE3D)) { diff --git a/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs index ccf48c24..e08040ea 100644 --- a/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs @@ -61,8 +61,8 @@ public sealed class ConstantBuffer : Buffer ThrowIfDisposed(); - Guard.IsBetweenOrEqualTo(length, 0, Length, nameof(length)); - Guard.IsInRange(offset, 0, Length, nameof(offset)); + Guard.IsBetweenOrEqualTo(length, 0, Length); + Guard.IsInRange(offset, 0, Length); Guard.IsLessThanOrEqualTo(offset + length, Length, nameof(offset)); using ID3D12ResourceMap resource = D3D12Resource->Map(); @@ -90,11 +90,11 @@ public sealed class ConstantBuffer : Buffer destination.ThrowIfDeviceMismatch(GraphicsDevice); destination.ThrowIfDisposed(); - Guard.IsBetweenOrEqualTo(length, 0, Length, nameof(length)); - Guard.IsBetweenOrEqualTo(length, 0, destination.Length, nameof(length)); - Guard.IsInRange(sourceOffset, 0, Length, nameof(sourceOffset)); + Guard.IsBetweenOrEqualTo(length, 0, Length); + Guard.IsBetweenOrEqualTo(length, 0, destination.Length); + Guard.IsInRange(sourceOffset, 0, Length); Guard.IsLessThanOrEqualTo(sourceOffset + length, Length, nameof(sourceOffset)); - Guard.IsInRange(destinationOffset, 0, destination.Length, nameof(destinationOffset)); + Guard.IsInRange(destinationOffset, 0, destination.Length); Guard.IsLessThanOrEqualTo(destinationOffset + length, destination.Length, nameof(destinationOffset)); if (destination is ConstantBuffer buffer) @@ -121,8 +121,8 @@ public sealed class ConstantBuffer : Buffer ThrowIfDisposed(); - Guard.IsBetweenOrEqualTo(length, 0, Length, nameof(length)); - Guard.IsInRange(offset, 0, Length, nameof(offset)); + Guard.IsBetweenOrEqualTo(length, 0, Length); + Guard.IsInRange(offset, 0, Length); Guard.IsLessThanOrEqualTo(offset + length, Length, nameof(offset)); using ID3D12ResourceMap resource = D3D12Resource->Map(); diff --git a/src/ComputeSharp/Graphics/Resources/Views/TextureView2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Views/TextureView2D{T}.cs index 695006d5..610ea99c 100644 --- a/src/ComputeSharp/Graphics/Resources/Views/TextureView2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Views/TextureView2D{T}.cs @@ -127,8 +127,8 @@ public readonly unsafe ref partial struct TextureView2D [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - Guard.IsInRange(x, 0, this.width, nameof(x)); - Guard.IsInRange(y, 0, this.height, nameof(y)); + Guard.IsInRange(x, 0, this.width); + Guard.IsInRange(y, 0, this.height); return ref *((T*)((byte*)this.pointer + (y * this.strideInBytes)) + x); } @@ -177,7 +177,7 @@ public readonly unsafe ref partial struct TextureView2D } else { - Guard.HasSizeGreaterThanOrEqualTo(destination, Length, nameof(destination)); + Guard.HasSizeGreaterThanOrEqualTo(destination, Length); for (int y = 0, j = 0; y < this.height; y++, j += this.width) { @@ -297,7 +297,7 @@ public readonly unsafe ref partial struct TextureView2D /// The resulting row . public Span GetRowSpan(int y) { - Guard.IsInRange(y, 0, this.height, nameof(y)); + Guard.IsInRange(y, 0, this.height); return new((byte*)this.pointer + (y * this.strideInBytes), this.width); } diff --git a/src/ComputeSharp/Graphics/Resources/Views/TextureView3D{T}.cs b/src/ComputeSharp/Graphics/Resources/Views/TextureView3D{T}.cs index 566cf60b..a7ed9751 100644 --- a/src/ComputeSharp/Graphics/Resources/Views/TextureView3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Views/TextureView3D{T}.cs @@ -152,9 +152,9 @@ public readonly unsafe ref partial struct TextureView3D [MethodImpl(MethodImplOptions.AggressiveInlining)] get { - Guard.IsInRange(x, 0, this.width, nameof(x)); - Guard.IsInRange(y, 0, this.height, nameof(y)); - Guard.IsInRange(z, 0, this.depth, nameof(z)); + Guard.IsInRange(x, 0, this.width); + Guard.IsInRange(y, 0, this.height); + Guard.IsInRange(z, 0, this.depth); return ref *((T*)((byte*)this.pointer + (z * this.height * this.strideInBytes) + (y * this.strideInBytes)) + x); } @@ -336,8 +336,8 @@ public readonly unsafe ref partial struct TextureView3D /// The resulting row . public Span GetRowSpan(int y, int z) { - Guard.IsInRange(y, 0, this.height, nameof(y)); - Guard.IsInRange(z, 0, this.depth, nameof(z)); + Guard.IsInRange(y, 0, this.height); + Guard.IsInRange(z, 0, this.depth); return new((byte*)this.pointer + (z * this.height * this.strideInBytes) + (y * this.strideInBytes), this.width); } @@ -350,7 +350,7 @@ public readonly unsafe ref partial struct TextureView3D /// The resulting row . public TextureView2D GetDepthView(int z) { - Guard.IsInRange(z, 0, this.depth, nameof(z)); + Guard.IsInRange(z, 0, this.depth); return new( (T*)((byte*)this.pointer + (z * this.height * this.strideInBytes)), diff --git a/src/ComputeSharp/Shaders/ComputeContext.cs b/src/ComputeSharp/Shaders/ComputeContext.cs index a5ea5199..fc3b0a40 100644 --- a/src/ComputeSharp/Shaders/ComputeContext.cs +++ b/src/ComputeSharp/Shaders/ComputeContext.cs @@ -191,19 +191,19 @@ public struct ComputeContext : IDisposable, IAsyncDisposable { ThrowInvalidOperationExceptionIfDeviceIsNull(); - Guard.IsGreaterThan(x, 0, nameof(x)); - Guard.IsGreaterThan(y, 0, nameof(y)); - Guard.IsGreaterThan(z, 0, nameof(z)); - Guard.IsBetweenOrEqualTo(threadsX, 1, 1024, nameof(threadsX)); - Guard.IsBetweenOrEqualTo(threadsY, 1, 1024, nameof(threadsY)); - Guard.IsBetweenOrEqualTo(threadsZ, 1, 64, nameof(threadsZ)); + Guard.IsGreaterThan(x, 0); + Guard.IsGreaterThan(y, 0); + Guard.IsGreaterThan(z, 0); + Guard.IsBetweenOrEqualTo(threadsX, 1, 1024); + Guard.IsBetweenOrEqualTo(threadsY, 1, 1024); + Guard.IsBetweenOrEqualTo(threadsZ, 1, 64); Guard.IsLessThanOrEqualTo(threadsX * threadsY * threadsZ, 1024, "threadsXYZ"); int groupsX = Math.DivRem(x, threadsX, out int modX) + (modX == 0 ? 0 : 1); int groupsY = Math.DivRem(y, threadsY, out int modY) + (modY == 0 ? 0 : 1); int groupsZ = Math.DivRem(z, threadsZ, out int modZ) + (modZ == 0 ? 0 : 1); - Guard.IsBetweenOrEqualTo(groupsX, 1, D3D11.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX)); + Guard.IsBetweenOrEqualTo(groupsX, 1, D3D11.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION); Guard.IsBetweenOrEqualTo(groupsY, 1, D3D11.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX)); Guard.IsBetweenOrEqualTo(groupsZ, 1, D3D11.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX)); @@ -241,7 +241,7 @@ public struct ComputeContext : IDisposable, IAsyncDisposable int groupsX = Math.DivRem(x, threadsX, out int modX) + (modX == 0 ? 0 : 1); int groupsY = Math.DivRem(y, threadsY, out int modY) + (modY == 0 ? 0 : 1); - Guard.IsBetweenOrEqualTo(groupsX, 1, D3D11.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX)); + Guard.IsBetweenOrEqualTo(groupsX, 1, D3D11.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION); Guard.IsBetweenOrEqualTo(groupsY, 1, D3D11.D3D11_CS_DISPATCH_MAX_THREAD_GROUPS_PER_DIMENSION, nameof(groupsX)); PipelineData pipelineData = PipelineDataLoader.GetPipelineData(this.device, threadsX, threadsY, threadsZ, ref shader); diff --git a/src/ComputeSharp/Shaders/Dispatching/ShaderDispatchMetadataLoader.cs b/src/ComputeSharp/Shaders/Dispatching/ShaderDispatchMetadataLoader.cs index 4c841e64..002e3837 100644 --- a/src/ComputeSharp/Shaders/Dispatching/ShaderDispatchMetadataLoader.cs +++ b/src/ComputeSharp/Shaders/Dispatching/ShaderDispatchMetadataLoader.cs @@ -34,7 +34,7 @@ internal readonly unsafe struct ShaderDispatchMetadataLoader : IDispatchMetadata /// public unsafe void LoadMetadataHandle(ReadOnlySpan serializedMetadata, ReadOnlySpan resourceDescriptors, out IntPtr result) { - Guard.HasSizeEqualTo(serializedMetadata, 5, nameof(serializedMetadata)); + Guard.HasSizeEqualTo(serializedMetadata, 5); fixed (IntPtr* p = &result) { diff --git a/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs b/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs index 52714968..a9db8c98 100644 --- a/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs +++ b/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs @@ -22,7 +22,7 @@ public static class ComputeContextExtensions public static unsafe void Barrier(this in ComputeContext context, ReadWriteBuffer buffer) where T : unmanaged { - Guard.IsNotNull(buffer, nameof(buffer)); + Guard.IsNotNull(buffer); context.Barrier(buffer.ValidateAndGetID3D12Resource(context.GraphicsDevice)); } @@ -36,7 +36,7 @@ public static class ComputeContextExtensions public static unsafe void Barrier(this in ComputeContext context, ReadWriteTexture2D texture) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); context.Barrier(texture.ValidateAndGetID3D12Resource(context.GraphicsDevice)); } @@ -50,7 +50,7 @@ public static class ComputeContextExtensions public static unsafe void Barrier(this in ComputeContext context, ReadWriteTexture3D texture) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); context.Barrier(texture.ValidateAndGetID3D12Resource(context.GraphicsDevice)); } @@ -66,7 +66,7 @@ public static class ComputeContextExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); context.Barrier(texture.ValidateAndGetID3D12Resource(context.GraphicsDevice)); } @@ -82,7 +82,7 @@ public static class ComputeContextExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); context.Barrier(texture.ValidateAndGetID3D12Resource(context.GraphicsDevice)); } @@ -96,7 +96,7 @@ public static class ComputeContextExtensions public static unsafe void Barrier(this in ComputeContext context, IReadWriteNormalizedTexture2D texture) where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); context.Barrier(((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetID3D12Resource(context.GraphicsDevice)); } @@ -110,7 +110,7 @@ public static class ComputeContextExtensions public static unsafe void Barrier(this in ComputeContext context, IReadWriteNormalizedTexture3D texture) where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); context.Barrier(((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetID3D12Resource(context.GraphicsDevice)); } @@ -124,7 +124,7 @@ public static class ComputeContextExtensions public static unsafe void Clear(this in ComputeContext context, ReadWriteBuffer buffer) where T : unmanaged { - Guard.IsNotNull(buffer, nameof(buffer)); + Guard.IsNotNull(buffer); var handles = buffer.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice); @@ -140,7 +140,7 @@ public static class ComputeContextExtensions public static unsafe void Clear(this in ComputeContext context, ReadWriteTexture2D texture) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized); @@ -156,7 +156,7 @@ public static class ComputeContextExtensions public static unsafe void Clear(this in ComputeContext context, ReadWriteTexture3D texture) where T : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized); @@ -174,7 +174,7 @@ public static class ComputeContextExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); @@ -192,7 +192,7 @@ public static class ComputeContextExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); @@ -208,7 +208,7 @@ public static class ComputeContextExtensions public static unsafe void Clear(this in ComputeContext context, IReadWriteNormalizedTexture2D texture) where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); @@ -224,7 +224,7 @@ public static class ComputeContextExtensions public static unsafe void Clear(this in ComputeContext context, IReadWriteNormalizedTexture3D texture) where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); @@ -243,7 +243,7 @@ public static class ComputeContextExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); @@ -262,7 +262,7 @@ public static class ComputeContextExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); @@ -279,7 +279,7 @@ public static class ComputeContextExtensions public static unsafe void Fill(this in ComputeContext context, IReadWriteNormalizedTexture2D texture, TPixel value) where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); @@ -300,7 +300,7 @@ public static class ComputeContextExtensions public static unsafe void Fill(this in ComputeContext context, IReadWriteNormalizedTexture3D texture, TPixel value) where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _); @@ -382,7 +382,7 @@ public static class ComputeContextExtensions where T : struct, IPixelShader where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); context.Run(texture, ref Unsafe.AsRef(default(T))); } @@ -399,7 +399,7 @@ public static class ComputeContextExtensions where T : struct, IPixelShader where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); context.Run(texture, ref Unsafe.AsRef(in shader)); } @@ -412,7 +412,7 @@ public static class ComputeContextExtensions /// The state to transition the input resource to. public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture2D texture, ResourceState resourceState) { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource); @@ -427,7 +427,7 @@ public static class ComputeContextExtensions /// The state to transition the input resource to. public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture2D texture, ResourceState resourceState) { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource); @@ -442,7 +442,7 @@ public static class ComputeContextExtensions /// The state to transition the input resource to. public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture2D texture, ResourceState resourceState) { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource); @@ -457,7 +457,7 @@ public static class ComputeContextExtensions /// The state to transition the input resource to. public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture2D texture, ResourceState resourceState) { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource); @@ -476,7 +476,7 @@ public static class ComputeContextExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource); @@ -491,7 +491,7 @@ public static class ComputeContextExtensions /// The state to transition the input resource to. public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture3D texture, ResourceState resourceState) { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource); @@ -506,7 +506,7 @@ public static class ComputeContextExtensions /// The state to transition the input resource to. public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture3D texture, ResourceState resourceState) { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource); @@ -521,7 +521,7 @@ public static class ComputeContextExtensions /// The state to transition the input resource to. public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture3D texture, ResourceState resourceState) { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource); @@ -536,7 +536,7 @@ public static class ComputeContextExtensions /// The state to transition the input resource to. public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture3D texture, ResourceState resourceState) { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource); @@ -555,7 +555,7 @@ public static class ComputeContextExtensions where T : unmanaged, IPixel where TPixel : unmanaged { - Guard.IsNotNull(texture, nameof(texture)); + Guard.IsNotNull(texture); var states = texture.ValidateAndGetID3D12ResourceAndTransitionStates(context.GraphicsDevice, resourceState, out ID3D12Resource* d3D12Resource);