diff --git a/src/ComputeSharp/Extensions/GraphicsDeviceExtensions.cs b/src/ComputeSharp/Extensions/GraphicsDeviceExtensions.cs index 7ace8078..bc82219c 100644 --- a/src/ComputeSharp/Extensions/GraphicsDeviceExtensions.cs +++ b/src/ComputeSharp/Extensions/GraphicsDeviceExtensions.cs @@ -33,13 +33,13 @@ namespace ComputeSharp /// /// The type of items to store in the buffer. /// The instance to use to allocate the buffer. - /// The input array with the data to copy on the allocated buffer. + /// The input array with the data to copy on the allocated buffer. /// A constant instance with the contents of the input array. [Pure] - public static ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, T[] array) + public static ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, T[] source) where T : unmanaged { - return device.AllocateConstantBuffer(array.AsSpan()); + return device.AllocateConstantBuffer(source.AsSpan()); } /// @@ -47,15 +47,15 @@ namespace ComputeSharp /// /// The type of items to store in the buffer. /// The instance to use to allocate the buffer. - /// The input with the data to copy on the allocated buffer. + /// The input with the data to copy on the allocated buffer. /// A constant instance with the contents of the input . [Pure] - public static ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, ReadOnlySpan span) + public static ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, ReadOnlySpan source) where T : unmanaged { - ConstantBuffer buffer = new(device, span.Length, AllocationMode.Default); + ConstantBuffer buffer = new(device, source.Length, AllocationMode.Default); - buffer.SetData(span); + buffer.SetData(source); return buffer; } @@ -65,15 +65,15 @@ namespace ComputeSharp /// /// The type of items to store in the buffer. /// The instance to use to allocate the buffer. - /// The input with the data to copy on the allocated buffer. + /// The input with the data to copy on the allocated buffer. /// A constant instance with the contents of the input . [Pure] - public static ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, Buffer buffer) + public static ConstantBuffer AllocateConstantBuffer(this GraphicsDevice device, Buffer source) where T : unmanaged { - ConstantBuffer constantBuffer = new(device, buffer.Length, AllocationMode.Default); + ConstantBuffer constantBuffer = new(device, source.Length, AllocationMode.Default); - constantBuffer.SetData(buffer); + constantBuffer.SetData(source); return constantBuffer; } @@ -98,13 +98,13 @@ namespace ComputeSharp /// /// The type of items to store in the buffer. /// The instance to use to allocate the buffer. - /// The input array with the data to copy on the allocated buffer. + /// The input array with the data to copy on the allocated buffer. /// A read write instance with the contents of the input array. [Pure] - public static ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, T[] array) + public static ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, T[] source) where T : unmanaged { - return device.AllocateReadOnlyBuffer(array.AsSpan()); + return device.AllocateReadOnlyBuffer(source.AsSpan()); } /// @@ -112,15 +112,15 @@ namespace ComputeSharp /// /// The type of items to store in the buffer. /// The instance to use to allocate the buffer. - /// The input with the data to copy on the allocated buffer. + /// The input with the data to copy on the allocated buffer. /// A read write instance with the contents of the input . [Pure] - public static ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, ReadOnlySpan span) + public static ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, ReadOnlySpan source) where T : unmanaged { - ReadOnlyBuffer buffer = new(device, span.Length, AllocationMode.Default); + ReadOnlyBuffer buffer = new(device, source.Length, AllocationMode.Default); - buffer.SetData(span); + buffer.SetData(source); return buffer; } @@ -130,15 +130,15 @@ namespace ComputeSharp /// /// The type of items to store in the buffer. /// The instance to use to allocate the buffer. - /// The input with the data to copy on the allocated buffer. + /// The input with the data to copy on the allocated buffer. /// A read write instance with the contents of the input . [Pure] - public static ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, Buffer buffer) + public static ReadOnlyBuffer AllocateReadOnlyBuffer(this GraphicsDevice device, Buffer source) where T : unmanaged { - ReadOnlyBuffer readWriteBuffer = new(device, buffer.Length, AllocationMode.Default); + ReadOnlyBuffer readWriteBuffer = new(device, source.Length, AllocationMode.Default); - readWriteBuffer.SetData(buffer); + readWriteBuffer.SetData(source); return readWriteBuffer; } @@ -164,15 +164,15 @@ namespace ComputeSharp /// /// The type of items to store in the texture. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. + /// The input array with the data to copy on the allocated texture. /// The width of the texture. /// The height of the texture. /// A instance with the contents of the input array. [Pure] - public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[] array, int width, int height) + public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[] source, int width, int height) where T : unmanaged { - return device.AllocateReadOnlyTexture2D(array.AsSpan(), width, height); + return device.AllocateReadOnlyTexture2D(source.AsSpan(), width, height); } /// @@ -180,16 +180,16 @@ namespace ComputeSharp /// /// The type of items to store in the texture. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. - /// The starting offset within to read data from. + /// The input array with the data to copy on the allocated texture. + /// The starting offset within to read data from. /// The width of the texture. /// The height of the texture. /// A instance with the contents of the input array. [Pure] - public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[] array, int offset, int width, int height) + public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[] source, int offset, int width, int height) where T : unmanaged { - return device.AllocateReadOnlyTexture2D(array.AsSpan(offset), width, height); + return device.AllocateReadOnlyTexture2D(source.AsSpan(offset), width, height); } /// @@ -197,15 +197,15 @@ namespace ComputeSharp /// /// The type of items to store in the texture. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. + /// The input array with the data to copy on the allocated texture. /// A read write instance with the contents of the input array. [Pure] - public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[,] array) + public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[,] source) where T : unmanaged { - ReadOnlyTexture2D texture = new(device, array.GetLength(1), array.GetLength(0), AllocationMode.Default); + ReadOnlyTexture2D texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default); - texture.SetData(array); + texture.SetData(source); return texture; } @@ -215,17 +215,17 @@ namespace ComputeSharp /// /// The type of items to store in the texture. /// The instance to use to allocate the texture. - /// The input with the data to copy on the allocated texture. + /// The input with the data to copy on the allocated texture. /// The width of the texture. /// The height of the texture. /// A instance with the contents of the input . [Pure] - public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, ReadOnlySpan span, int width, int height) + public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, ReadOnlySpan source, int width, int height) where T : unmanaged { ReadOnlyTexture2D texture = new(device, width, height, AllocationMode.Default); - texture.SetData(span); + texture.SetData(source); return texture; } @@ -254,16 +254,16 @@ namespace ComputeSharp /// The type of items to store in the texture. /// The type of pixels used on the GPU side. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. + /// The input array with the data to copy on the allocated texture. /// The width of the texture. /// The height of the texture. /// A instance with the contents of the input array. [Pure] - public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[] array, int width, int height) + public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[] source, int width, int height) where T : unmanaged, IUnorm where TPixel : unmanaged { - return device.AllocateReadOnlyTexture2D(array.AsSpan(), width, height); + return device.AllocateReadOnlyTexture2D(source.AsSpan(), width, height); } /// @@ -272,17 +272,17 @@ namespace ComputeSharp /// The type of items to store in the texture. /// The type of pixels used on the GPU side. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. - /// The starting offset within to read data from. + /// The input array with the data to copy on the allocated texture. + /// The starting offset within to read data from. /// The width of the texture. /// The height of the texture. /// A instance with the contents of the input array. [Pure] - public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[] array, int offset, int width, int height) + public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[] source, int offset, int width, int height) where T : unmanaged, IUnorm where TPixel : unmanaged { - return device.AllocateReadOnlyTexture2D(array.AsSpan(offset), width, height); + return device.AllocateReadOnlyTexture2D(source.AsSpan(offset), width, height); } /// @@ -291,16 +291,16 @@ namespace ComputeSharp /// The type of items to store in the texture. /// The type of pixels used on the GPU side. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. + /// The input array with the data to copy on the allocated texture. /// A read write instance with the contents of the input array. [Pure] - public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[,] array) + public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[,] source) where T : unmanaged, IUnorm where TPixel : unmanaged { - ReadOnlyTexture2D texture = new(device, array.GetLength(1), array.GetLength(0), AllocationMode.Default); + ReadOnlyTexture2D texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default); - texture.SetData(array); + texture.SetData(source); return texture; } @@ -311,18 +311,18 @@ namespace ComputeSharp /// The type of items to store in the texture. /// The type of pixels used on the GPU side. /// The instance to use to allocate the texture. - /// The input with the data to copy on the allocated texture. + /// The input with the data to copy on the allocated texture. /// The width of the texture. /// The height of the texture. /// A instance with the contents of the input . [Pure] - public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, ReadOnlySpan span, int width, int height) + public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, ReadOnlySpan source, int width, int height) where T : unmanaged, IUnorm where TPixel : unmanaged { ReadOnlyTexture2D texture = new(device, width, height, AllocationMode.Default); - texture.SetData(span); + texture.SetData(source); return texture; } @@ -349,16 +349,16 @@ namespace ComputeSharp /// /// The type of items to store in the texture. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. + /// The input array with the data to copy on the allocated texture. /// The width of the texture. /// The height of the texture. /// The depth of the texture. /// A instance with the contents of the input array. [Pure] - public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[] array, int width, int height, int depth) + public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[] source, int width, int height, int depth) where T : unmanaged { - return device.AllocateReadOnlyTexture3D(array.AsSpan(), width, height, depth); + return device.AllocateReadOnlyTexture3D(source.AsSpan(), width, height, depth); } /// @@ -366,17 +366,17 @@ namespace ComputeSharp /// /// The type of items to store in the texture. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. - /// The starting offset within to read data from. + /// The input array with the data to copy on the allocated texture. + /// The starting offset within to read data from. /// The width of the texture. /// The height of the texture. /// The depth of the texture. /// A instance with the contents of the input array. [Pure] - public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[] array, int offset, int width, int height, int depth) + public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[] source, int offset, int width, int height, int depth) where T : unmanaged { - return device.AllocateReadOnlyTexture3D(array.AsSpan(offset), width, height, depth); + return device.AllocateReadOnlyTexture3D(source.AsSpan(offset), width, height, depth); } /// @@ -384,19 +384,19 @@ namespace ComputeSharp /// /// The type of items to store in the texture. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. + /// The input array with the data to copy on the allocated texture. /// A read write instance with the contents of the input array. /// /// The source 3D array needs to have each 2D plane stacked on the depth axis. /// That is, the expected layout of the input array has to be [depth, height, width]. /// [Pure] - public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[,,] array) + public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[,,] source) where T : unmanaged { - ReadOnlyTexture3D texture = new(device, array.GetLength(2), array.GetLength(1), array.GetLength(0), AllocationMode.Default); + ReadOnlyTexture3D texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default); - texture.SetData(array); + texture.SetData(source); return texture; } @@ -406,18 +406,18 @@ namespace ComputeSharp /// /// The type of items to store in the texture. /// The instance to use to allocate the texture. - /// The input with the data to copy on the allocated texture. + /// The input with the data to copy on the allocated texture. /// The width of the texture. /// The height of the texture. /// The depth of the texture. /// A instance with the contents of the input . [Pure] - public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, ReadOnlySpan span, int width, int height, int depth) + public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, ReadOnlySpan source, int width, int height, int depth) where T : unmanaged { ReadOnlyTexture3D texture = new(device, width, height, depth, AllocationMode.Default); - texture.SetData(span); + texture.SetData(source); return texture; } @@ -447,17 +447,17 @@ namespace ComputeSharp /// The type of items to store in the texture. /// The type of pixels used on the GPU side. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. + /// The input array with the data to copy on the allocated texture. /// The width of the texture. /// The height of the texture. /// The depth of the texture. /// A instance with the contents of the input array. [Pure] - public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[] array, int width, int height, int depth) + public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[] source, int width, int height, int depth) where T : unmanaged, IUnorm where TPixel : unmanaged { - return device.AllocateReadOnlyTexture3D(array.AsSpan(), width, height, depth); + return device.AllocateReadOnlyTexture3D(source.AsSpan(), width, height, depth); } /// @@ -466,18 +466,18 @@ namespace ComputeSharp /// The type of items to store in the texture. /// The type of pixels used on the GPU side. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. - /// The starting offset within to read data from. + /// The input array with the data to copy on the allocated texture. + /// The starting offset within to read data from. /// The width of the texture. /// The height of the texture. /// The depth of the texture. /// A instance with the contents of the input array. [Pure] - public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[] array, int offset, int width, int height, int depth) + public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[] source, int offset, int width, int height, int depth) where T : unmanaged, IUnorm where TPixel : unmanaged { - return device.AllocateReadOnlyTexture3D(array.AsSpan(offset), width, height, depth); + return device.AllocateReadOnlyTexture3D(source.AsSpan(offset), width, height, depth); } /// @@ -486,20 +486,20 @@ namespace ComputeSharp /// The type of items to store in the texture. /// The type of pixels used on the GPU side. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. + /// The input array with the data to copy on the allocated texture. /// A read write instance with the contents of the input array. /// /// The source 3D array needs to have each 2D plane stacked on the depth axis. /// That is, the expected layout of the input array has to be [depth, height, width]. /// [Pure] - public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[,,] array) + public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[,,] source) where T : unmanaged, IUnorm where TPixel : unmanaged { - ReadOnlyTexture3D texture = new(device, array.GetLength(2), array.GetLength(1), array.GetLength(0), AllocationMode.Default); + ReadOnlyTexture3D texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default); - texture.SetData(array); + texture.SetData(source); return texture; } @@ -510,19 +510,19 @@ namespace ComputeSharp /// The type of items to store in the texture. /// The type of pixels used on the GPU side. /// The instance to use to allocate the texture. - /// The input with the data to copy on the allocated texture. + /// The input with the data to copy on the allocated texture. /// The width of the texture. /// The height of the texture. /// The depth of the texture. /// A instance with the contents of the input . [Pure] - public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, ReadOnlySpan span, int width, int height, int depth) + public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, ReadOnlySpan source, int width, int height, int depth) where T : unmanaged, IUnorm where TPixel : unmanaged { ReadOnlyTexture3D texture = new(device, width, height, depth, AllocationMode.Default); - texture.SetData(span); + texture.SetData(source); return texture; } @@ -547,13 +547,13 @@ namespace ComputeSharp /// /// The type of items to store in the buffer. /// The instance to use to allocate the buffer. - /// The input array with the data to copy on the allocated buffer. + /// The input array with the data to copy on the allocated buffer. /// A read write instance with the contents of the input array. [Pure] - public static ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, T[] array) + public static ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, T[] source) where T : unmanaged { - return device.AllocateReadWriteBuffer(array.AsSpan()); + return device.AllocateReadWriteBuffer(source.AsSpan()); } /// @@ -561,15 +561,15 @@ namespace ComputeSharp /// /// The type of items to store in the buffer. /// The instance to use to allocate the buffer. - /// The input with the data to copy on the allocated buffer. + /// The input with the data to copy on the allocated buffer. /// A read write instance with the contents of the input . [Pure] - public static ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, ReadOnlySpan span) + public static ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, ReadOnlySpan source) where T : unmanaged { - ReadWriteBuffer buffer = new(device, span.Length, AllocationMode.Default); + ReadWriteBuffer buffer = new(device, source.Length, AllocationMode.Default); - buffer.SetData(span); + buffer.SetData(source); return buffer; } @@ -579,15 +579,15 @@ namespace ComputeSharp /// /// The type of items to store in the buffer. /// The instance to use to allocate the buffer. - /// The input with the data to copy on the allocated buffer. + /// The input with the data to copy on the allocated buffer. /// A read write instance with the contents of the input . [Pure] - public static ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, Buffer buffer) + public static ReadWriteBuffer AllocateReadWriteBuffer(this GraphicsDevice device, Buffer source) where T : unmanaged { - ReadWriteBuffer readWriteBuffer = new(device, buffer.Length, AllocationMode.Default); + ReadWriteBuffer readWriteBuffer = new(device, source.Length, AllocationMode.Default); - readWriteBuffer.SetData(buffer); + readWriteBuffer.SetData(source); return readWriteBuffer; } @@ -613,15 +613,15 @@ namespace ComputeSharp /// /// The type of items to store in the texture. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. + /// The input array with the data to copy on the allocated texture. /// The width of the texture. /// The height of the texture. /// A instance with the contents of the input array. [Pure] - public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[] array, int width, int height) + public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[] source, int width, int height) where T : unmanaged { - return device.AllocateReadWriteTexture2D(array.AsSpan(), width, height); + return device.AllocateReadWriteTexture2D(source.AsSpan(), width, height); } /// @@ -629,16 +629,16 @@ namespace ComputeSharp /// /// The type of items to store in the texture. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. - /// The starting offset within to read data from. + /// The input array with the data to copy on the allocated texture. + /// The starting offset within to read data from. /// The width of the texture. /// The height of the texture. /// A instance with the contents of the input array. [Pure] - public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[] array, int offset, int width, int height) + public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[] source, int offset, int width, int height) where T : unmanaged { - return device.AllocateReadWriteTexture2D(array.AsSpan(offset), width, height); + return device.AllocateReadWriteTexture2D(source.AsSpan(offset), width, height); } /// @@ -646,15 +646,15 @@ namespace ComputeSharp /// /// The type of items to store in the texture. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. + /// The input array with the data to copy on the allocated texture. /// A read write instance with the contents of the input array. [Pure] - public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[,] array) + public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[,] source) where T : unmanaged { - ReadWriteTexture2D texture = new(device, array.GetLength(1), array.GetLength(0), AllocationMode.Default); + ReadWriteTexture2D texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default); - texture.SetData(array); + texture.SetData(source); return texture; } @@ -664,17 +664,17 @@ namespace ComputeSharp /// /// The type of items to store in the texture. /// The instance to use to allocate the texture. - /// The input with the data to copy on the allocated texture. + /// The input with the data to copy on the allocated texture. /// The width of the texture. /// The height of the texture. /// A instance with the contents of the input . [Pure] - public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, ReadOnlySpan span, int width, int height) + public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, ReadOnlySpan source, int width, int height) where T : unmanaged { ReadWriteTexture2D texture = new(device, width, height, AllocationMode.Default); - texture.SetData(span); + texture.SetData(source); return texture; } @@ -703,16 +703,16 @@ namespace ComputeSharp /// The type of items to store in the texture. /// The type of pixels used on the GPU side. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. + /// The input array with the data to copy on the allocated texture. /// The width of the texture. /// The height of the texture. /// A instance with the contents of the input array. [Pure] - public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[] array, int width, int height) + public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[] source, int width, int height) where T : unmanaged, IUnorm where TPixel : unmanaged { - return device.AllocateReadWriteTexture2D(array.AsSpan(), width, height); + return device.AllocateReadWriteTexture2D(source.AsSpan(), width, height); } /// @@ -721,17 +721,17 @@ namespace ComputeSharp /// The type of items to store in the texture. /// The type of pixels used on the GPU side. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. - /// The starting offset within to read data from. + /// The input array with the data to copy on the allocated texture. + /// The starting offset within to read data from. /// The width of the texture. /// The height of the texture. /// A instance with the contents of the input array. [Pure] - public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[] array, int offset, int width, int height) + public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[] source, int offset, int width, int height) where T : unmanaged, IUnorm where TPixel : unmanaged { - return device.AllocateReadWriteTexture2D(array.AsSpan(offset), width, height); + return device.AllocateReadWriteTexture2D(source.AsSpan(offset), width, height); } /// @@ -740,16 +740,16 @@ namespace ComputeSharp /// The type of items to store in the texture. /// The type of pixels used on the GPU side. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. + /// The input array with the data to copy on the allocated texture. /// A read write instance with the contents of the input array. [Pure] - public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[,] array) + public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[,] source) where T : unmanaged, IUnorm where TPixel : unmanaged { - ReadWriteTexture2D texture = new(device, array.GetLength(1), array.GetLength(0), AllocationMode.Default); + ReadWriteTexture2D texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default); - texture.SetData(array); + texture.SetData(source); return texture; } @@ -760,18 +760,18 @@ namespace ComputeSharp /// The type of items to store in the texture. /// The type of pixels used on the GPU side. /// The instance to use to allocate the texture. - /// The input with the data to copy on the allocated texture. + /// The input with the data to copy on the allocated texture. /// The width of the texture. /// The height of the texture. /// A instance with the contents of the input . [Pure] - public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, ReadOnlySpan span, int width, int height) + public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, ReadOnlySpan source, int width, int height) where T : unmanaged, IUnorm where TPixel : unmanaged { ReadWriteTexture2D texture = new(device, width, height, AllocationMode.Default); - texture.SetData(span); + texture.SetData(source); return texture; } @@ -798,16 +798,16 @@ namespace ComputeSharp /// /// The type of items to store in the texture. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. + /// The input array with the data to copy on the allocated texture. /// The width of the texture. /// The height of the texture. /// The depth of the texture. /// A instance with the contents of the input array. [Pure] - public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[] array, int width, int height, int depth) + public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[] source, int width, int height, int depth) where T : unmanaged { - return device.AllocateReadWriteTexture3D(array.AsSpan(), width, height, depth); + return device.AllocateReadWriteTexture3D(source.AsSpan(), width, height, depth); } /// @@ -815,17 +815,17 @@ namespace ComputeSharp /// /// The type of items to store in the texture. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. - /// The starting offset within to read data from. + /// The input array with the data to copy on the allocated texture. + /// The starting offset within to read data from. /// The width of the texture. /// The height of the texture. /// The depth of the texture. /// A instance with the contents of the input array. [Pure] - public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[] array, int offset, int width, int height, int depth) + public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[] source, int offset, int width, int height, int depth) where T : unmanaged { - return device.AllocateReadWriteTexture3D(array.AsSpan(offset), width, height, depth); + return device.AllocateReadWriteTexture3D(source.AsSpan(offset), width, height, depth); } /// @@ -833,19 +833,19 @@ namespace ComputeSharp /// /// The type of items to store in the texture. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. + /// The input array with the data to copy on the allocated texture. /// A read write instance with the contents of the input array. /// /// The source 3D array needs to have each 2D plane stacked on the depth axis. /// That is, the expected layout of the input array has to be [depth, height, width]. /// [Pure] - public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[,,] array) + public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[,,] source) where T : unmanaged { - ReadWriteTexture3D texture = new(device, array.GetLength(2), array.GetLength(1), array.GetLength(0), AllocationMode.Default); + ReadWriteTexture3D texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default); - texture.SetData(array); + texture.SetData(source); return texture; } @@ -855,18 +855,18 @@ namespace ComputeSharp /// /// The type of items to store in the texture. /// The instance to use to allocate the texture. - /// The input with the data to copy on the allocated texture. + /// The input with the data to copy on the allocated texture. /// The width of the texture. /// The height of the texture. /// The depth of the texture. /// A instance with the contents of the input . [Pure] - public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, ReadOnlySpan span, int width, int height, int depth) + public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, ReadOnlySpan source, int width, int height, int depth) where T : unmanaged { ReadWriteTexture3D texture = new(device, width, height, depth, AllocationMode.Default); - texture.SetData(span); + texture.SetData(source); return texture; } @@ -896,17 +896,17 @@ namespace ComputeSharp /// The type of items to store in the texture. /// The type of pixels used on the GPU side. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. + /// The input array with the data to copy on the allocated texture. /// The width of the texture. /// The height of the texture. /// The depth of the texture. /// A instance with the contents of the input array. [Pure] - public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[] array, int width, int height, int depth) + public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[] source, int width, int height, int depth) where T : unmanaged, IUnorm where TPixel : unmanaged { - return device.AllocateReadWriteTexture3D(array.AsSpan(), width, height, depth); + return device.AllocateReadWriteTexture3D(source.AsSpan(), width, height, depth); } /// @@ -915,18 +915,18 @@ namespace ComputeSharp /// The type of items to store in the texture. /// The type of pixels used on the GPU side. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. - /// The starting offset within to read data from. + /// The input array with the data to copy on the allocated texture. + /// The starting offset within to read data from. /// The width of the texture. /// The height of the texture. /// The depth of the texture. /// A instance with the contents of the input array. [Pure] - public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[] array, int offset, int width, int height, int depth) + public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[] source, int offset, int width, int height, int depth) where T : unmanaged, IUnorm where TPixel : unmanaged { - return device.AllocateReadWriteTexture3D(array.AsSpan(offset), width, height, depth); + return device.AllocateReadWriteTexture3D(source.AsSpan(offset), width, height, depth); } /// @@ -935,20 +935,20 @@ namespace ComputeSharp /// The type of items to store in the texture. /// The type of pixels used on the GPU side. /// The instance to use to allocate the texture. - /// The input array with the data to copy on the allocated texture. + /// The input array with the data to copy on the allocated texture. /// A read write instance with the contents of the input array. /// /// The source 3D array needs to have each 2D plane stacked on the depth axis. /// That is, the expected layout of the input array has to be [depth, height, width]. /// [Pure] - public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[,,] array) + public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[,,] source) where T : unmanaged, IUnorm where TPixel : unmanaged { - ReadWriteTexture3D texture = new(device, array.GetLength(2), array.GetLength(1), array.GetLength(0), AllocationMode.Default); + ReadWriteTexture3D texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default); - texture.SetData(array); + texture.SetData(source); return texture; } @@ -959,19 +959,19 @@ namespace ComputeSharp /// The type of items to store in the texture. /// The type of pixels used on the GPU side. /// The instance to use to allocate the texture. - /// The input with the data to copy on the allocated texture. + /// The input with the data to copy on the allocated texture. /// The width of the texture. /// The height of the texture. /// The depth of the texture. /// A instance with the contents of the input . [Pure] - public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, ReadOnlySpan span, int width, int height, int depth) + public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, ReadOnlySpan source, int width, int height, int depth) where T : unmanaged, IUnorm where TPixel : unmanaged { ReadWriteTexture3D texture = new(device, width, height, depth, AllocationMode.Default); - texture.SetData(span); + texture.SetData(source); return texture; } @@ -996,13 +996,13 @@ namespace ComputeSharp /// /// The type of items to store in the buffer. /// The instance to use to allocate the buffer. - /// The input array with the data to copy on the allocated buffer. + /// The input array with the data to copy on the allocated buffer. /// A read write instance with the contents of the input array. [Pure] - public static UploadBuffer AllocateUploadBuffer(this GraphicsDevice device, T[] array) + public static UploadBuffer AllocateUploadBuffer(this GraphicsDevice device, T[] source) where T : unmanaged { - return device.AllocateUploadBuffer(array.AsSpan()); + return device.AllocateUploadBuffer(source.AsSpan()); } /// @@ -1010,15 +1010,15 @@ namespace ComputeSharp /// /// The type of items to store in the buffer. /// The instance to use to allocate the buffer. - /// The input with the data to copy on the allocated buffer. + /// The input with the data to copy on the allocated buffer. /// A read write instance with the contents of the input . [Pure] - public static UploadBuffer AllocateUploadBuffer(this GraphicsDevice device, ReadOnlySpan span) + public static UploadBuffer AllocateUploadBuffer(this GraphicsDevice device, ReadOnlySpan source) where T : unmanaged { - UploadBuffer buffer = new(device, span.Length, AllocationMode.Default); + UploadBuffer buffer = new(device, source.Length, AllocationMode.Default); - span.CopyTo(buffer.Span); + source.CopyTo(buffer.Span); return buffer; } @@ -1061,15 +1061,15 @@ namespace ComputeSharp /// /// The type of items to store in the buffer. /// The instance to use to allocate the buffer. - /// The input with the data to copy on the allocated buffer. + /// The input with the data to copy on the allocated buffer. /// A read write instance with the contents of the input . [Pure] - public static ReadBackBuffer AllocateReadBackBuffer(this GraphicsDevice device, ReadOnlySpan span) + public static ReadBackBuffer AllocateReadBackBuffer(this GraphicsDevice device, ReadOnlySpan source) where T : unmanaged { - ReadBackBuffer buffer = new(device, span.Length, AllocationMode.Default); + ReadBackBuffer buffer = new(device, source.Length, AllocationMode.Default); - span.CopyTo(buffer.Span); + source.CopyTo(buffer.Span); return buffer; }