Switch to ArgumentNullException.ThrowIfNull extension

このコミットが含まれているのは:
Sergio Pedri committed 2023-02-25 16:20:04 +01:00
1 親 cb1e4c3b96
コミット 6f7bbff6cf
24ファイル変更
+556 -503

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

+62
ファイルの表示
@@ -0,0 +1,62 @@
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
namespace System;
/// <summary>
/// Throw helper extensions for <see cref="ArgumentNullException"/>.
/// </summary>
internal static class ArgumentNullExceptionExtensions
{
/// <summary>
/// Throws an <see cref="ArgumentNullException"/> for a given parameter name.
/// </summary>
/// <param name="_">Dummy value to invoke the extension upon (always pass <see langword="null"/>.</param>
/// <param name="parameterName">The name of the parameter to report in the exception.</param>
/// <exception cref="ArgumentNullException">Thrown with <paramref name="parameterName"/>.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
[DoesNotReturn]
public static void Throw(this ArgumentNullException? _, string? parameterName)
{
Throw(parameterName);
}
/// <summary>
/// Throws an <see cref="ArgumentNullException"/> if <paramref name="argument"/> is <see langword="null"/>.
/// </summary>
/// <param name="_">Dummy value to invoke the extension upon (always pass <see langword="null"/>.</param>
/// <param name="argument">The reference type argument to validate as non-<see langword="null"/>.</param>
/// <param name="parameterName">The name of the parameter with which <paramref name="argument"/> corresponds.</param>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="argument"/> is <see langword="null"/>.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static void ThrowIfNull(this ArgumentNullException? _, [NotNull] object? argument, [CallerArgumentExpression(nameof(argument))] string? parameterName = null)
{
if (argument is null)
{
Throw(parameterName);
}
}
/// <summary>
/// Throws an <see cref="ArgumentNullException"/> if <paramref name="argument"/> is <see langword="null"/>.
/// </summary>
/// <param name="_">Dummy value to invoke the extension upon (always pass <see langword="null"/>.</param>
/// <param name="argument">The pointer argument to validate as non-<see langword="null"/>.</param>
/// <param name="parameterName">The name of the parameter with which <paramref name="argument"/> corresponds.</param>
/// <exception cref="ArgumentNullException">Thrown if <paramref name="argument"/> is <see langword="null"/>.</exception>
[MethodImpl(MethodImplOptions.AggressiveInlining)]
public static unsafe void ThrowIfNull(this ArgumentNullException? _, [NotNull] void* argument, [CallerArgumentExpression(nameof(argument))] string? parameterName = null)
{
if (argument is null)
{
Throw(parameterName);
}
}
/// <inheritdoc cref="Throw(ArgumentNullException?, string?)"/>
[DoesNotReturn]
public static void Throw(string? parameterName)
{
throw new ArgumentNullException(parameterName);
}
}
+1 -2
ファイルの表示
@@ -2,7 +2,6 @@ using System;
using System.Diagnostics;
using System.Runtime.CompilerServices;
using System.Threading;
using CommunityToolkit.Diagnostics;
using ComputeSharp.Interop;
#if WINDOWS_UWP
using ComputeSharp.Uwp.Extensions;
@@ -28,7 +27,7 @@ partial class SwapChainManager<TOwner>
/// <param name="shaderRunner">The <see cref="IShaderRunner"/> instance to use to render frames.</param>
public async void StartRenderLoop(IFrameRequestQueue? frameRequestQueue, IShaderRunner shaderRunner)
{
Guard.IsNotNull(shaderRunner);
default(ArgumentNullException).ThrowIfNull(shaderRunner);
using (await this.setupSemaphore.LockAsync())
{
+2 -3
ファイルの表示
@@ -1,5 +1,4 @@
using System;
using CommunityToolkit.Diagnostics;
#if WINDOWS_UWP
namespace ComputeSharp.Uwp;
@@ -40,7 +39,7 @@ public sealed class ShaderRunner<T> : IShaderRunner
/// <param name="shaderFactory">The <see cref="Func{T1,TResult}"/> instance used to create shaders to run.</param>
public ShaderRunner(Func<TimeSpan, T> shaderFactory)
{
Guard.IsNotNull(shaderFactory);
default(ArgumentNullException).ThrowIfNull(shaderFactory);
this.shaderFactory = shaderFactory;
}
@@ -51,7 +50,7 @@ public sealed class ShaderRunner<T> : IShaderRunner
/// <param name="shaderFactory">The <see cref="Func{T1,T2,TResult}"/> instance used to create shaders to run.</param>
public ShaderRunner(Func<TimeSpan, object?, T> shaderFactory)
{
Guard.IsNotNull(shaderFactory);
default(ArgumentNullException).ThrowIfNull(shaderFactory);
this.statefulShaderFactory = shaderFactory;
}
+22 -22
ファイルの表示
@@ -22,7 +22,7 @@ public static class BufferExtensions
public static T[] ToArray<T>(this Buffer<T> source)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(source);
return source.ToArray(0, source.Length);
}
@@ -38,7 +38,7 @@ public static class BufferExtensions
public static T[] ToArray<T>(this Buffer<T> source, int offset, int count)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(source);
Guard.IsGreaterThanOrEqualTo(count, 0);
T[] data = GC.AllocateUninitializedArray<T>(count);
@@ -57,8 +57,8 @@ public static class BufferExtensions
public static void CopyTo<T>(this Buffer<T> source, T[] destination)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination.AsSpan(), 0);
}
@@ -75,8 +75,8 @@ public static class BufferExtensions
public static void CopyTo<T>(this Buffer<T> source, T[] destination, int sourceOffset, int destinationOffset, int count)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
Span<T> span = destination.AsSpan(destinationOffset, count);
@@ -92,7 +92,7 @@ public static class BufferExtensions
public static void CopyTo<T>(this Buffer<T> source, Span<T> destination)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, 0);
}
@@ -107,7 +107,7 @@ public static class BufferExtensions
public static void CopyTo<T>(this Buffer<T> source, Span<T> destination, int sourceOffset)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(ref MemoryMarshal.GetReference(destination), sourceOffset, destination.Length);
}
@@ -121,8 +121,8 @@ public static class BufferExtensions
public static void CopyTo<T>(this Buffer<T> source, Buffer<T> destination)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination, 0, 0, source.Length);
}
@@ -139,8 +139,8 @@ public static class BufferExtensions
public static void CopyTo<T>(this Buffer<T> source, Buffer<T> destination, int sourceOffset, int destinationOffset, int count)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination, sourceOffset, destinationOffset, count);
}
@@ -154,8 +154,8 @@ public static class BufferExtensions
public static void CopyFrom<T>(this Buffer<T> destination, T[] source)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source.AsSpan(), 0);
}
@@ -172,8 +172,8 @@ public static class BufferExtensions
public static void CopyFrom<T>(this Buffer<T> destination, T[] source, int sourceOffset, int destinationOffset, int count)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
ReadOnlySpan<T> span = source.AsSpan(sourceOffset, count);
@@ -189,7 +189,7 @@ public static class BufferExtensions
public static void CopyFrom<T>(this Buffer<T> destination, ReadOnlySpan<T> source)
where T : unmanaged
{
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(destination);
destination.CopyFrom(source, 0);
}
@@ -204,7 +204,7 @@ public static class BufferExtensions
public static void CopyFrom<T>(this Buffer<T> destination, ReadOnlySpan<T> source, int destinationOffset)
where T : unmanaged
{
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(destination);
destination.CopyFrom(ref MemoryMarshal.GetReference(source), destinationOffset, source.Length);
}
@@ -218,8 +218,8 @@ public static class BufferExtensions
public static void CopyFrom<T>(this Buffer<T> destination, Buffer<T> source)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, 0, 0, source.Length);
}
@@ -236,8 +236,8 @@ public static class BufferExtensions
public static void CopyFrom<T>(this Buffer<T> destination, Buffer<T> source, int sourceOffset, int destinationOffset, int count)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, sourceOffset, destinationOffset, count);
}
+10 -10
ファイルの表示
@@ -1,5 +1,5 @@
using System;
using System.Runtime.CompilerServices;
using CommunityToolkit.Diagnostics;
using ComputeSharp.Interop;
namespace ComputeSharp;
@@ -19,7 +19,7 @@ public static partial class GraphicsDeviceExtensions
public static void For<T>(this GraphicsDevice device, int x, in T shader)
where T : struct, IComputeShader
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
using ComputeContext context = device.CreateComputeContext();
@@ -37,7 +37,7 @@ public static partial class GraphicsDeviceExtensions
public static void For<T>(this GraphicsDevice device, int x, int y, in T shader)
where T : struct, IComputeShader
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
using ComputeContext context = device.CreateComputeContext();
@@ -56,7 +56,7 @@ public static partial class GraphicsDeviceExtensions
public static void For<T>(this GraphicsDevice device, int x, int y, int z, in T shader)
where T : struct, IComputeShader
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
using ComputeContext context = device.CreateComputeContext();
@@ -78,7 +78,7 @@ public static partial class GraphicsDeviceExtensions
public static void For<T>(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);
default(ArgumentNullException).ThrowIfNull(device);
using ComputeContext context = device.CreateComputeContext();
@@ -96,8 +96,8 @@ public static partial class GraphicsDeviceExtensions
where T : struct, IPixelShader<TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(texture);
using ComputeContext context = device.CreateComputeContext();
@@ -116,8 +116,8 @@ public static partial class GraphicsDeviceExtensions
where T : struct, IPixelShader<TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(texture);
using ComputeContext context = device.CreateComputeContext();
@@ -149,7 +149,7 @@ public static partial class GraphicsDeviceExtensions
/// </remarks>
public static ComputeContext CreateComputeContext(this GraphicsDevice device)
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
using ReferenceTracker.Lease _0 = device.GetReferenceTracker().GetLease();
+140 -141
ファイルの表示
@@ -1,7 +1,6 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using CommunityToolkit.Diagnostics;
using ComputeSharp.Graphics.Helpers;
using ComputeSharp.Resources;
@@ -22,7 +21,7 @@ partial class GraphicsDeviceExtensions
public static ConstantBuffer<T> AllocateConstantBuffer<T>(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, length, allocationMode);
}
@@ -38,8 +37,8 @@ partial class GraphicsDeviceExtensions
public static ConstantBuffer<T> AllocateConstantBuffer<T>(this GraphicsDevice device, T[] source)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateConstantBuffer<T>(source.AsSpan());
}
@@ -55,7 +54,7 @@ partial class GraphicsDeviceExtensions
public static ConstantBuffer<T> AllocateConstantBuffer<T>(this GraphicsDevice device, ReadOnlySpan<T> source)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
ConstantBuffer<T> buffer = new(device, source.Length, AllocationMode.Default);
@@ -75,8 +74,8 @@ partial class GraphicsDeviceExtensions
public static ConstantBuffer<T> AllocateConstantBuffer<T>(this GraphicsDevice device, Buffer<T> source)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
ConstantBuffer<T> constantBuffer = new(device, source.Length, AllocationMode.Default);
@@ -97,7 +96,7 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyBuffer<T> AllocateReadOnlyBuffer<T>(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, length, allocationMode);
}
@@ -113,8 +112,8 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyBuffer<T> AllocateReadOnlyBuffer<T>(this GraphicsDevice device, T[] source)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadOnlyBuffer<T>(source.AsSpan());
}
@@ -130,7 +129,7 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyBuffer<T> AllocateReadOnlyBuffer<T>(this GraphicsDevice device, ReadOnlySpan<T> source)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
ReadOnlyBuffer<T> buffer = new(device, source.Length, AllocationMode.Default);
@@ -150,8 +149,8 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyBuffer<T> AllocateReadOnlyBuffer<T>(this GraphicsDevice device, Buffer<T> source)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
ReadOnlyBuffer<T> readWriteBuffer = new(device, source.Length, AllocationMode.Default);
@@ -171,7 +170,7 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyTexture1D<T> AllocateReadOnlyTexture1D<T>(this GraphicsDevice device, int width, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, width, allocationMode);
}
@@ -187,8 +186,8 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyTexture1D<T> AllocateReadOnlyTexture1D<T>(this GraphicsDevice device, T[] source, int width)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadOnlyTexture1D<T>(source.AsSpan(0, width));
}
@@ -205,8 +204,8 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyTexture1D<T> AllocateReadOnlyTexture1D<T>(this GraphicsDevice device, T[] source, int offset, int width)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadOnlyTexture1D<T>(source.AsSpan(offset, width));
}
@@ -221,8 +220,8 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyTexture1D<T> AllocateReadOnlyTexture1D<T>(this GraphicsDevice device, T[] source)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
ReadOnlyTexture1D<T> texture = new(device, source.Length, AllocationMode.Default);
@@ -241,7 +240,7 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyTexture1D<T> AllocateReadOnlyTexture1D<T>(this GraphicsDevice device, ReadOnlySpan<T> source)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
ReadOnlyTexture1D<T> texture = new(device, source.Length, AllocationMode.Default);
@@ -263,7 +262,7 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, width, allocationMode);
}
@@ -281,8 +280,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadOnlyTexture1D<T, TPixel>(source.AsSpan(0, width));
}
@@ -301,8 +300,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadOnlyTexture1D<T, TPixel>(source.AsSpan(offset, width));
}
@@ -319,8 +318,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
ReadOnlyTexture1D<T, TPixel> texture = new(device, source.Length, AllocationMode.Default);
@@ -341,7 +340,7 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
ReadOnlyTexture1D<T, TPixel> texture = new(device, source.Length, AllocationMode.Default);
@@ -362,7 +361,7 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyTexture2D<T> AllocateReadOnlyTexture2D<T>(this GraphicsDevice device, int width, int height, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, width, height, allocationMode);
}
@@ -379,8 +378,8 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyTexture2D<T> AllocateReadOnlyTexture2D<T>(this GraphicsDevice device, T[] source, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadOnlyTexture2D<T>(source.AsSpan(), width, height);
}
@@ -398,8 +397,8 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyTexture2D<T> AllocateReadOnlyTexture2D<T>(this GraphicsDevice device, T[] source, int offset, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadOnlyTexture2D<T>(source.AsSpan(offset), width, height);
}
@@ -414,8 +413,8 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyTexture2D<T> AllocateReadOnlyTexture2D<T>(this GraphicsDevice device, T[,] source)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
ReadOnlyTexture2D<T> texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default);
@@ -436,7 +435,7 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyTexture2D<T> AllocateReadOnlyTexture2D<T>(this GraphicsDevice device, ReadOnlySpan<T> source, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
ReadOnlyTexture2D<T> texture = new(device, width, height, AllocationMode.Default);
@@ -459,7 +458,7 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, width, height, allocationMode);
}
@@ -478,8 +477,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadOnlyTexture2D<T, TPixel>(source.AsSpan(), width, height);
}
@@ -499,8 +498,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadOnlyTexture2D<T, TPixel>(source.AsSpan(offset), width, height);
}
@@ -517,8 +516,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
ReadOnlyTexture2D<T, TPixel> texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default);
@@ -541,7 +540,7 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
ReadOnlyTexture2D<T, TPixel> texture = new(device, width, height, AllocationMode.Default);
@@ -563,7 +562,7 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyTexture3D<T> AllocateReadOnlyTexture3D<T>(this GraphicsDevice device, int width, int height, int depth, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, width, height, depth, allocationMode);
}
@@ -581,8 +580,8 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyTexture3D<T> AllocateReadOnlyTexture3D<T>(this GraphicsDevice device, T[] source, int width, int height, int depth)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadOnlyTexture3D<T>(source.AsSpan(), width, height, depth);
}
@@ -601,8 +600,8 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyTexture3D<T> AllocateReadOnlyTexture3D<T>(this GraphicsDevice device, T[] source, int offset, int width, int height, int depth)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadOnlyTexture3D<T>(source.AsSpan(offset), width, height, depth);
}
@@ -621,8 +620,8 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyTexture3D<T> AllocateReadOnlyTexture3D<T>(this GraphicsDevice device, T[,,] source)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
ReadOnlyTexture3D<T> texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default);
@@ -644,7 +643,7 @@ partial class GraphicsDeviceExtensions
public static ReadOnlyTexture3D<T> AllocateReadOnlyTexture3D<T>(this GraphicsDevice device, ReadOnlySpan<T> source, int width, int height, int depth)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
ReadOnlyTexture3D<T> texture = new(device, width, height, depth, AllocationMode.Default);
@@ -668,7 +667,7 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, width, height, depth, allocationMode);
}
@@ -688,8 +687,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadOnlyTexture3D<T, TPixel>(source.AsSpan(), width, height, depth);
}
@@ -710,8 +709,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadOnlyTexture3D<T, TPixel>(source.AsSpan(offset), width, height, depth);
}
@@ -732,8 +731,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
ReadOnlyTexture3D<T, TPixel> texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default);
@@ -757,7 +756,7 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
ReadOnlyTexture3D<T, TPixel> texture = new(device, width, height, depth, AllocationMode.Default);
@@ -778,7 +777,7 @@ partial class GraphicsDeviceExtensions
public static ReadWriteBuffer<T> AllocateReadWriteBuffer<T>(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, length, allocationMode);
}
@@ -794,8 +793,8 @@ partial class GraphicsDeviceExtensions
public static ReadWriteBuffer<T> AllocateReadWriteBuffer<T>(this GraphicsDevice device, T[] source)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadWriteBuffer<T>(source.AsSpan());
}
@@ -811,7 +810,7 @@ partial class GraphicsDeviceExtensions
public static ReadWriteBuffer<T> AllocateReadWriteBuffer<T>(this GraphicsDevice device, ReadOnlySpan<T> source)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
ReadWriteBuffer<T> buffer = new(device, source.Length, AllocationMode.Default);
@@ -831,8 +830,8 @@ partial class GraphicsDeviceExtensions
public static ReadWriteBuffer<T> AllocateReadWriteBuffer<T>(this GraphicsDevice device, Buffer<T> source)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
ReadWriteBuffer<T> readWriteBuffer = new(device, source.Length, AllocationMode.Default);
@@ -852,7 +851,7 @@ partial class GraphicsDeviceExtensions
public static ReadWriteTexture1D<T> AllocateReadWriteTexture1D<T>(this GraphicsDevice device, int width, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, width, allocationMode);
}
@@ -868,8 +867,8 @@ partial class GraphicsDeviceExtensions
public static ReadWriteTexture1D<T> AllocateReadWriteTexture1D<T>(this GraphicsDevice device, T[] source, int width)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadWriteTexture1D<T>(source.AsSpan(0, width));
}
@@ -886,8 +885,8 @@ partial class GraphicsDeviceExtensions
public static ReadWriteTexture1D<T> AllocateReadWriteTexture1D<T>(this GraphicsDevice device, T[] source, int offset, int width)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadWriteTexture1D<T>(source.AsSpan(offset, width));
}
@@ -902,8 +901,8 @@ partial class GraphicsDeviceExtensions
public static ReadWriteTexture1D<T> AllocateReadWriteTexture1D<T>(this GraphicsDevice device, T[] source)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
ReadWriteTexture1D<T> texture = new(device, source.Length, AllocationMode.Default);
@@ -922,7 +921,7 @@ partial class GraphicsDeviceExtensions
public static ReadWriteTexture1D<T> AllocateReadWriteTexture1D<T>(this GraphicsDevice device, ReadOnlySpan<T> source)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
ReadWriteTexture1D<T> texture = new(device, source.Length, AllocationMode.Default);
@@ -944,7 +943,7 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, width, allocationMode);
}
@@ -962,8 +961,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadWriteTexture1D<T, TPixel>(source.AsSpan(0, width));
}
@@ -982,8 +981,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadWriteTexture1D<T, TPixel>(source.AsSpan(offset, width));
}
@@ -1000,8 +999,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
ReadWriteTexture1D<T, TPixel> texture = new(device, source.Length, AllocationMode.Default);
@@ -1022,7 +1021,7 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
ReadWriteTexture1D<T, TPixel> texture = new(device, source.Length, AllocationMode.Default);
@@ -1043,7 +1042,7 @@ partial class GraphicsDeviceExtensions
public static ReadWriteTexture2D<T> AllocateReadWriteTexture2D<T>(this GraphicsDevice device, int width, int height, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, width, height, allocationMode);
}
@@ -1060,8 +1059,8 @@ partial class GraphicsDeviceExtensions
public static ReadWriteTexture2D<T> AllocateReadWriteTexture2D<T>(this GraphicsDevice device, T[] source, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadWriteTexture2D<T>(source.AsSpan(), width, height);
}
@@ -1079,8 +1078,8 @@ partial class GraphicsDeviceExtensions
public static ReadWriteTexture2D<T> AllocateReadWriteTexture2D<T>(this GraphicsDevice device, T[] source, int offset, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadWriteTexture2D<T>(source.AsSpan(offset), width, height);
}
@@ -1095,8 +1094,8 @@ partial class GraphicsDeviceExtensions
public static ReadWriteTexture2D<T> AllocateReadWriteTexture2D<T>(this GraphicsDevice device, T[,] source)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
ReadWriteTexture2D<T> texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default);
@@ -1117,7 +1116,7 @@ partial class GraphicsDeviceExtensions
public static ReadWriteTexture2D<T> AllocateReadWriteTexture2D<T>(this GraphicsDevice device, ReadOnlySpan<T> source, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
ReadWriteTexture2D<T> texture = new(device, width, height, AllocationMode.Default);
@@ -1140,7 +1139,7 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, width, height, allocationMode);
}
@@ -1159,8 +1158,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadWriteTexture2D<T, TPixel>(source.AsSpan(), width, height);
}
@@ -1180,8 +1179,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadWriteTexture2D<T, TPixel>(source.AsSpan(offset), width, height);
}
@@ -1198,8 +1197,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
ReadWriteTexture2D<T, TPixel> texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default);
@@ -1222,7 +1221,7 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
ReadWriteTexture2D<T, TPixel> texture = new(device, width, height, AllocationMode.Default);
@@ -1244,7 +1243,7 @@ partial class GraphicsDeviceExtensions
public static ReadWriteTexture3D<T> AllocateReadWriteTexture3D<T>(this GraphicsDevice device, int width, int height, int depth, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, width, height, depth, allocationMode);
}
@@ -1262,8 +1261,8 @@ partial class GraphicsDeviceExtensions
public static ReadWriteTexture3D<T> AllocateReadWriteTexture3D<T>(this GraphicsDevice device, T[] source, int width, int height, int depth)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadWriteTexture3D<T>(source.AsSpan(), width, height, depth);
}
@@ -1282,8 +1281,8 @@ partial class GraphicsDeviceExtensions
public static ReadWriteTexture3D<T> AllocateReadWriteTexture3D<T>(this GraphicsDevice device, T[] source, int offset, int width, int height, int depth)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadWriteTexture3D<T>(source.AsSpan(offset), width, height, depth);
}
@@ -1302,8 +1301,8 @@ partial class GraphicsDeviceExtensions
public static ReadWriteTexture3D<T> AllocateReadWriteTexture3D<T>(this GraphicsDevice device, T[,,] source)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
ReadWriteTexture3D<T> texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default);
@@ -1325,7 +1324,7 @@ partial class GraphicsDeviceExtensions
public static ReadWriteTexture3D<T> AllocateReadWriteTexture3D<T>(this GraphicsDevice device, ReadOnlySpan<T> source, int width, int height, int depth)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
ReadWriteTexture3D<T> texture = new(device, width, height, depth, AllocationMode.Default);
@@ -1349,7 +1348,7 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, width, height, depth, allocationMode);
}
@@ -1369,8 +1368,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadWriteTexture3D<T, TPixel>(source.AsSpan(), width, height, depth);
}
@@ -1391,8 +1390,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
return device.AllocateReadWriteTexture3D<T, TPixel>(source.AsSpan(offset), width, height, depth);
}
@@ -1413,8 +1412,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(source);
ReadWriteTexture3D<T, TPixel> texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default);
@@ -1438,7 +1437,7 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
ReadWriteTexture3D<T, TPixel> texture = new(device, width, height, depth, AllocationMode.Default);
@@ -1459,7 +1458,7 @@ partial class GraphicsDeviceExtensions
public static UploadBuffer<T> AllocateUploadBuffer<T>(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, length, allocationMode);
}
@@ -1475,7 +1474,7 @@ partial class GraphicsDeviceExtensions
public static UploadTexture1D<T> AllocateUploadTexture1D<T>(this GraphicsDevice device, int width, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, width, allocationMode);
}
@@ -1492,7 +1491,7 @@ partial class GraphicsDeviceExtensions
public static UploadTexture2D<T> AllocateUploadTexture2D<T>(this GraphicsDevice device, int width, int height, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, width, height, allocationMode);
}
@@ -1510,7 +1509,7 @@ partial class GraphicsDeviceExtensions
public static UploadTexture3D<T> AllocateUploadTexture3D<T>(this GraphicsDevice device, int width, int height, int depth, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, width, height, depth, allocationMode);
}
@@ -1527,7 +1526,7 @@ partial class GraphicsDeviceExtensions
public static ReadBackBuffer<T> AllocateReadBackBuffer<T>(this GraphicsDevice device, int length, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, length, allocationMode);
}
@@ -1543,7 +1542,7 @@ partial class GraphicsDeviceExtensions
public static ReadBackTexture1D<T> AllocateReadBackTexture1D<T>(this GraphicsDevice device, int width, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, width, allocationMode);
}
@@ -1560,7 +1559,7 @@ partial class GraphicsDeviceExtensions
public static ReadBackTexture2D<T> AllocateReadBackTexture2D<T>(this GraphicsDevice device, int width, int height, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, width, height, allocationMode);
}
@@ -1578,7 +1577,7 @@ partial class GraphicsDeviceExtensions
public static ReadBackTexture3D<T> AllocateReadBackTexture3D<T>(this GraphicsDevice device, int width, int height, int depth, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return new(device, width, height, depth, allocationMode);
}
@@ -1595,8 +1594,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(filename);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(filename);
return device.LoadReadOnlyTexture2D<T, TPixel>(filename.AsSpan());
}
@@ -1613,7 +1612,7 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
using UploadTexture2D<T> upload = WICHelper.Instance.LoadTexture<T>(device, filename);
@@ -1636,7 +1635,7 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
using UploadTexture2D<T> upload = WICHelper.Instance.LoadTexture<T>(device, span);
@@ -1659,8 +1658,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(stream);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(stream);
using UploadTexture2D<T> upload = WICHelper.Instance.LoadTexture<T>(device, stream);
@@ -1683,8 +1682,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(filename);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(filename);
return device.LoadReadWriteTexture2D<T, TPixel>(filename.AsSpan());
}
@@ -1701,7 +1700,7 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
using UploadTexture2D<T> upload = WICHelper.Instance.LoadTexture<T>(device, filename);
@@ -1724,7 +1723,7 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
using UploadTexture2D<T> upload = WICHelper.Instance.LoadTexture<T>(device, span);
@@ -1747,8 +1746,8 @@ partial class GraphicsDeviceExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(stream);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(stream);
using UploadTexture2D<T> upload = WICHelper.Instance.LoadTexture<T>(device, stream);
@@ -1769,8 +1768,8 @@ partial class GraphicsDeviceExtensions
public static UploadTexture2D<T> LoadUploadTexture2D<T>(this GraphicsDevice device, string filename)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(filename);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(filename);
return device.LoadUploadTexture2D<T>(filename.AsSpan());
}
@@ -1785,7 +1784,7 @@ partial class GraphicsDeviceExtensions
public static UploadTexture2D<T> LoadUploadTexture2D<T>(this GraphicsDevice device, ReadOnlySpan<char> filename)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return WICHelper.Instance.LoadTexture<T>(device, filename);
}
@@ -1800,7 +1799,7 @@ partial class GraphicsDeviceExtensions
public static UploadTexture2D<T> LoadUploadTexture2D<T>(this GraphicsDevice device, ReadOnlySpan<byte> span)
where T : unmanaged
{
Guard.IsNotNull(device);
default(ArgumentNullException).ThrowIfNull(device);
return WICHelper.Instance.LoadTexture<T>(device, span);
}
@@ -1815,8 +1814,8 @@ partial class GraphicsDeviceExtensions
public static UploadTexture2D<T> LoadUploadTexture2D<T>(this GraphicsDevice device, Stream stream)
where T : unmanaged
{
Guard.IsNotNull(device);
Guard.IsNotNull(stream);
default(ArgumentNullException).ThrowIfNull(device);
default(ArgumentNullException).ThrowIfNull(stream);
return WICHelper.Instance.LoadTexture<T>(device, stream);
}
+5 -5
ファイルの表示
@@ -1,4 +1,4 @@
using CommunityToolkit.Diagnostics;
using System;
using ComputeSharp.Resources;
namespace ComputeSharp;
@@ -17,8 +17,8 @@ public static class ReadBackBufferExtensions
public static void CopyFrom<T>(this ReadBackBuffer<T> destination, StructuredBuffer<T> source)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, 0, 0, source.Length);
}
@@ -35,8 +35,8 @@ public static class ReadBackBufferExtensions
public static void CopyFrom<T>(this ReadBackBuffer<T> destination, StructuredBuffer<T> source, int sourceOffset, int destinationOffset, int count)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, sourceOffset, destinationOffset, count);
}
+7 -7
ファイルの表示
@@ -1,4 +1,4 @@
using CommunityToolkit.Diagnostics;
using System;
using ComputeSharp.Resources;
namespace ComputeSharp;
@@ -17,8 +17,8 @@ public static class ReadBackTexture1DExtensions
public static void CopyFrom<T>(this ReadBackTexture1D<T> destination, Texture1D<T> source)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, 0, 0, source.Width);
}
@@ -34,8 +34,8 @@ public static class ReadBackTexture1DExtensions
public static void CopyFrom<T>(this ReadBackTexture1D<T> destination, Texture1D<T> source, int sourceOffsetX, int width)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, sourceOffsetX, 0, width);
}
@@ -52,8 +52,8 @@ public static class ReadBackTexture1DExtensions
public static void CopyFrom<T>(this ReadBackTexture1D<T> destination, Texture1D<T> source, int sourceOffsetX, int destinationOffsetX, int width)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, sourceOffsetX, destinationOffsetX, width);
}
+13 -14
ファイルの表示
@@ -1,7 +1,6 @@
using System;
using System.Buffers;
using System.IO;
using CommunityToolkit.Diagnostics;
using ComputeSharp.Graphics.Helpers;
using ComputeSharp.Resources;
@@ -21,8 +20,8 @@ public static class ReadBackTexture2DExtensions
public static void CopyFrom<T>(this ReadBackTexture2D<T> destination, Texture2D<T> source)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, 0, 0, 0, 0, source.Width, source.Height);
}
@@ -40,8 +39,8 @@ public static class ReadBackTexture2DExtensions
public static void CopyFrom<T>(this ReadBackTexture2D<T> destination, Texture2D<T> source, int sourceOffsetX, int sourceOffsetY, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, sourceOffsetX, sourceOffsetY, 0, 0, width, height);
}
@@ -61,8 +60,8 @@ public static class ReadBackTexture2DExtensions
public static void CopyFrom<T>(this ReadBackTexture2D<T> destination, Texture2D<T> source, int sourceOffsetX, int sourceOffsetY, int destinationOffsetX, int destinationOffsetY, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, sourceOffsetX, sourceOffsetY, destinationOffsetX, destinationOffsetY, width, height);
}
@@ -76,8 +75,8 @@ public static class ReadBackTexture2DExtensions
public static void Save<T>(this ReadBackTexture2D<T> texture, string filename)
where T : unmanaged
{
Guard.IsNotNull(texture);
Guard.IsNotNull(filename);
default(ArgumentNullException).ThrowIfNull(texture);
default(ArgumentNullException).ThrowIfNull(filename);
WICHelper.Instance.SaveTexture(texture.View, filename.AsSpan());
}
@@ -91,7 +90,7 @@ public static class ReadBackTexture2DExtensions
public static void Save<T>(this ReadBackTexture2D<T> texture, ReadOnlySpan<char> filename)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
WICHelper.Instance.SaveTexture(texture.View, filename);
}
@@ -106,8 +105,8 @@ public static class ReadBackTexture2DExtensions
public static void Save<T>(this ReadBackTexture2D<T> texture, Stream stream, ImageFormat format)
where T : unmanaged
{
Guard.IsNotNull(texture);
Guard.IsNotNull(stream);
default(ArgumentNullException).ThrowIfNull(texture);
default(ArgumentNullException).ThrowIfNull(stream);
WICHelper.Instance.SaveTexture(texture.View, stream, format);
}
@@ -122,8 +121,8 @@ public static class ReadBackTexture2DExtensions
public static void Save<T>(this ReadBackTexture2D<T> texture, IBufferWriter<byte> writer, ImageFormat format)
where T : unmanaged
{
Guard.IsNotNull(texture);
Guard.IsNotNull(writer);
default(ArgumentNullException).ThrowIfNull(texture);
default(ArgumentNullException).ThrowIfNull(writer);
WICHelper.Instance.SaveTexture(texture.View, writer, format);
}
+7 -7
ファイルの表示
@@ -1,4 +1,4 @@
using CommunityToolkit.Diagnostics;
using System;
using ComputeSharp.Resources;
namespace ComputeSharp;
@@ -17,8 +17,8 @@ public static class ReadBackTexture3DExtensions
public static void CopyFrom<T>(this ReadBackTexture3D<T> destination, Texture3D<T> source)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(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<T>(this ReadBackTexture3D<T> destination, Texture3D<T> source, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int width, int height, int depth)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(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<T>(this ReadBackTexture3D<T> destination, Texture3D<T> 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);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, sourceOffsetX, sourceOffsetY, sourceOffsetZ, destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth);
}
+5 -6
ファイルの表示
@@ -1,5 +1,4 @@
using System;
using CommunityToolkit.Diagnostics;
namespace ComputeSharp;
@@ -29,7 +28,7 @@ public static class ReadWriteTexture1DExtensions
/// <exception cref="InvalidOperationException">Thrown if the current instance is not in a readonly state.</exception>
public static IReadOnlyTexture1D<float> AsReadOnly(this ReadWriteTexture1D<float> texture)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
return texture.AsReadOnly();
}
@@ -55,7 +54,7 @@ public static class ReadWriteTexture1DExtensions
/// <exception cref="InvalidOperationException">Thrown if the current instance is not in a readonly state.</exception>
public static IReadOnlyTexture1D<Float2> AsReadOnly(this ReadWriteTexture1D<Float2> texture)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
return texture.AsReadOnly();
}
@@ -81,7 +80,7 @@ public static class ReadWriteTexture1DExtensions
/// <exception cref="InvalidOperationException">Thrown if the current instance is not in a readonly state.</exception>
public static IReadOnlyTexture1D<Float3> AsReadOnly(this ReadWriteTexture1D<Float3> texture)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
return texture.AsReadOnly();
}
@@ -107,7 +106,7 @@ public static class ReadWriteTexture1DExtensions
/// <exception cref="InvalidOperationException">Thrown if the current instance is not in a readonly state.</exception>
public static IReadOnlyTexture1D<Float4> AsReadOnly(this ReadWriteTexture1D<Float4> texture)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
return texture.AsReadOnly();
}
@@ -137,7 +136,7 @@ public static class ReadWriteTexture1DExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
return texture.AsReadOnly();
}
+5 -6
ファイルの表示
@@ -1,5 +1,4 @@
using System;
using CommunityToolkit.Diagnostics;
namespace ComputeSharp;
@@ -29,7 +28,7 @@ public static class ReadWriteTexture2DExtensions
/// <exception cref="InvalidOperationException">Thrown if the current instance is not in a readonly state.</exception>
public static IReadOnlyTexture2D<float> AsReadOnly(this ReadWriteTexture2D<float> texture)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
return texture.AsReadOnly();
}
@@ -55,7 +54,7 @@ public static class ReadWriteTexture2DExtensions
/// <exception cref="InvalidOperationException">Thrown if the current instance is not in a readonly state.</exception>
public static IReadOnlyTexture2D<Float2> AsReadOnly(this ReadWriteTexture2D<Float2> texture)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
return texture.AsReadOnly();
}
@@ -81,7 +80,7 @@ public static class ReadWriteTexture2DExtensions
/// <exception cref="InvalidOperationException">Thrown if the current instance is not in a readonly state.</exception>
public static IReadOnlyTexture2D<Float3> AsReadOnly(this ReadWriteTexture2D<Float3> texture)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
return texture.AsReadOnly();
}
@@ -107,7 +106,7 @@ public static class ReadWriteTexture2DExtensions
/// <exception cref="InvalidOperationException">Thrown if the current instance is not in a readonly state.</exception>
public static IReadOnlyTexture2D<Float4> AsReadOnly(this ReadWriteTexture2D<Float4> texture)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
return texture.AsReadOnly();
}
@@ -137,7 +136,7 @@ public static class ReadWriteTexture2DExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
return texture.AsReadOnly();
}
+5 -6
ファイルの表示
@@ -1,5 +1,4 @@
using System;
using CommunityToolkit.Diagnostics;
namespace ComputeSharp;
@@ -29,7 +28,7 @@ public static class ReadWriteTexture3DExtensions
/// <exception cref="InvalidOperationException">Thrown if the current instance is not in a readonly state.</exception>
public static IReadOnlyTexture3D<float> AsReadOnly(this ReadWriteTexture3D<float> texture)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
return texture.AsReadOnly();
}
@@ -55,7 +54,7 @@ public static class ReadWriteTexture3DExtensions
/// <exception cref="InvalidOperationException">Thrown if the current instance is not in a readonly state.</exception>
public static IReadOnlyTexture3D<Float2> AsReadOnly(this ReadWriteTexture3D<Float2> texture)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
return texture.AsReadOnly();
}
@@ -81,7 +80,7 @@ public static class ReadWriteTexture3DExtensions
/// <exception cref="InvalidOperationException">Thrown if the current instance is not in a readonly state.</exception>
public static IReadOnlyTexture3D<Float3> AsReadOnly(this ReadWriteTexture3D<Float3> texture)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
return texture.AsReadOnly();
}
@@ -107,7 +106,7 @@ public static class ReadWriteTexture3DExtensions
/// <exception cref="InvalidOperationException">Thrown if the current instance is not in a readonly state.</exception>
public static IReadOnlyTexture3D<Float4> AsReadOnly(this ReadWriteTexture3D<Float4> texture)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
return texture.AsReadOnly();
}
@@ -137,7 +136,7 @@ public static class ReadWriteTexture3DExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
return texture.AsReadOnly();
}
+9 -9
ファイルの表示
@@ -1,4 +1,4 @@
using CommunityToolkit.Diagnostics;
using System;
using ComputeSharp.Resources;
namespace ComputeSharp;
@@ -17,8 +17,8 @@ public static class StructuredBufferExtensions
public static void CopyTo<T>(this StructuredBuffer<T> source, ReadBackBuffer<T> destination)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination, 0, 0, source.Length);
}
@@ -35,8 +35,8 @@ public static class StructuredBufferExtensions
public static void CopyTo<T>(this StructuredBuffer<T> source, ReadBackBuffer<T> destination, int sourceOffset, int destinationOffset, int count)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination, sourceOffset, destinationOffset, count);
}
@@ -50,8 +50,8 @@ public static class StructuredBufferExtensions
public static void CopyFrom<T>(this StructuredBuffer<T> destination, UploadBuffer<T> source)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, 0, 0, source.Length);
}
@@ -68,8 +68,8 @@ public static class StructuredBufferExtensions
public static void CopyFrom<T>(this StructuredBuffer<T> destination, UploadBuffer<T> source, int sourceOffset, int destinationOffset, int count)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, sourceOffset, destinationOffset, count);
}
+54 -54
ファイルの表示
@@ -19,7 +19,7 @@ public static class Texture1DExtensions
public static T[] ToArray<T>(this Texture1D<T> source)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(source);
T[] data = new T[source.Width];
@@ -39,7 +39,7 @@ public static class Texture1DExtensions
public static unsafe T[] ToArray<T>(this Texture1D<T> source, int x, int width)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(source);
Guard.IsGreaterThanOrEqualTo(width, 0);
T[] data = new T[width];
@@ -61,8 +61,8 @@ public static class Texture1DExtensions
public static void CopyTo<T>(this Texture1D<T> source, T[] destination)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination.AsSpan(), 0, source.Width);
}
@@ -78,8 +78,8 @@ public static class Texture1DExtensions
public static void CopyTo<T>(this Texture1D<T> source, T[] destination, Range x)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination.AsSpan(), x);
}
@@ -96,8 +96,8 @@ public static class Texture1DExtensions
public static void CopyTo<T>(this Texture1D<T> source, T[] destination, int sourceOffsetX, int width)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination.AsSpan(), sourceOffsetX, width);
}
@@ -112,8 +112,8 @@ public static class Texture1DExtensions
public static void CopyTo<T>(this Texture1D<T> source, T[] destination, int destinationOffset)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination.AsSpan(destinationOffset), 0, source.Width);
}
@@ -130,8 +130,8 @@ public static class Texture1DExtensions
public static void CopyTo<T>(this Texture1D<T> source, T[] destination, int destinationOffset, Range x)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination.AsSpan(destinationOffset), x);
}
@@ -149,8 +149,8 @@ public static class Texture1DExtensions
public static void CopyTo<T>(this Texture1D<T> source, T[] destination, int destinationOffset, int sourceOffsetX, int width)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination.AsSpan(destinationOffset), sourceOffsetX, width);
}
@@ -165,7 +165,7 @@ public static class Texture1DExtensions
public static void CopyTo<T>(this Texture1D<T> source, Span<T> destination)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, 0, source.Width);
}
@@ -181,7 +181,7 @@ public static class Texture1DExtensions
public static void CopyTo<T>(this Texture1D<T> source, Span<T> destination, Range x)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(source);
(int offsetX, int width) = x.GetOffsetAndLength(source.Width);
@@ -200,7 +200,7 @@ public static class Texture1DExtensions
public static void CopyTo<T>(this Texture1D<T> source, Span<T> destination, int sourceOffsetX, int width)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(ref MemoryMarshal.GetReference(destination), destination.Length, sourceOffsetX, width);
}
@@ -214,8 +214,8 @@ public static class Texture1DExtensions
public static void CopyTo<T>(this Texture1D<T> source, Texture1D<T> destination)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination, 0, 0, source.Width);
}
@@ -231,8 +231,8 @@ public static class Texture1DExtensions
public static void CopyTo<T>(this Texture1D<T> source, Texture1D<T> destination, int sourceOffsetX, int width)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination, sourceOffsetX, 0, width);
}
@@ -249,8 +249,8 @@ public static class Texture1DExtensions
public static void CopyTo<T>(this Texture1D<T> source, Texture1D<T> destination, int sourceOffsetX, int destinationOffsetX, int width)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination, sourceOffsetX, destinationOffsetX, width);
}
@@ -264,8 +264,8 @@ public static class Texture1DExtensions
public static void CopyTo<T>(this Texture1D<T> source, ReadBackTexture1D<T> destination)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination, 0, 0, source.Width);
}
@@ -281,8 +281,8 @@ public static class Texture1DExtensions
public static void CopyTo<T>(this Texture1D<T> source, ReadBackTexture1D<T> destination, int sourceOffsetX, int width)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination, sourceOffsetX, 0, width);
}
@@ -299,8 +299,8 @@ public static class Texture1DExtensions
public static void CopyTo<T>(this Texture1D<T> source, ReadBackTexture1D<T> destination, int sourceOffsetX, int destinationOffsetX, int width)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination, sourceOffsetX, destinationOffsetX, width);
}
@@ -314,8 +314,8 @@ public static class Texture1DExtensions
public static void CopyFrom<T>(this Texture1D<T> destination, T[] source)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source.AsSpan(), 0, destination.Width);
}
@@ -331,8 +331,8 @@ public static class Texture1DExtensions
public static void CopyFrom<T>(this Texture1D<T> destination, T[] source, Range x)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source.AsSpan(), x);
}
@@ -349,8 +349,8 @@ public static class Texture1DExtensions
public static void CopyFrom<T>(this Texture1D<T> destination, T[] source, int destinationOffsetX, int width)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source.AsSpan(), destinationOffsetX, width);
}
@@ -367,8 +367,8 @@ public static class Texture1DExtensions
public static void CopyFrom<T>(this Texture1D<T> destination, T[] source, int sourceOffset, Range x)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source.AsSpan(sourceOffset), x);
}
@@ -386,8 +386,8 @@ public static class Texture1DExtensions
public static void CopyFrom<T>(this Texture1D<T> destination, T[] source, int sourceOffset, int destinationOffsetX, int width)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source.AsSpan(sourceOffset), destinationOffsetX, width);
}
@@ -402,7 +402,7 @@ public static class Texture1DExtensions
public static void CopyFrom<T>(this Texture1D<T> destination, ReadOnlySpan<T> source)
where T : unmanaged
{
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(destination);
destination.CopyFrom(source, 0, destination.Width);
}
@@ -418,7 +418,7 @@ public static class Texture1DExtensions
public static void CopyFrom<T>(this Texture1D<T> destination, ReadOnlySpan<T> source, Range x)
where T : unmanaged
{
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(destination);
(int offsetX, int width) = x.GetOffsetAndLength(destination.Width);
@@ -437,7 +437,7 @@ public static class Texture1DExtensions
public static void CopyFrom<T>(this Texture1D<T> destination, ReadOnlySpan<T> source, int destinationOffsetX, int width)
where T : unmanaged
{
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(destination);
destination.CopyFrom(ref MemoryMarshal.GetReference(source), source.Length, destinationOffsetX, width);
}
@@ -451,8 +451,8 @@ public static class Texture1DExtensions
public static void CopyFrom<T>(this Texture1D<T> destination, Texture1D<T> source)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source, 0, 0, source.Width);
}
@@ -468,8 +468,8 @@ public static class Texture1DExtensions
public static void CopyFrom<T>(this Texture1D<T> destination, Texture1D<T> source, int sourceOffsetX, int width)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, sourceOffsetX, 0, width);
}
@@ -486,8 +486,8 @@ public static class Texture1DExtensions
public static void CopyFrom<T>(this Texture1D<T> destination, Texture1D<T> source, int sourceOffsetX, int destinationOffsetX, int width)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, sourceOffsetX, destinationOffsetX, width);
}
@@ -501,8 +501,8 @@ public static class Texture1DExtensions
public static void CopyFrom<T>(this Texture1D<T> destination, UploadTexture1D<T> source)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, 0, 0, source.Width);
}
@@ -518,8 +518,8 @@ public static class Texture1DExtensions
public static void CopyFrom<T>(this Texture1D<T> destination, UploadTexture1D<T> source, int sourceOffsetX, int width)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source, sourceOffsetX, 0, width);
}
@@ -536,8 +536,8 @@ public static class Texture1DExtensions
public static void CopyFrom<T>(this Texture1D<T> destination, UploadTexture1D<T> source, int sourceOffsetX, int destinationOffsetX, int width)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source, sourceOffsetX, destinationOffsetX, width);
}
+65 -65
ファイルの表示
@@ -22,7 +22,7 @@ public static class Texture2DExtensions
public static T[,] ToArray<T>(this Texture2D<T> source)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(source);
T[,] data = new T[source.Height, source.Width];
@@ -44,7 +44,7 @@ public static class Texture2DExtensions
public static unsafe T[,] ToArray<T>(this Texture2D<T> source, int x, int y, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(source);
Guard.IsGreaterThanOrEqualTo(width, 0);
Guard.IsGreaterThanOrEqualTo(height, 0);
@@ -67,8 +67,8 @@ public static class Texture2DExtensions
public static void CopyTo<T>(this Texture2D<T> source, T[,] destination)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture2D<T> source, T[] destination)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination.AsSpan(), 0, 0, source.Width, source.Height);
}
@@ -102,8 +102,8 @@ public static class Texture2DExtensions
public static void CopyTo<T>(this Texture2D<T> source, T[] destination, Range x, Range y)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination.AsSpan(), x, y);
}
@@ -122,8 +122,8 @@ public static class Texture2DExtensions
public static void CopyTo<T>(this Texture2D<T> source, T[] destination, int sourceOffsetX, int sourceOffsetY, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination.AsSpan(), sourceOffsetX, sourceOffsetY, width, height);
}
@@ -138,8 +138,8 @@ public static class Texture2DExtensions
public static void CopyTo<T>(this Texture2D<T> source, T[] destination, int destinationOffset)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination.AsSpan(destinationOffset), 0, 0, source.Width, source.Height);
}
@@ -157,8 +157,8 @@ public static class Texture2DExtensions
public static void CopyTo<T>(this Texture2D<T> source, T[] destination, int destinationOffset, Range x, Range y)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination.AsSpan(destinationOffset), x, y);
}
@@ -178,8 +178,8 @@ public static class Texture2DExtensions
public static void CopyTo<T>(this Texture2D<T> source, T[] destination, int destinationOffset, int sourceOffsetX, int sourceOffsetY, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination.AsSpan(destinationOffset), sourceOffsetX, sourceOffsetY, width, height);
}
@@ -194,7 +194,7 @@ public static class Texture2DExtensions
public static void CopyTo<T>(this Texture2D<T> source, Span<T> destination)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, 0, 0, source.Width, source.Height);
}
@@ -211,7 +211,7 @@ public static class Texture2DExtensions
public static void CopyTo<T>(this Texture2D<T> source, Span<T> destination, Range x, Range y)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(source);
(int offsetX, int width) = x.GetOffsetAndLength(source.Width);
(int offsetY, int height) = y.GetOffsetAndLength(source.Height);
@@ -233,7 +233,7 @@ public static class Texture2DExtensions
public static void CopyTo<T>(this Texture2D<T> source, Span<T> destination, int sourceOffsetX, int sourceOffsetY, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture2D<T> source, Texture2D<T> destination)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination, 0, 0, 0, 0, source.Width, source.Height);
}
@@ -266,8 +266,8 @@ public static class Texture2DExtensions
public static void CopyTo<T>(this Texture2D<T> source, Texture2D<T> destination, int sourceOffsetX, int sourceOffsetY, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination, sourceOffsetX, sourceOffsetY, 0, 0, width, height);
}
@@ -287,8 +287,8 @@ public static class Texture2DExtensions
public static void CopyTo<T>(this Texture2D<T> source, Texture2D<T> destination, int sourceOffsetX, int sourceOffsetY, int destinationOffsetX, int destinationOffsetY, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination, sourceOffsetX, sourceOffsetY, destinationOffsetX, destinationOffsetY, width, height);
}
@@ -302,8 +302,8 @@ public static class Texture2DExtensions
public static void CopyTo<T>(this Texture2D<T> source, ReadBackTexture2D<T> destination)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination, 0, 0, 0, 0, source.Width, source.Height);
}
@@ -321,8 +321,8 @@ public static class Texture2DExtensions
public static void CopyTo<T>(this Texture2D<T> source, ReadBackTexture2D<T> destination, int sourceOffsetX, int sourceOffsetY, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination, sourceOffsetX, sourceOffsetY, 0, 0, width, height);
}
@@ -342,8 +342,8 @@ public static class Texture2DExtensions
public static void CopyTo<T>(this Texture2D<T> source, ReadBackTexture2D<T> destination, int sourceOffsetX, int sourceOffsetY, int destinationOffsetX, int destinationOffsetY, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination, sourceOffsetX, sourceOffsetY, destinationOffsetX, destinationOffsetY, width, height);
}
@@ -357,8 +357,8 @@ public static class Texture2DExtensions
public static unsafe void CopyFrom<T>(this Texture2D<T> destination, T[,] source)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture2D<T> destination, T[] source)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source.AsSpan(), 0, 0, destination.Width, destination.Height);
}
@@ -392,8 +392,8 @@ public static class Texture2DExtensions
public static void CopyFrom<T>(this Texture2D<T> destination, T[] source, Range x, Range y)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source.AsSpan(), x, y);
}
@@ -412,8 +412,8 @@ public static class Texture2DExtensions
public static void CopyFrom<T>(this Texture2D<T> destination, T[] source, int destinationOffsetX, int destinationOffsetY, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source.AsSpan(), destinationOffsetX, destinationOffsetY, width, height);
}
@@ -431,8 +431,8 @@ public static class Texture2DExtensions
public static void CopyFrom<T>(this Texture2D<T> destination, T[] source, int sourceOffset, Range x, Range y)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source.AsSpan(sourceOffset), x, y);
}
@@ -452,8 +452,8 @@ public static class Texture2DExtensions
public static void CopyFrom<T>(this Texture2D<T> destination, T[] source, int sourceOffset, int destinationOffsetX, int destinationOffsetY, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source.AsSpan(sourceOffset), destinationOffsetX, destinationOffsetY, width, height);
}
@@ -468,7 +468,7 @@ public static class Texture2DExtensions
public static void CopyFrom<T>(this Texture2D<T> destination, ReadOnlySpan<T> source)
where T : unmanaged
{
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(destination);
destination.CopyFrom(source, 0, 0, destination.Width, destination.Height);
}
@@ -485,7 +485,7 @@ public static class Texture2DExtensions
public static void CopyFrom<T>(this Texture2D<T> destination, ReadOnlySpan<T> source, Range x, Range y)
where T : unmanaged
{
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(destination);
(int offsetX, int width) = x.GetOffsetAndLength(destination.Width);
(int offsetY, int height) = y.GetOffsetAndLength(destination.Height);
@@ -507,7 +507,7 @@ public static class Texture2DExtensions
public static void CopyFrom<T>(this Texture2D<T> destination, ReadOnlySpan<T> source, int destinationOffsetX, int destinationOffsetY, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture2D<T> destination, Texture2D<T> source)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source, 0, 0, 0, 0, source.Width, source.Height);
}
@@ -540,8 +540,8 @@ public static class Texture2DExtensions
public static void CopyFrom<T>(this Texture2D<T> destination, Texture2D<T> source, int sourceOffsetX, int sourceOffsetY, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, sourceOffsetX, sourceOffsetY, 0, 0, width, height);
}
@@ -561,8 +561,8 @@ public static class Texture2DExtensions
public static void CopyFrom<T>(this Texture2D<T> destination, Texture2D<T> source, int sourceOffsetX, int sourceOffsetY, int destinationOffsetX, int destinationOffsetY, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, sourceOffsetX, sourceOffsetY, destinationOffsetX, destinationOffsetY, width, height);
}
@@ -576,8 +576,8 @@ public static class Texture2DExtensions
public static void CopyFrom<T>(this Texture2D<T> destination, UploadTexture2D<T> source)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
source.CopyTo(destination, 0, 0, 0, 0, source.Width, source.Height);
}
@@ -595,8 +595,8 @@ public static class Texture2DExtensions
public static void CopyFrom<T>(this Texture2D<T> destination, UploadTexture2D<T> source, int sourceOffsetX, int sourceOffsetY, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, 0, 0, width, height);
}
@@ -616,8 +616,8 @@ public static class Texture2DExtensions
public static void CopyFrom<T>(this Texture2D<T> destination, UploadTexture2D<T> source, int sourceOffsetX, int sourceOffsetY, int destinationOffsetX, int destinationOffsetY, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, destinationOffsetX, destinationOffsetY, width, height);
}
@@ -631,8 +631,8 @@ public static class Texture2DExtensions
public static void Save<T>(this Texture2D<T> texture, string filename)
where T : unmanaged
{
Guard.IsNotNull(texture);
Guard.IsNotNull(filename);
default(ArgumentNullException).ThrowIfNull(texture);
default(ArgumentNullException).ThrowIfNull(filename);
texture.Save(filename.AsSpan());
}
@@ -646,7 +646,7 @@ public static class Texture2DExtensions
public static void Save<T>(this Texture2D<T> texture, ReadOnlySpan<char> filename)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReadBackTexture2D<T> readback = texture.GraphicsDevice.AllocateReadBackTexture2D<T>(texture.Width, texture.Height);
@@ -665,8 +665,8 @@ public static class Texture2DExtensions
public static void Save<T>(this Texture2D<T> texture, Stream stream, ImageFormat format)
where T : unmanaged
{
Guard.IsNotNull(texture);
Guard.IsNotNull(stream);
default(ArgumentNullException).ThrowIfNull(texture);
default(ArgumentNullException).ThrowIfNull(stream);
using ReadBackTexture2D<T> readback = texture.GraphicsDevice.AllocateReadBackTexture2D<T>(texture.Width, texture.Height);
@@ -685,8 +685,8 @@ public static class Texture2DExtensions
public static void Save<T>(this Texture2D<T> texture, IBufferWriter<byte> writer, ImageFormat format)
where T : unmanaged
{
Guard.IsNotNull(texture);
Guard.IsNotNull(writer);
default(ArgumentNullException).ThrowIfNull(texture);
default(ArgumentNullException).ThrowIfNull(writer);
using ReadBackTexture2D<T> readback = texture.GraphicsDevice.AllocateReadBackTexture2D<T>(texture.Width, texture.Height);
+52 -52
ファイルの表示
@@ -24,7 +24,7 @@ public static class Texture3DExtensions
public static T[,,] ToArray<T>(this Texture3D<T> source)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(source);
T[,,] data = new T[source.Depth, source.Height, source.Width];
@@ -48,7 +48,7 @@ public static class Texture3DExtensions
public static unsafe T[,,] ToArray<T>(this Texture3D<T> source, int x, int y, int z, int width, int height, int depth)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(source);
Guard.IsGreaterThanOrEqualTo(width, 0);
Guard.IsGreaterThanOrEqualTo(height, 0);
Guard.IsGreaterThanOrEqualTo(depth, 0);
@@ -76,8 +76,8 @@ public static class Texture3DExtensions
public static void CopyTo<T>(this Texture3D<T> source, T[,,] destination)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> source, T[] destination, int destinationOffset)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> source, T[] destination, int destinationOffset, Range x, Range y, Range z)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination.AsSpan(destinationOffset), x, y, z);
}
@@ -138,8 +138,8 @@ public static class Texture3DExtensions
public static void CopyTo<T>(this Texture3D<T> source, T[] destination, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int destinationOffset, int width, int height, int depth)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
source.CopyTo(destination.AsSpan(destinationOffset), sourceOffsetX, sourceOffsetY, sourceOffsetZ, width, height, depth);
}
@@ -153,7 +153,7 @@ public static class Texture3DExtensions
public static void CopyTo<T>(this Texture3D<T> source, Span<T> destination)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> source, Span<T> destination, Range x, Range y, Range z)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(source);
(int offsetX, int width) = x.GetOffsetAndLength(source.Width);
(int offsetY, int height) = y.GetOffsetAndLength(source.Height);
@@ -196,7 +196,7 @@ public static class Texture3DExtensions
public static void CopyTo<T>(this Texture3D<T> source, Span<T> destination, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int width, int height, int depth)
where T : unmanaged
{
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> source, Texture3D<T> destination)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> source, Texture3D<T> destination, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int width, int height, int depth)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> source, Texture3D<T> 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);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> source, ReadBackTexture3D<T> destination)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> source, ReadBackTexture3D<T> destination, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int width, int height, int depth)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> source, ReadBackTexture3D<T> 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);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> destination, T[,,] source)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> destination, T[] source)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> destination, T[] source, Range x, Range y, Range z)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source.AsSpan(), x, y, z);
}
@@ -393,8 +393,8 @@ public static class Texture3DExtensions
public static void CopyFrom<T>(this Texture3D<T> destination, T[] source, int destinationOffsetX, int destinationOffsetY, int destinationOffsetZ, int width, int height, int depth)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source.AsSpan(), destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth);
}
@@ -413,8 +413,8 @@ public static class Texture3DExtensions
public static void CopyFrom<T>(this Texture3D<T> destination, T[] source, int sourceOffset, Range x, Range y, Range z)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source.AsSpan(sourceOffset), x, y, z);
}
@@ -436,8 +436,8 @@ public static class Texture3DExtensions
public static void CopyFrom<T>(this Texture3D<T> destination, T[] source, int sourceOffset, int destinationOffsetX, int destinationOffsetY, int destinationOffsetZ, int width, int height, int depth)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source.AsSpan(sourceOffset), destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth);
}
@@ -452,7 +452,7 @@ public static class Texture3DExtensions
public static void CopyFrom<T>(this Texture3D<T> destination, ReadOnlySpan<T> source)
where T : unmanaged
{
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> destination, ReadOnlySpan<T> source, Range x, Range y, Range z)
where T : unmanaged
{
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(destination);
(int offsetX, int width) = x.GetOffsetAndLength(destination.Width);
(int offsetY, int height) = y.GetOffsetAndLength(destination.Height);
@@ -495,7 +495,7 @@ public static class Texture3DExtensions
public static void CopyFrom<T>(this Texture3D<T> destination, ReadOnlySpan<T> source, int destinationOffsetX, int destinationOffsetY, int destinationOffsetZ, int width, int height, int depth)
where T : unmanaged
{
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> destination, Texture3D<T> source)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> destination, Texture3D<T> source, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int width, int height, int depth)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> destination, Texture3D<T> 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);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> destination, UploadTexture3D<T> source)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> destination, UploadTexture3D<T> source, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int width, int height, int depth)
where T : unmanaged
{
Guard.IsNotNull(destination);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(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<T>(this Texture3D<T> destination, UploadTexture3D<T> 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);
Guard.IsNotNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, sourceOffsetZ, destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth);
}
+5 -5
ファイルの表示
@@ -1,4 +1,4 @@
using CommunityToolkit.Diagnostics;
using System;
using ComputeSharp.Resources;
namespace ComputeSharp;
@@ -17,8 +17,8 @@ public static class UploadBufferExtensions
public static void CopyTo<T>(this UploadBuffer<T> source, StructuredBuffer<T> destination)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
destination.CopyFrom(source, 0, 0, source.Length);
}
@@ -35,8 +35,8 @@ public static class UploadBufferExtensions
public static void CopyTo<T>(this UploadBuffer<T> source, StructuredBuffer<T> destination, int sourceOffset, int destinationOffset, int count)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
destination.CopyFrom(source, sourceOffset, destinationOffset, count);
}
+7 -7
ファイルの表示
@@ -1,4 +1,4 @@
using CommunityToolkit.Diagnostics;
using System;
using ComputeSharp.Resources;
namespace ComputeSharp;
@@ -17,8 +17,8 @@ public static class UploadTexture1DExtensions
public static void CopyTo<T>(this UploadTexture1D<T> source, Texture1D<T> destination)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
destination.CopyFrom(source, 0, 0, source.Width);
}
@@ -34,8 +34,8 @@ public static class UploadTexture1DExtensions
public static void CopyTo<T>(this UploadTexture1D<T> source, Texture1D<T> destination, int sourceOffsetX, int width)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
destination.CopyFrom(source, sourceOffsetX, 0, width);
}
@@ -52,8 +52,8 @@ public static class UploadTexture1DExtensions
public static void CopyTo<T>(this UploadTexture1D<T> source, Texture1D<T> destination, int sourceOffsetX, int destinationOffsetX, int width)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
destination.CopyFrom(source, sourceOffsetX, destinationOffsetX, width);
}
+12 -13
ファイルの表示
@@ -1,6 +1,5 @@
using System;
using System.IO;
using CommunityToolkit.Diagnostics;
using ComputeSharp.Graphics.Helpers;
using ComputeSharp.Resources;
@@ -20,8 +19,8 @@ public static class UploadTexture2DExtensions
public static void CopyTo<T>(this UploadTexture2D<T> source, Texture2D<T> destination)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
destination.CopyFrom(source, 0, 0, 0, 0, source.Width, source.Height);
}
@@ -39,8 +38,8 @@ public static class UploadTexture2DExtensions
public static void CopyTo<T>(this UploadTexture2D<T> source, Texture2D<T> destination, int sourceOffsetX, int sourceOffsetY, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, 0, 0, width, height);
}
@@ -60,8 +59,8 @@ public static class UploadTexture2DExtensions
public static void CopyTo<T>(this UploadTexture2D<T> source, Texture2D<T> destination, int sourceOffsetX, int sourceOffsetY, int destinationOffsetX, int destinationOffsetY, int width, int height)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, destinationOffsetX, destinationOffsetY, width, height);
}
@@ -75,8 +74,8 @@ public static class UploadTexture2DExtensions
public static void Load<T>(this UploadTexture2D<T> texture, string filename)
where T : unmanaged
{
Guard.IsNotNull(texture);
Guard.IsNotNull(filename);
default(ArgumentNullException).ThrowIfNull(texture);
default(ArgumentNullException).ThrowIfNull(filename);
texture.Load(filename.AsSpan());
}
@@ -90,7 +89,7 @@ public static class UploadTexture2DExtensions
public static void Load<T>(this UploadTexture2D<T> texture, ReadOnlySpan<char> filename)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
WICHelper.Instance.LoadTexture(texture.View, filename);
}
@@ -105,7 +104,7 @@ public static class UploadTexture2DExtensions
public static void Load<T>(this UploadTexture2D<T> texture, ReadOnlySpan<byte> span)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
WICHelper.Instance.LoadTexture(texture.View, span);
}
@@ -119,8 +118,8 @@ public static class UploadTexture2DExtensions
public static void Load<T>(this UploadTexture2D<T> texture, Stream stream)
where T : unmanaged
{
Guard.IsNotNull(texture);
Guard.IsNotNull(stream);
default(ArgumentNullException).ThrowIfNull(texture);
default(ArgumentNullException).ThrowIfNull(stream);
WICHelper.Instance.LoadTexture(texture.View, stream);
}
+7 -7
ファイルの表示
@@ -1,4 +1,4 @@
using CommunityToolkit.Diagnostics;
using System;
using ComputeSharp.Resources;
namespace ComputeSharp;
@@ -17,8 +17,8 @@ public static class UploadTexture3DExtensions
public static void CopyTo<T>(this UploadTexture3D<T> source, Texture3D<T> destination)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(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<T>(this UploadTexture3D<T> source, Texture3D<T> destination, int sourceOffsetX, int sourceOffsetY, int sourceOffsetZ, int width, int height, int depth)
where T : unmanaged
{
Guard.IsNotNull(source);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(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<T>(this UploadTexture3D<T> source, Texture3D<T> 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);
Guard.IsNotNull(destination);
default(ArgumentNullException).ThrowIfNull(source);
default(ArgumentNullException).ThrowIfNull(destination);
destination.CopyFrom(source, sourceOffsetX, sourceOffsetY, sourceOffsetZ, destinationOffsetX, destinationOffsetY, destinationOffsetZ, width, height, depth);
}
+1 -2
ファイルの表示
@@ -1,6 +1,5 @@
using System;
using System.Collections.Generic;
using CommunityToolkit.Diagnostics;
using ComputeSharp.Graphics.Helpers;
namespace ComputeSharp;
@@ -71,7 +70,7 @@ partial class GraphicsDevice
/// </remarks>
public static IEnumerable<GraphicsDevice> QueryDevices(Predicate<GraphicsDeviceInfo> predicate)
{
Guard.IsNotNull(predicate);
default(ArgumentNullException).ThrowIfNull(predicate);
return new DeviceHelper.DeviceQuery(predicate);
}
+16 -16
ファイルの表示
@@ -65,7 +65,7 @@ public static class GraphicsResourceHelper
public static unsafe ulong ValidateAndGetGpuDescriptorHandle<T>(Buffer<T> buffer, GraphicsDevice device)
where T : unmanaged
{
Guard.IsNotNull(buffer);
default(ArgumentNullException).ThrowIfNull(buffer);
using ReferenceTracker.Lease _0 = buffer.GetReferenceTracker().GetLease();
@@ -87,7 +87,7 @@ public static class GraphicsResourceHelper
public static unsafe ulong ValidateAndGetGpuDescriptorHandle<T>(ReadOnlyTexture1D<T> texture, GraphicsDevice device)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease _0 = texture.GetReferenceTracker().GetLease();
@@ -109,7 +109,7 @@ public static class GraphicsResourceHelper
public static unsafe ulong ValidateAndGetGpuDescriptorHandle<T>(ReadWriteTexture1D<T> texture, GraphicsDevice device)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease _0 = texture.GetReferenceTracker().GetLease();
@@ -131,7 +131,7 @@ public static class GraphicsResourceHelper
public static unsafe ulong ValidateAndGetGpuDescriptorHandle<T>(IReadOnlyTexture1D<T> texture, GraphicsDevice device)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
if (texture is IGraphicsResource resource)
{
@@ -154,7 +154,7 @@ public static class GraphicsResourceHelper
public static unsafe ulong ValidateAndGetGpuDescriptorHandle<TPixel>(IReadOnlyNormalizedTexture1D<TPixel> texture, GraphicsDevice device)
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
if (texture is IGraphicsResource resource)
{
@@ -177,7 +177,7 @@ public static class GraphicsResourceHelper
public static unsafe ulong ValidateAndGetGpuDescriptorHandle<TPixel>(IReadWriteNormalizedTexture1D<TPixel> texture, GraphicsDevice device)
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
if (texture is IGraphicsResource resource)
{
@@ -200,7 +200,7 @@ public static class GraphicsResourceHelper
public static unsafe ulong ValidateAndGetGpuDescriptorHandle<T>(ReadOnlyTexture2D<T> texture, GraphicsDevice device)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease _0 = texture.GetReferenceTracker().GetLease();
@@ -222,7 +222,7 @@ public static class GraphicsResourceHelper
public static unsafe ulong ValidateAndGetGpuDescriptorHandle<T>(ReadWriteTexture2D<T> texture, GraphicsDevice device)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease _0 = texture.GetReferenceTracker().GetLease();
@@ -244,7 +244,7 @@ public static class GraphicsResourceHelper
public static unsafe ulong ValidateAndGetGpuDescriptorHandle<T>(IReadOnlyTexture2D<T> texture, GraphicsDevice device)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
if (texture is IGraphicsResource resource)
{
@@ -267,7 +267,7 @@ public static class GraphicsResourceHelper
public static unsafe ulong ValidateAndGetGpuDescriptorHandle<TPixel>(IReadOnlyNormalizedTexture2D<TPixel> texture, GraphicsDevice device)
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
if (texture is IGraphicsResource resource)
{
@@ -290,7 +290,7 @@ public static class GraphicsResourceHelper
public static unsafe ulong ValidateAndGetGpuDescriptorHandle<TPixel>(IReadWriteNormalizedTexture2D<TPixel> texture, GraphicsDevice device)
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
if (texture is IGraphicsResource resource)
{
@@ -313,7 +313,7 @@ public static class GraphicsResourceHelper
public static unsafe ulong ValidateAndGetGpuDescriptorHandle<T>(ReadOnlyTexture3D<T> texture, GraphicsDevice device)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease _0 = texture.GetReferenceTracker().GetLease();
@@ -335,7 +335,7 @@ public static class GraphicsResourceHelper
public static unsafe ulong ValidateAndGetGpuDescriptorHandle<T>(ReadWriteTexture3D<T> texture, GraphicsDevice device)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease _0 = texture.GetReferenceTracker().GetLease();
@@ -357,7 +357,7 @@ public static class GraphicsResourceHelper
public static unsafe ulong ValidateAndGetGpuDescriptorHandle<T>(IReadOnlyTexture3D<T> texture, GraphicsDevice device)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
if (texture is IGraphicsResource resource)
{
@@ -380,7 +380,7 @@ public static class GraphicsResourceHelper
public static unsafe ulong ValidateAndGetGpuDescriptorHandle<TPixel>(IReadOnlyNormalizedTexture3D<TPixel> texture, GraphicsDevice device)
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
if (texture is IGraphicsResource resource)
{
@@ -403,7 +403,7 @@ public static class GraphicsResourceHelper
public static unsafe ulong ValidateAndGetGpuDescriptorHandle<TPixel>(IReadWriteNormalizedTexture3D<TPixel> texture, GraphicsDevice device)
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
if (texture is IGraphicsResource resource)
{
+44 -44
ファイルの表示
@@ -1,5 +1,5 @@
using System;
using System.Runtime.CompilerServices;
using CommunityToolkit.Diagnostics;
using ComputeSharp.__Internals;
using ComputeSharp.Graphics.Helpers;
using ComputeSharp.Interop;
@@ -23,7 +23,7 @@ public static class ComputeContextExtensions
public static unsafe void Barrier<T>(this in ComputeContext context, ReadWriteBuffer<T> buffer)
where T : unmanaged
{
Guard.IsNotNull(buffer);
default(ArgumentNullException).ThrowIfNull(buffer);
using ReferenceTracker.Lease lease = default;
@@ -39,7 +39,7 @@ public static class ComputeContextExtensions
public static unsafe void Barrier<T>(this in ComputeContext context, ReadWriteTexture1D<T> texture)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -55,7 +55,7 @@ public static class ComputeContextExtensions
public static unsafe void Barrier<T>(this in ComputeContext context, ReadWriteTexture2D<T> texture)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -71,7 +71,7 @@ public static class ComputeContextExtensions
public static unsafe void Barrier<T>(this in ComputeContext context, ReadWriteTexture3D<T> texture)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -89,7 +89,7 @@ public static class ComputeContextExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -107,7 +107,7 @@ public static class ComputeContextExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -125,7 +125,7 @@ public static class ComputeContextExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -141,7 +141,7 @@ public static class ComputeContextExtensions
public static unsafe void Barrier<TPixel>(this in ComputeContext context, IReadWriteNormalizedTexture1D<TPixel> texture)
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -157,7 +157,7 @@ public static class ComputeContextExtensions
public static unsafe void Barrier<TPixel>(this in ComputeContext context, IReadWriteNormalizedTexture2D<TPixel> texture)
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -173,7 +173,7 @@ public static class ComputeContextExtensions
public static unsafe void Barrier<TPixel>(this in ComputeContext context, IReadWriteNormalizedTexture3D<TPixel> texture)
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -189,7 +189,7 @@ public static class ComputeContextExtensions
public static unsafe void Clear<T>(this in ComputeContext context, ReadWriteBuffer<T> buffer)
where T : unmanaged
{
Guard.IsNotNull(buffer);
default(ArgumentNullException).ThrowIfNull(buffer);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = buffer.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice);
@@ -205,7 +205,7 @@ public static class ComputeContextExtensions
public static unsafe void Clear<T>(this in ComputeContext context, ReadWriteTexture1D<T> texture)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized);
@@ -221,7 +221,7 @@ public static class ComputeContextExtensions
public static unsafe void Clear<T>(this in ComputeContext context, ReadWriteTexture2D<T> texture)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized);
@@ -237,7 +237,7 @@ public static class ComputeContextExtensions
public static unsafe void Clear<T>(this in ComputeContext context, ReadWriteTexture3D<T> texture)
where T : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized);
@@ -255,7 +255,7 @@ public static class ComputeContextExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
@@ -273,7 +273,7 @@ public static class ComputeContextExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
@@ -291,7 +291,7 @@ public static class ComputeContextExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
@@ -307,7 +307,7 @@ public static class ComputeContextExtensions
public static unsafe void Clear<TPixel>(this in ComputeContext context, IReadWriteNormalizedTexture1D<TPixel> texture)
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
@@ -325,7 +325,7 @@ public static class ComputeContextExtensions
public static unsafe void Clear<TPixel>(this in ComputeContext context, IReadWriteNormalizedTexture2D<TPixel> texture)
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
@@ -343,7 +343,7 @@ public static class ComputeContextExtensions
public static unsafe void Clear<TPixel>(this in ComputeContext context, IReadWriteNormalizedTexture3D<TPixel> texture)
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
@@ -364,7 +364,7 @@ public static class ComputeContextExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
@@ -383,7 +383,7 @@ public static class ComputeContextExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
@@ -402,7 +402,7 @@ public static class ComputeContextExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
@@ -419,7 +419,7 @@ public static class ComputeContextExtensions
public static unsafe void Fill<TPixel>(this in ComputeContext context, IReadWriteNormalizedTexture1D<TPixel> texture, TPixel value)
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
@@ -442,7 +442,7 @@ public static class ComputeContextExtensions
public static unsafe void Fill<TPixel>(this in ComputeContext context, IReadWriteNormalizedTexture2D<TPixel> texture, TPixel value)
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
@@ -465,7 +465,7 @@ public static class ComputeContextExtensions
public static unsafe void Fill<TPixel>(this in ComputeContext context, IReadWriteNormalizedTexture3D<TPixel> texture, TPixel value)
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
(D3D12_GPU_DESCRIPTOR_HANDLE Gpu, D3D12_CPU_DESCRIPTOR_HANDLE Cpu) handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
@@ -549,7 +549,7 @@ public static class ComputeContextExtensions
where T : struct, IPixelShader<TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
context.Run(texture, ref Unsafe.AsRef(default(T)));
}
@@ -566,7 +566,7 @@ public static class ComputeContextExtensions
where T : struct, IPixelShader<TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
context.Run(texture, ref Unsafe.AsRef(in shader));
}
@@ -579,7 +579,7 @@ public static class ComputeContextExtensions
/// <param name="resourceState">The state to transition the input resource to.</param>
public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture1D<float> texture, ResourceState resourceState)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -596,7 +596,7 @@ public static class ComputeContextExtensions
/// <param name="resourceState">The state to transition the input resource to.</param>
public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture1D<Float2> texture, ResourceState resourceState)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -613,7 +613,7 @@ public static class ComputeContextExtensions
/// <param name="resourceState">The state to transition the input resource to.</param>
public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture1D<Float3> texture, ResourceState resourceState)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -630,7 +630,7 @@ public static class ComputeContextExtensions
/// <param name="resourceState">The state to transition the input resource to.</param>
public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture1D<Float4> texture, ResourceState resourceState)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -651,7 +651,7 @@ public static class ComputeContextExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -668,7 +668,7 @@ public static class ComputeContextExtensions
/// <param name="resourceState">The state to transition the input resource to.</param>
public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture2D<float> texture, ResourceState resourceState)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -685,7 +685,7 @@ public static class ComputeContextExtensions
/// <param name="resourceState">The state to transition the input resource to.</param>
public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture2D<Float2> texture, ResourceState resourceState)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -702,7 +702,7 @@ public static class ComputeContextExtensions
/// <param name="resourceState">The state to transition the input resource to.</param>
public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture2D<Float3> texture, ResourceState resourceState)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -719,7 +719,7 @@ public static class ComputeContextExtensions
/// <param name="resourceState">The state to transition the input resource to.</param>
public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture2D<Float4> texture, ResourceState resourceState)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -740,7 +740,7 @@ public static class ComputeContextExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -757,7 +757,7 @@ public static class ComputeContextExtensions
/// <param name="resourceState">The state to transition the input resource to.</param>
public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture3D<float> texture, ResourceState resourceState)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -774,7 +774,7 @@ public static class ComputeContextExtensions
/// <param name="resourceState">The state to transition the input resource to.</param>
public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture3D<Float2> texture, ResourceState resourceState)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -791,7 +791,7 @@ public static class ComputeContextExtensions
/// <param name="resourceState">The state to transition the input resource to.</param>
public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture3D<Float3> texture, ResourceState resourceState)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -808,7 +808,7 @@ public static class ComputeContextExtensions
/// <param name="resourceState">The state to transition the input resource to.</param>
public static unsafe void Transition(this in ComputeContext context, ReadWriteTexture3D<Float4> texture, ResourceState resourceState)
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;
@@ -829,7 +829,7 @@ public static class ComputeContextExtensions
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(texture);
default(ArgumentNullException).ThrowIfNull(texture);
using ReferenceTracker.Lease lease = default;