From 0b1b3e3391d5643dc74e5eb04905ac4493b23dfc Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 29 Jan 2022 12:54:02 +0100 Subject: [PATCH 1/6] Switch to CommunityToolkit.Diagnostics 8.0.0 Preview 1 --- .../Processors/HlslBokehBlurProcessor.cs | 2 +- .../Processors/HlslBokehBlurProcessor{TPixel}.cs | 2 +- .../Processors/HlslGaussianBlurProcessor.cs | 2 +- .../Processors/HlslGaussianBlurProcessor{TPixel}.cs | 3 +-- .../ViewModels/MainViewModel.cs | 2 +- .../Extensions/AssemblyExtensions.cs | 2 +- .../Shaders/Translation/ShaderCompiler.LibraryLoading.cs | 2 +- src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs | 2 +- src/ComputeSharp.UI/ShaderRunner{T}.cs | 2 +- src/ComputeSharp/ComputeSharp.csproj | 2 +- src/ComputeSharp/Core/Attributes/EmbeddedBytecodeAttribute.cs | 2 +- .../Commands/Interop/ID3D12DescriptorHandleAllocator.cs | 2 +- .../Graphics/Exceptions/UnsupportedTextureTypeException.cs | 2 +- src/ComputeSharp/Graphics/Extensions/BufferExtensions.cs | 2 +- .../Extensions/GraphicsDeviceExtensions.Dispatching.cs | 2 +- .../Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs | 2 +- .../Graphics/Extensions/Interop/AllocatorExtensions.cs | 2 +- .../Graphics/Extensions/Interop/HResultExtensions.cs | 2 +- .../Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs | 2 +- .../Extensions/Interop/IWICStreamExtensions.Stream.cs | 2 +- .../Graphics/Extensions/ReadBackBufferExtensions.cs | 4 ++-- .../Graphics/Extensions/ReadBackTexture2DExtensions.cs | 2 +- .../Graphics/Extensions/ReadBackTexture3DExtensions.cs | 4 ++-- .../Graphics/Extensions/ReadWriteTexture2DExtensions.cs | 2 +- .../Graphics/Extensions/ReadWriteTexture3DExtensions.cs | 2 +- .../Graphics/Extensions/StructuredBufferExtensions.cs | 4 ++-- src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs | 2 +- src/ComputeSharp/Graphics/Extensions/Texture3DExtensions.cs | 2 +- .../Graphics/Extensions/UploadBufferExtensions.cs | 4 ++-- .../Graphics/Extensions/UploadTexture2DExtensions.cs | 2 +- .../Graphics/Extensions/UploadTexture3DExtensions.cs | 4 ++-- src/ComputeSharp/Graphics/GraphicsDevice.Execute.cs | 2 +- src/ComputeSharp/Graphics/GraphicsDevice.GetDevice.cs | 2 +- src/ComputeSharp/Graphics/GraphicsDevice.cs | 2 +- src/ComputeSharp/Graphics/Helpers/DXGIFormatHelper.cs | 2 +- .../Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs | 2 +- src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs | 2 +- src/ComputeSharp/Graphics/Helpers/WICFormatHelper.cs | 2 +- src/ComputeSharp/Graphics/Helpers/WICHelper.cs | 2 +- .../Graphics/Helpers/__Internals/GraphicsResourceHelper.cs | 2 +- src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs | 2 +- .../Graphics/Resources/Abstract/StructuredBuffer{T}.cs | 4 ++-- src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs | 2 +- src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs | 2 +- .../Graphics/Resources/Abstract/TransferBuffer{T}.cs | 2 +- .../Graphics/Resources/Abstract/TransferTexture2D{T}.cs | 2 +- .../Graphics/Resources/Abstract/TransferTexture3D{T}.cs | 2 +- src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs | 2 +- .../Graphics/Resources/Helpers/ResourceStateHelper.cs | 2 +- src/ComputeSharp/Graphics/Resources/Views/TextureView2D{T}.cs | 2 +- src/ComputeSharp/Graphics/Resources/Views/TextureView3D{T}.cs | 2 +- src/ComputeSharp/Shaders/ComputeContext.cs | 2 +- src/ComputeSharp/Shaders/Dispatching/ShaderBytecodeLoader.cs | 2 +- .../Shaders/Dispatching/ShaderDispatchMetadataLoader.cs | 2 +- .../Shaders/Extensions/ComputeContextExtensions.cs | 2 +- tests/ComputeSharp.Tests/Extensions/DeviceExtensions.cs | 2 +- tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs | 2 +- 57 files changed, 63 insertions(+), 64 deletions(-) diff --git a/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor.cs b/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor.cs index aa7e32d6..c6372d8e 100644 --- a/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor.cs +++ b/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor.cs @@ -1,5 +1,5 @@ using System.Runtime.CompilerServices; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing.Processors; diff --git a/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs b/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs index 8a4add60..4d3e7888 100644 --- a/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs +++ b/samples/ComputeSharp.ImageProcessing/Processors/HlslBokehBlurProcessor{TPixel}.cs @@ -4,7 +4,7 @@ using System.Collections.Generic; using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; using SixLabors.ImageSharp; using SixLabors.ImageSharp.Processing.Processors; using ImageSharpRgba32 = SixLabors.ImageSharp.PixelFormats.Rgba32; diff --git a/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.cs b/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.cs index de1e6ef1..95cd2a2f 100644 --- a/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.cs +++ b/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor.cs @@ -1,5 +1,5 @@ using System.Runtime.CompilerServices; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; using SixLabors.ImageSharp.Processing.Processors; diff --git a/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor{TPixel}.cs b/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor{TPixel}.cs index 11c70763..33aa5541 100644 --- a/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor{TPixel}.cs +++ b/samples/ComputeSharp.ImageProcessing/Processors/HlslGaussianBlurProcessor{TPixel}.cs @@ -1,8 +1,7 @@ using System; -using System.Numerics; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; using SixLabors.ImageSharp; using SixLabors.ImageSharp.Processing.Processors; using ImageSharpRgba32 = SixLabors.ImageSharp.PixelFormats.Rgba32; diff --git a/samples/ComputeSharp.SwapChain.Core.Shared/ViewModels/MainViewModel.cs b/samples/ComputeSharp.SwapChain.Core.Shared/ViewModels/MainViewModel.cs index b97858db..2e92d458 100644 --- a/samples/ComputeSharp.SwapChain.Core.Shared/ViewModels/MainViewModel.cs +++ b/samples/ComputeSharp.SwapChain.Core.Shared/ViewModels/MainViewModel.cs @@ -1,4 +1,5 @@ using System.Collections.Generic; +using CommunityToolkit.Diagnostics; using CommunityToolkit.Mvvm.ComponentModel; using CommunityToolkit.Mvvm.Input; using ComputeSharp.SwapChain.Core.Constants; @@ -11,7 +12,6 @@ using ComputeSharp.Uwp; #else using ComputeSharp.WinUI; #endif -using Microsoft.Toolkit.Diagnostics; #nullable enable diff --git a/samples/ComputeSharp.SwapChain.Uwp/Extensions/AssemblyExtensions.cs b/samples/ComputeSharp.SwapChain.Uwp/Extensions/AssemblyExtensions.cs index 90415cab..cd39cfda 100644 --- a/samples/ComputeSharp.SwapChain.Uwp/Extensions/AssemblyExtensions.cs +++ b/samples/ComputeSharp.SwapChain.Uwp/Extensions/AssemblyExtensions.cs @@ -1,6 +1,6 @@ using System.IO; using System.Reflection; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; #nullable enable diff --git a/src/ComputeSharp.Dynamic/Shaders/Translation/ShaderCompiler.LibraryLoading.cs b/src/ComputeSharp.Dynamic/Shaders/Translation/ShaderCompiler.LibraryLoading.cs index 79911fff..bfb872b0 100644 --- a/src/ComputeSharp.Dynamic/Shaders/Translation/ShaderCompiler.LibraryLoading.cs +++ b/src/ComputeSharp.Dynamic/Shaders/Translation/ShaderCompiler.LibraryLoading.cs @@ -3,7 +3,7 @@ using System; using System.IO; using System.Runtime.InteropServices; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; using TerraFX.Interop.Windows; namespace ComputeSharp.Shaders.Translation; diff --git a/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs b/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs index 479f22b2..2d1c39aa 100644 --- a/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs +++ b/src/ComputeSharp.UI/Helpers/SwapChainManager.Rendering.cs @@ -2,12 +2,12 @@ using System.Diagnostics; using System.Runtime.CompilerServices; using System.Threading; +using CommunityToolkit.Diagnostics; #if WINDOWS_UWP using ComputeSharp.Uwp.Extensions; #else using ComputeSharp.WinUI.Extensions; #endif -using Microsoft.Toolkit.Diagnostics; #pragma warning disable CS0420 diff --git a/src/ComputeSharp.UI/ShaderRunner{T}.cs b/src/ComputeSharp.UI/ShaderRunner{T}.cs index cad093ef..4d3af1cd 100644 --- a/src/ComputeSharp.UI/ShaderRunner{T}.cs +++ b/src/ComputeSharp.UI/ShaderRunner{T}.cs @@ -1,5 +1,5 @@ using System; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; #if WINDOWS_UWP namespace ComputeSharp.Uwp; diff --git a/src/ComputeSharp/ComputeSharp.csproj b/src/ComputeSharp/ComputeSharp.csproj index fb2ca081..60c0ae6e 100644 --- a/src/ComputeSharp/ComputeSharp.csproj +++ b/src/ComputeSharp/ComputeSharp.csproj @@ -12,7 +12,7 @@ - + diff --git a/src/ComputeSharp/Core/Attributes/EmbeddedBytecodeAttribute.cs b/src/ComputeSharp/Core/Attributes/EmbeddedBytecodeAttribute.cs index 5211f07a..012cdd4c 100644 --- a/src/ComputeSharp/Core/Attributes/EmbeddedBytecodeAttribute.cs +++ b/src/ComputeSharp/Core/Attributes/EmbeddedBytecodeAttribute.cs @@ -1,6 +1,6 @@ using System; #if !SOURCE_GENERATOR -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; #endif namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12DescriptorHandleAllocator.cs b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12DescriptorHandleAllocator.cs index 30363d12..3c869ad8 100644 --- a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12DescriptorHandleAllocator.cs +++ b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12DescriptorHandleAllocator.cs @@ -1,6 +1,6 @@ using System; +using CommunityToolkit.Diagnostics; using ComputeSharp.Graphics.Extensions; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; using static TerraFX.Interop.DirectX.D3D12_DESCRIPTOR_HEAP_TYPE; diff --git a/src/ComputeSharp/Graphics/Exceptions/UnsupportedTextureTypeException.cs b/src/ComputeSharp/Graphics/Exceptions/UnsupportedTextureTypeException.cs index 0b85c50c..0558e6f8 100644 --- a/src/ComputeSharp/Graphics/Exceptions/UnsupportedTextureTypeException.cs +++ b/src/ComputeSharp/Graphics/Exceptions/UnsupportedTextureTypeException.cs @@ -1,6 +1,6 @@ using System; using System.Text; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; namespace ComputeSharp.Exceptions; diff --git a/src/ComputeSharp/Graphics/Extensions/BufferExtensions.cs b/src/ComputeSharp/Graphics/Extensions/BufferExtensions.cs index a486d482..f6815dee 100644 --- a/src/ComputeSharp/Graphics/Extensions/BufferExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/BufferExtensions.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; +using CommunityToolkit.Diagnostics; using ComputeSharp.Resources; -using Microsoft.Toolkit.Diagnostics; #if !NET6_0_OR_GREATER using GC = ComputeSharp.NetStandard.System.GC; #endif diff --git a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs index fff4ea9d..adc2f244 100644 --- a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs +++ b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Dispatching.cs @@ -1,5 +1,5 @@ using System.Runtime.CompilerServices; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs index 10f00162..41191701 100644 --- a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs +++ b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs @@ -1,8 +1,8 @@ using System; using System.IO; +using CommunityToolkit.Diagnostics; using ComputeSharp.Graphics.Helpers; using ComputeSharp.Resources; -using Microsoft.Toolkit.Diagnostics; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/AllocatorExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/AllocatorExtensions.cs index ff57809c..fd451d38 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/AllocatorExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/AllocatorExtensions.cs @@ -1,7 +1,7 @@ #if NET6_0_OR_GREATER +using CommunityToolkit.Diagnostics; using ComputeSharp.Core.Extensions; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; using static TerraFX.Interop.DirectX.D3D12_CPU_PAGE_PROPERTY; diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/HResultExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/HResultExtensions.cs index 33a84d4b..403dc0ba 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/HResultExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/HResultExtensions.cs @@ -1,8 +1,8 @@ using System.ComponentModel; using System.Diagnostics; using System.Runtime.CompilerServices; +using CommunityToolkit.Diagnostics; using ComputeSharp.Graphics.Helpers; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.Windows; namespace ComputeSharp.Core.Extensions; diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs index 8be3ec80..5d05c6db 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/ID3D12DeviceExtensions.cs @@ -2,10 +2,10 @@ #if NET6_0_OR_GREATER using System.Runtime.CompilerServices; #endif +using CommunityToolkit.Diagnostics; using ComputeSharp.Core.Extensions; #if !NET6_0_OR_GREATER using ComputeSharp.Graphics.Resources.Enums; -using Microsoft.Toolkit.Diagnostics; #endif using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; diff --git a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs index e5560e33..36a07e75 100644 --- a/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs +++ b/src/ComputeSharp/Graphics/Extensions/Interop/IWICStreamExtensions.Stream.cs @@ -3,7 +3,7 @@ using System.IO; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using System.Threading; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; using TerraFX.Interop.Windows; using static TerraFX.Interop.Windows.E; using static TerraFX.Interop.Windows.IID; diff --git a/src/ComputeSharp/Graphics/Extensions/ReadBackBufferExtensions.cs b/src/ComputeSharp/Graphics/Extensions/ReadBackBufferExtensions.cs index 0941f343..84a4feed 100644 --- a/src/ComputeSharp/Graphics/Extensions/ReadBackBufferExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/ReadBackBufferExtensions.cs @@ -1,5 +1,5 @@ -using ComputeSharp.Resources; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; +using ComputeSharp.Resources; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/Extensions/ReadBackTexture2DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/ReadBackTexture2DExtensions.cs index f8859f2a..92a56aaa 100644 --- a/src/ComputeSharp/Graphics/Extensions/ReadBackTexture2DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/ReadBackTexture2DExtensions.cs @@ -1,9 +1,9 @@ using System; using System.Buffers; using System.IO; +using CommunityToolkit.Diagnostics; using ComputeSharp.Graphics.Helpers; using ComputeSharp.Resources; -using Microsoft.Toolkit.Diagnostics; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/Extensions/ReadBackTexture3DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/ReadBackTexture3DExtensions.cs index 330a63d4..24ce19f3 100644 --- a/src/ComputeSharp/Graphics/Extensions/ReadBackTexture3DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/ReadBackTexture3DExtensions.cs @@ -1,5 +1,5 @@ -using ComputeSharp.Resources; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; +using ComputeSharp.Resources; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture2DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture2DExtensions.cs index 6a1d7006..2111ba5a 100644 --- a/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture2DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture2DExtensions.cs @@ -1,5 +1,5 @@ using System; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture3DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture3DExtensions.cs index c8462f6b..ad175807 100644 --- a/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture3DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/ReadWriteTexture3DExtensions.cs @@ -1,5 +1,5 @@ using System; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/Extensions/StructuredBufferExtensions.cs b/src/ComputeSharp/Graphics/Extensions/StructuredBufferExtensions.cs index 9953e30e..f9ffe67a 100644 --- a/src/ComputeSharp/Graphics/Extensions/StructuredBufferExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/StructuredBufferExtensions.cs @@ -1,5 +1,5 @@ -using ComputeSharp.Resources; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; +using ComputeSharp.Resources; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs index 0ea1a9c6..8e829035 100644 --- a/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Texture2DExtensions.cs @@ -2,9 +2,9 @@ using System.Buffers; using System.IO; using System.Runtime.InteropServices; +using CommunityToolkit.Diagnostics; using ComputeSharp.Graphics.Helpers; using ComputeSharp.Resources; -using Microsoft.Toolkit.Diagnostics; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/Extensions/Texture3DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/Texture3DExtensions.cs index d9664901..ce0fc51c 100644 --- a/src/ComputeSharp/Graphics/Extensions/Texture3DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/Texture3DExtensions.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; +using CommunityToolkit.Diagnostics; using ComputeSharp.Resources; -using Microsoft.Toolkit.Diagnostics; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/Extensions/UploadBufferExtensions.cs b/src/ComputeSharp/Graphics/Extensions/UploadBufferExtensions.cs index 4c2339ad..7ddc84b2 100644 --- a/src/ComputeSharp/Graphics/Extensions/UploadBufferExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/UploadBufferExtensions.cs @@ -1,5 +1,5 @@ -using ComputeSharp.Resources; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; +using ComputeSharp.Resources; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/Extensions/UploadTexture2DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/UploadTexture2DExtensions.cs index 1ad1a6f6..6c594494 100644 --- a/src/ComputeSharp/Graphics/Extensions/UploadTexture2DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/UploadTexture2DExtensions.cs @@ -1,8 +1,8 @@ using System; using System.IO; +using CommunityToolkit.Diagnostics; using ComputeSharp.Graphics.Helpers; using ComputeSharp.Resources; -using Microsoft.Toolkit.Diagnostics; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/Extensions/UploadTexture3DExtensions.cs b/src/ComputeSharp/Graphics/Extensions/UploadTexture3DExtensions.cs index e2dfa2d4..5837085e 100644 --- a/src/ComputeSharp/Graphics/Extensions/UploadTexture3DExtensions.cs +++ b/src/ComputeSharp/Graphics/Extensions/UploadTexture3DExtensions.cs @@ -1,5 +1,5 @@ -using ComputeSharp.Resources; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; +using ComputeSharp.Resources; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/GraphicsDevice.Execute.cs b/src/ComputeSharp/Graphics/GraphicsDevice.Execute.cs index feb93964..33c07124 100644 --- a/src/ComputeSharp/Graphics/GraphicsDevice.Execute.cs +++ b/src/ComputeSharp/Graphics/GraphicsDevice.Execute.cs @@ -5,10 +5,10 @@ using System.Runtime.InteropServices; using System.Threading; using System.Threading.Tasks; using System.Threading.Tasks.Sources; +using CommunityToolkit.Diagnostics; using ComputeSharp.Core.Extensions; using ComputeSharp.Graphics.Commands; using ComputeSharp.Graphics.Commands.Interop; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; using static TerraFX.Interop.DirectX.D3D12_COMMAND_LIST_TYPE; diff --git a/src/ComputeSharp/Graphics/GraphicsDevice.GetDevice.cs b/src/ComputeSharp/Graphics/GraphicsDevice.GetDevice.cs index abe3b600..08b900cd 100644 --- a/src/ComputeSharp/Graphics/GraphicsDevice.GetDevice.cs +++ b/src/ComputeSharp/Graphics/GraphicsDevice.GetDevice.cs @@ -1,7 +1,7 @@ using System; using System.Collections.Generic; +using CommunityToolkit.Diagnostics; using ComputeSharp.Graphics.Helpers; -using Microsoft.Toolkit.Diagnostics; namespace ComputeSharp; diff --git a/src/ComputeSharp/Graphics/GraphicsDevice.cs b/src/ComputeSharp/Graphics/GraphicsDevice.cs index 36297c8f..67f6821d 100644 --- a/src/ComputeSharp/Graphics/GraphicsDevice.cs +++ b/src/ComputeSharp/Graphics/GraphicsDevice.cs @@ -1,5 +1,6 @@ using System.Diagnostics; using System.Runtime.CompilerServices; +using CommunityToolkit.Diagnostics; using ComputeSharp.Graphics.Commands.Interop; #if NET6_0_OR_GREATER using ComputeSharp.Core.Extensions; @@ -7,7 +8,6 @@ using ComputeSharp.Core.Extensions; using ComputeSharp.Graphics.Extensions; using ComputeSharp.Graphics.Helpers; using ComputeSharp.Interop; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; using static TerraFX.Interop.DirectX.D3D12_COMMAND_LIST_TYPE; diff --git a/src/ComputeSharp/Graphics/Helpers/DXGIFormatHelper.cs b/src/ComputeSharp/Graphics/Helpers/DXGIFormatHelper.cs index 339286dd..8bff94ef 100644 --- a/src/ComputeSharp/Graphics/Helpers/DXGIFormatHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/DXGIFormatHelper.cs @@ -1,6 +1,6 @@ using System.Numerics; using System.Runtime.CompilerServices; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; using TerraFX.Interop.DirectX; using static TerraFX.Interop.DirectX.DXGI_FORMAT; diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs index 01f906e9..498f6e31 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.ID3D12InfoQueue.cs @@ -1,7 +1,7 @@ using System.Diagnostics; using System.Runtime.InteropServices; using System.Text; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; using static TerraFX.Interop.DirectX.D3D12_MESSAGE_SEVERITY; diff --git a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs index 5b998c0e..d31e3065 100644 --- a/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/DeviceHelper.cs @@ -1,7 +1,7 @@ using System; +using CommunityToolkit.Diagnostics; using ComputeSharp.Core.Extensions; using ComputeSharp.Graphics.Extensions; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; using static TerraFX.Interop.DirectX.D3D_FEATURE_LEVEL; diff --git a/src/ComputeSharp/Graphics/Helpers/WICFormatHelper.cs b/src/ComputeSharp/Graphics/Helpers/WICFormatHelper.cs index 6be31a5c..ac8beb0d 100644 --- a/src/ComputeSharp/Graphics/Helpers/WICFormatHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/WICFormatHelper.cs @@ -1,6 +1,6 @@ using System; using System.Runtime.CompilerServices; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; using TerraFX.Interop.Windows; #if NET6_0_OR_GREATER using Path = System.IO.Path; diff --git a/src/ComputeSharp/Graphics/Helpers/WICHelper.cs b/src/ComputeSharp/Graphics/Helpers/WICHelper.cs index 45d2c1bd..64540ff4 100644 --- a/src/ComputeSharp/Graphics/Helpers/WICHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/WICHelper.cs @@ -2,9 +2,9 @@ using System.Buffers; using System.IO; using System.Runtime.CompilerServices; +using CommunityToolkit.Diagnostics; using ComputeSharp.Core.Extensions; using ComputeSharp.Graphics.Extensions; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.Windows; #pragma warning disable CA1416 diff --git a/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs b/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs index 0cfb4de8..f777e372 100644 --- a/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs +++ b/src/ComputeSharp/Graphics/Helpers/__Internals/GraphicsResourceHelper.cs @@ -1,8 +1,8 @@ using System; using System.ComponentModel; using System.Runtime.CompilerServices; +using CommunityToolkit.Diagnostics; using ComputeSharp.Resources; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.DirectX; namespace ComputeSharp.__Internals; diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs index 62ae44b3..45b1dd44 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Buffer{T}.cs @@ -1,12 +1,12 @@ using System.Buffers; using System.Runtime.CompilerServices; +using CommunityToolkit.Diagnostics; using ComputeSharp.Core.Helpers; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Commands.Interop; using ComputeSharp.Graphics.Extensions; using ComputeSharp.Graphics.Helpers; using ComputeSharp.Interop; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; using static TerraFX.Interop.DirectX.D3D12_FEATURE; diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs index 5b30dad3..d1b2b403 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/StructuredBuffer{T}.cs @@ -1,8 +1,8 @@ -using ComputeSharp.Graphics.Commands; +using CommunityToolkit.Diagnostics; +using ComputeSharp.Graphics.Commands; using ComputeSharp.Graphics.Extensions; using ComputeSharp.Graphics.Helpers; using ComputeSharp.Graphics.Resources.Interop; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; using static TerraFX.Interop.DirectX.D3D12_COMMAND_LIST_TYPE; diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs index ef2de122..8701eeed 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Texture2D{T}.cs @@ -1,5 +1,6 @@ using System; using System.Runtime.CompilerServices; +using CommunityToolkit.Diagnostics; using ComputeSharp.__Internals; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Commands; @@ -9,7 +10,6 @@ using ComputeSharp.Graphics.Helpers; using ComputeSharp.Graphics.Resources.Helpers; using ComputeSharp.Graphics.Resources.Interop; using ComputeSharp.Interop; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; using static TerraFX.Interop.DirectX.D3D12_COMMAND_LIST_TYPE; diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs index ac0c4265..41e933bc 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/Texture3D{T}.cs @@ -1,5 +1,6 @@ using System; using System.Runtime.CompilerServices; +using CommunityToolkit.Diagnostics; using ComputeSharp.__Internals; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Commands; @@ -9,7 +10,6 @@ using ComputeSharp.Graphics.Helpers; using ComputeSharp.Graphics.Resources.Helpers; using ComputeSharp.Graphics.Resources.Interop; using ComputeSharp.Interop; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; using static TerraFX.Interop.DirectX.D3D12_COMMAND_LIST_TYPE; diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs index b9478f5f..5e6bb771 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/TransferBuffer{T}.cs @@ -1,10 +1,10 @@ using System; using System.Buffers; using System.Runtime.CompilerServices; +using CommunityToolkit.Diagnostics; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Extensions; using ComputeSharp.Interop; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; using ResourceType = ComputeSharp.Graphics.Resources.Enums.ResourceType; diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs index 24d274b2..f7cd9af3 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture2D{T}.cs @@ -1,9 +1,9 @@ using System.Runtime.CompilerServices; +using CommunityToolkit.Diagnostics; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Extensions; using ComputeSharp.Graphics.Helpers; using ComputeSharp.Interop; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1; diff --git a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs index c939db0a..86c324ad 100644 --- a/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Abstract/TransferTexture3D{T}.cs @@ -1,9 +1,9 @@ using System.Runtime.CompilerServices; +using CommunityToolkit.Diagnostics; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Extensions; using ComputeSharp.Graphics.Helpers; using ComputeSharp.Interop; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1; diff --git a/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs b/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs index 4536d996..ccf48c24 100644 --- a/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/ConstantBuffer{T}.cs @@ -1,5 +1,6 @@ using System.Diagnostics; using System.Runtime.CompilerServices; +using CommunityToolkit.Diagnostics; using ComputeSharp.Core.Helpers; using ComputeSharp.Exceptions; using ComputeSharp.Graphics.Extensions; @@ -7,7 +8,6 @@ using ComputeSharp.Graphics.Helpers; using ComputeSharp.Graphics.Resources.Interop; using ComputeSharp.Resources; using ComputeSharp.Resources.Debug; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.DirectX; using ResourceType = ComputeSharp.Graphics.Resources.Enums.ResourceType; diff --git a/src/ComputeSharp/Graphics/Resources/Helpers/ResourceStateHelper.cs b/src/ComputeSharp/Graphics/Resources/Helpers/ResourceStateHelper.cs index 38b95cca..d6f45f59 100644 --- a/src/ComputeSharp/Graphics/Resources/Helpers/ResourceStateHelper.cs +++ b/src/ComputeSharp/Graphics/Resources/Helpers/ResourceStateHelper.cs @@ -1,5 +1,5 @@ using System.Runtime.CompilerServices; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; using TerraFX.Interop.DirectX; using static TerraFX.Interop.DirectX.D3D12_RESOURCE_STATES; diff --git a/src/ComputeSharp/Graphics/Resources/Views/TextureView2D{T}.cs b/src/ComputeSharp/Graphics/Resources/Views/TextureView2D{T}.cs index abf0f066..695006d5 100644 --- a/src/ComputeSharp/Graphics/Resources/Views/TextureView2D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Views/TextureView2D{T}.cs @@ -1,7 +1,7 @@ using System; using System.ComponentModel; using System.Runtime.CompilerServices; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; #pragma warning disable CS0809 diff --git a/src/ComputeSharp/Graphics/Resources/Views/TextureView3D{T}.cs b/src/ComputeSharp/Graphics/Resources/Views/TextureView3D{T}.cs index 9dfd0212..566cf60b 100644 --- a/src/ComputeSharp/Graphics/Resources/Views/TextureView3D{T}.cs +++ b/src/ComputeSharp/Graphics/Resources/Views/TextureView3D{T}.cs @@ -1,7 +1,7 @@ using System; using System.ComponentModel; using System.Runtime.CompilerServices; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; #pragma warning disable CS0809 diff --git a/src/ComputeSharp/Shaders/ComputeContext.cs b/src/ComputeSharp/Shaders/ComputeContext.cs index 602e82d8..a5ea5199 100644 --- a/src/ComputeSharp/Shaders/ComputeContext.cs +++ b/src/ComputeSharp/Shaders/ComputeContext.cs @@ -2,13 +2,13 @@ using System.Diagnostics.CodeAnalysis; using System.Runtime.CompilerServices; using System.Threading.Tasks; +using CommunityToolkit.Diagnostics; using ComputeSharp.__Internals; using ComputeSharp.Graphics.Commands; using ComputeSharp.Graphics.Extensions; using ComputeSharp.Shaders.Dispatching; using ComputeSharp.Shaders.Loading; using ComputeSharp.Shaders.Models; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.DirectX; #pragma warning disable CS0618 diff --git a/src/ComputeSharp/Shaders/Dispatching/ShaderBytecodeLoader.cs b/src/ComputeSharp/Shaders/Dispatching/ShaderBytecodeLoader.cs index 738ff406..03c69b94 100644 --- a/src/ComputeSharp/Shaders/Dispatching/ShaderBytecodeLoader.cs +++ b/src/ComputeSharp/Shaders/Dispatching/ShaderBytecodeLoader.cs @@ -1,8 +1,8 @@ using System; using System.Runtime.CompilerServices; +using CommunityToolkit.Diagnostics; using ComputeSharp.__Internals; using ComputeSharp.Shaders.Models; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.DirectX; #pragma warning disable CS0618 diff --git a/src/ComputeSharp/Shaders/Dispatching/ShaderDispatchMetadataLoader.cs b/src/ComputeSharp/Shaders/Dispatching/ShaderDispatchMetadataLoader.cs index e78a0593..4c841e64 100644 --- a/src/ComputeSharp/Shaders/Dispatching/ShaderDispatchMetadataLoader.cs +++ b/src/ComputeSharp/Shaders/Dispatching/ShaderDispatchMetadataLoader.cs @@ -1,9 +1,9 @@ using System; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using CommunityToolkit.Diagnostics; using ComputeSharp.Shaders.Extensions; using ComputeSharp.__Internals; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.DirectX; using TerraFX.Interop.Windows; diff --git a/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs b/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs index 2ee2537f..52714968 100644 --- a/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs +++ b/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs @@ -1,7 +1,7 @@ using System.Runtime.CompilerServices; +using CommunityToolkit.Diagnostics; using ComputeSharp.__Internals; using ComputeSharp.Graphics.Helpers; -using Microsoft.Toolkit.Diagnostics; using TerraFX.Interop.DirectX; #pragma warning disable CS0618 diff --git a/tests/ComputeSharp.Tests/Extensions/DeviceExtensions.cs b/tests/ComputeSharp.Tests/Extensions/DeviceExtensions.cs index a55741ef..3996fa5e 100644 --- a/tests/ComputeSharp.Tests/Extensions/DeviceExtensions.cs +++ b/tests/ComputeSharp.Tests/Extensions/DeviceExtensions.cs @@ -1,5 +1,5 @@ using System.Linq; -using Microsoft.Toolkit.Diagnostics; +using CommunityToolkit.Diagnostics; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ComputeSharp.Tests.Extensions; diff --git a/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs b/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs index 785bc763..bf4a3ddc 100644 --- a/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs +++ b/tests/ComputeSharp.Tests/Extensions/ImagingExtensions.cs @@ -1,7 +1,7 @@ using System; using System.Runtime.InteropServices; +using CommunityToolkit.Diagnostics; using ComputeSharp.Resources; -using Microsoft.Toolkit.Diagnostics; using Microsoft.VisualStudio.TestTools.UnitTesting; using SixLabors.ImageSharp; using SixLabors.ImageSharp.PixelFormats; From e6aad7e0edcbe0cd676fd1d71e1221bd46862045 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 29 Jan 2022 12:59:10 +0100 Subject: [PATCH 2/6] Switch to CommunityToolkit.HighPerformance 8.0.0 Preview 1 --- tests/ComputeSharp.Tests/ComputeContextTests.cs | 2 +- tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj | 2 +- tests/ComputeSharp.Tests/ImagingTests.cs | 2 +- tests/ComputeSharp.Tests/Texture2DTests.cs | 2 +- tests/ComputeSharp.Tests/Texture3DTests.cs | 2 +- tests/ComputeSharp.Tests/TransferBufferTests.cs | 2 +- tests/ComputeSharp.Tests/TransferTexture2DTests.cs | 2 +- tests/ComputeSharp.Tests/TransferTexture3DTests.cs | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/tests/ComputeSharp.Tests/ComputeContextTests.cs b/tests/ComputeSharp.Tests/ComputeContextTests.cs index d4fffa3b..23a1f5bc 100644 --- a/tests/ComputeSharp.Tests/ComputeContextTests.cs +++ b/tests/ComputeSharp.Tests/ComputeContextTests.cs @@ -3,10 +3,10 @@ using System.IO; using System.Linq; using System.Reflection; using System.Threading.Tasks; +using CommunityToolkit.HighPerformance; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; using ComputeSharp.Tests.Helpers; -using Microsoft.Toolkit.HighPerformance; using Microsoft.VisualStudio.TestTools.UnitTesting; using SixLabors.ImageSharp; using ImageSharpRgba32 = SixLabors.ImageSharp.PixelFormats.Rgba32; diff --git a/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj b/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj index ec714ef8..d492efb6 100644 --- a/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj +++ b/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj @@ -7,8 +7,8 @@ + - diff --git a/tests/ComputeSharp.Tests/ImagingTests.cs b/tests/ComputeSharp.Tests/ImagingTests.cs index 867993c9..e301aa2d 100644 --- a/tests/ComputeSharp.Tests/ImagingTests.cs +++ b/tests/ComputeSharp.Tests/ImagingTests.cs @@ -5,6 +5,7 @@ using System.IO; using System.Reflection; using System.Runtime.CompilerServices; using System.Text; +using CommunityToolkit.HighPerformance.Buffers; using ComputeSharp.Resources; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; @@ -15,7 +16,6 @@ using SixLabors.ImageSharp.PixelFormats; using ImageSharpRgba32 = SixLabors.ImageSharp.PixelFormats.Rgba32; using ImageSharpBgra32 = SixLabors.ImageSharp.PixelFormats.Bgra32; using ImageSharpL8 = SixLabors.ImageSharp.PixelFormats.L8; -using Microsoft.Toolkit.HighPerformance.Buffers; namespace ComputeSharp.Tests; diff --git a/tests/ComputeSharp.Tests/Texture2DTests.cs b/tests/ComputeSharp.Tests/Texture2DTests.cs index bae22587..32d782f7 100644 --- a/tests/ComputeSharp.Tests/Texture2DTests.cs +++ b/tests/ComputeSharp.Tests/Texture2DTests.cs @@ -1,9 +1,9 @@ using System; using System.Linq; +using CommunityToolkit.HighPerformance; using ComputeSharp.Resources; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; -using Microsoft.Toolkit.HighPerformance; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ComputeSharp.Tests; diff --git a/tests/ComputeSharp.Tests/Texture3DTests.cs b/tests/ComputeSharp.Tests/Texture3DTests.cs index 07094ef1..c05252bc 100644 --- a/tests/ComputeSharp.Tests/Texture3DTests.cs +++ b/tests/ComputeSharp.Tests/Texture3DTests.cs @@ -1,9 +1,9 @@ using System; using System.Linq; +using CommunityToolkit.HighPerformance; using ComputeSharp.Resources; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; -using Microsoft.Toolkit.HighPerformance; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ComputeSharp.Tests; diff --git a/tests/ComputeSharp.Tests/TransferBufferTests.cs b/tests/ComputeSharp.Tests/TransferBufferTests.cs index ee8620ad..9d454bb4 100644 --- a/tests/ComputeSharp.Tests/TransferBufferTests.cs +++ b/tests/ComputeSharp.Tests/TransferBufferTests.cs @@ -1,10 +1,10 @@ using System; using System.Linq; using System.Runtime.CompilerServices; +using CommunityToolkit.HighPerformance; using ComputeSharp.Resources; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; -using Microsoft.Toolkit.HighPerformance; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ComputeSharp.Tests; diff --git a/tests/ComputeSharp.Tests/TransferTexture2DTests.cs b/tests/ComputeSharp.Tests/TransferTexture2DTests.cs index 8650edf0..9b4de975 100644 --- a/tests/ComputeSharp.Tests/TransferTexture2DTests.cs +++ b/tests/ComputeSharp.Tests/TransferTexture2DTests.cs @@ -1,10 +1,10 @@ using System; using System.Linq; using System.Runtime.CompilerServices; +using CommunityToolkit.HighPerformance; using ComputeSharp.Resources; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; -using Microsoft.Toolkit.HighPerformance; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ComputeSharp.Tests; diff --git a/tests/ComputeSharp.Tests/TransferTexture3DTests.cs b/tests/ComputeSharp.Tests/TransferTexture3DTests.cs index ac4b2211..ca13f03b 100644 --- a/tests/ComputeSharp.Tests/TransferTexture3DTests.cs +++ b/tests/ComputeSharp.Tests/TransferTexture3DTests.cs @@ -1,10 +1,10 @@ using System; using System.Linq; using System.Runtime.CompilerServices; +using CommunityToolkit.HighPerformance; using ComputeSharp.Resources; using ComputeSharp.Tests.Attributes; using ComputeSharp.Tests.Extensions; -using Microsoft.Toolkit.HighPerformance; using Microsoft.VisualStudio.TestTools.UnitTesting; namespace ComputeSharp.Tests; From d0e1df9d048328a70221377dede78d76a6e5c018 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 29 Jan 2022 13:26:44 +0100 Subject: [PATCH 3/6] Improve exceptions in ID3D12DescriptorHandleAllocator --- .../Interop/ID3D12DescriptorHandleAllocator.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12DescriptorHandleAllocator.cs b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12DescriptorHandleAllocator.cs index 3c869ad8..5591aba3 100644 --- a/src/ComputeSharp/Graphics/Commands/Interop/ID3D12DescriptorHandleAllocator.cs +++ b/src/ComputeSharp/Graphics/Commands/Interop/ID3D12DescriptorHandleAllocator.cs @@ -94,7 +94,10 @@ internal unsafe struct ID3D12DescriptorHandleAllocator : IDisposable { lock (this.d3D12DescriptorHandlePairs) { - Guard.IsGreaterThan(this.size, 0, nameof(size)); + if (this.size <= 0) + { + ThrowHelper.ThrowInvalidOperationException("There are no descriptor handles left in the pool."); + } d3D12ResourceDescriptorHandles = this.d3D12DescriptorHandlePairs[this.head++]; @@ -115,7 +118,10 @@ internal unsafe struct ID3D12DescriptorHandleAllocator : IDisposable { lock (this.d3D12DescriptorHandlePairs) { - Guard.IsLessThan(this.size, DescriptorsPerHeap, nameof(size)); + if (this.size >= DescriptorsPerHeap) + { + ThrowHelper.ThrowInvalidOperationException("The pool of descriptor heaps is already full."); + } this.d3D12DescriptorHandlePairs[this.tail++] = d3D12ResourceDescriptorHandles; From 6ff4b3103cf4eeb83802c4f40e5dd5229e3b8162 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 29 Jan 2022 15:14:17 +0100 Subject: [PATCH 4/6] Leverage [CallerArgumentExpression] to remove nameof(...) uses --- .../ViewModels/MainViewModel.cs | 2 +- .../Extensions/AssemblyExtensions.cs | 4 +- .../Helpers/SwapChainManager.Rendering.cs | 2 +- src/ComputeSharp.UI/ShaderRunner{T}.cs | 4 +- .../Graphics/Extensions/BufferExtensions.cs | 46 ++-- .../GraphicsDeviceExtensions.Dispatching.cs | 18 +- .../GraphicsDeviceExtensions.Resources.cs | 212 +++++++++--------- .../Extensions/ReadBackBufferExtensions.cs | 8 +- .../Extensions/ReadBackTexture2DExtensions.cs | 26 +-- .../Extensions/ReadBackTexture3DExtensions.cs | 12 +- .../ReadWriteTexture2DExtensions.cs | 10 +- .../ReadWriteTexture3DExtensions.cs | 10 +- .../Extensions/StructuredBufferExtensions.cs | 16 +- .../Extensions/Texture2DExtensions.cs | 134 +++++------ .../Extensions/Texture3DExtensions.cs | 110 ++++----- .../Extensions/UploadBufferExtensions.cs | 8 +- .../Extensions/UploadTexture2DExtensions.cs | 24 +- .../Extensions/UploadTexture3DExtensions.cs | 12 +- .../Graphics/GraphicsDevice.GetDevice.cs | 2 +- .../__Internals/GraphicsResourceHelper.cs | 22 +- .../Graphics/Resources/Abstract/Buffer{T}.cs | 4 +- .../Resources/Abstract/StructuredBuffer{T}.cs | 32 +-- .../Resources/Abstract/Texture2D{T}.cs | 72 +++--- .../Resources/Abstract/Texture3D{T}.cs | 106 ++++----- .../Resources/Abstract/TransferBuffer{T}.cs | 4 +- .../Abstract/TransferTexture2D{T}.cs | 4 +- .../Abstract/TransferTexture3D{T}.cs | 6 +- .../Graphics/Resources/ConstantBuffer{T}.cs | 16 +- .../Resources/Views/TextureView2D{T}.cs | 8 +- .../Resources/Views/TextureView3D{T}.cs | 12 +- src/ComputeSharp/Shaders/ComputeContext.cs | 16 +- .../ShaderDispatchMetadataLoader.cs | 2 +- .../Extensions/ComputeContextExtensions.cs | 60 ++--- 33 files changed, 512 insertions(+), 512 deletions(-) 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); From 6559ad31d0cef2a162507ec57ec0fa6bdbf388b1 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 29 Jan 2022 15:22:04 +0100 Subject: [PATCH 5/6] Update remaining NuGet packages --- .../ComputeSharp.SwapChain.Uwp.csproj | 2 +- .../ComputeSharp.SwapChain.WinUI.csproj | 2 +- .../ComputeSharp.Tests.DisableDynamicCompilation.csproj | 4 ++-- .../ComputeSharp.Tests.Internals.csproj | 4 ++-- .../ComputeSharp.Tests.NativeLibrariesResolver.csproj | 4 ++-- .../ComputeSharp.Tests.SourceGenerators.csproj | 4 ++-- tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj | 4 ++-- 7 files changed, 12 insertions(+), 12 deletions(-) diff --git a/samples/ComputeSharp.SwapChain.Uwp/ComputeSharp.SwapChain.Uwp.csproj b/samples/ComputeSharp.SwapChain.Uwp/ComputeSharp.SwapChain.Uwp.csproj index f854920d..7470e9ad 100644 --- a/samples/ComputeSharp.SwapChain.Uwp/ComputeSharp.SwapChain.Uwp.csproj +++ b/samples/ComputeSharp.SwapChain.Uwp/ComputeSharp.SwapChain.Uwp.csproj @@ -205,7 +205,7 @@ - 7.1.2 + 8.0.0-preview1 4.5.0 diff --git a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj index c27be298..f9267f0c 100644 --- a/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj +++ b/samples/ComputeSharp.SwapChain.WinUI/ComputeSharp.SwapChain.WinUI.csproj @@ -34,7 +34,7 @@ - + diff --git a/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj b/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj index 6c45efbd..7e8c771b 100644 --- a/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj +++ b/tests/ComputeSharp.Tests.DisableDynamicCompilation/ComputeSharp.Tests.DisableDynamicCompilation.csproj @@ -9,8 +9,8 @@ - - + + diff --git a/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj b/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj index 156a2712..5102ca5b 100644 --- a/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj +++ b/tests/ComputeSharp.Tests.Internals/ComputeSharp.Tests.Internals.csproj @@ -8,8 +8,8 @@ - - + + diff --git a/tests/ComputeSharp.Tests.NativeLibrariesResolver/ComputeSharp.Tests.NativeLibrariesResolver.csproj b/tests/ComputeSharp.Tests.NativeLibrariesResolver/ComputeSharp.Tests.NativeLibrariesResolver.csproj index 1ef96755..1ffb39a8 100644 --- a/tests/ComputeSharp.Tests.NativeLibrariesResolver/ComputeSharp.Tests.NativeLibrariesResolver.csproj +++ b/tests/ComputeSharp.Tests.NativeLibrariesResolver/ComputeSharp.Tests.NativeLibrariesResolver.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/tests/ComputeSharp.Tests.SourceGenerators/ComputeSharp.Tests.SourceGenerators.csproj b/tests/ComputeSharp.Tests.SourceGenerators/ComputeSharp.Tests.SourceGenerators.csproj index f246d2c8..b4838cce 100644 --- a/tests/ComputeSharp.Tests.SourceGenerators/ComputeSharp.Tests.SourceGenerators.csproj +++ b/tests/ComputeSharp.Tests.SourceGenerators/ComputeSharp.Tests.SourceGenerators.csproj @@ -7,8 +7,8 @@ - - + + diff --git a/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj b/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj index d492efb6..9d55a9ad 100644 --- a/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj +++ b/tests/ComputeSharp.Tests/ComputeSharp.Tests.csproj @@ -9,8 +9,8 @@ - - + + From 6281c73959ca3139c31d289f50f124df7e1d37a6 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 29 Jan 2022 15:25:06 +0100 Subject: [PATCH 6/6] Update readme for .NET Community Toolkit --- README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 646df712..7458013b 100644 --- a/README.md +++ b/README.md @@ -434,6 +434,7 @@ Huge thanks to these sponsors for directly supporting my work on **ComputeSharp* Additionally, **ComputeSharp** uses NuGet packages from the following repositories: -- [Microsoft.Toolkit.Diagnostics](https://github.com/windows-toolkit/WindowsCommunityToolkit) +- [.NET Community Toolkit](https://aka.ms/toolkit/dotnet) +- [Windows Community Toolkit](https://aka.ms/toolkit/windows) - [TerraFX.Interop.Windows](https://github.com/terrafx/terrafx.interop.windows) - [TerraFX.Interop.D3D12MemoryAllocator](https://github.com/terrafx/terrafx.interop.d3d12memoryallocator)