Rename IUnorm<TPixel> to IPixel<T, TPixel>, remove [Obsolete]

Also move to the root ComputeSharp namespace
このコミットが含まれているのは:
Sergio Pedri committed 2022-01-08 19:56:44 +01:00
1 親 c8cf7a5097
コミット 67571a7626
15ファイル変更
+55 -94

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

+1 -4
ファイルの表示
@@ -2,9 +2,6 @@
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using ComputeSharp.__Internals;
#pragma warning disable CS0618
namespace ComputeSharp;
@@ -18,7 +15,7 @@ namespace ComputeSharp;
/// </summary>
/// <remarks>This struct is fully mutable.</remarks>
[StructLayout(LayoutKind.Sequential)]
public struct Bgra32 : IEquatable<Bgra32>, IUnorm<Vector4>, IUnorm<Float4>
public struct Bgra32 : IEquatable<Bgra32>, IPixel<Bgra32, Vector4>, IPixel<Bgra32, Float4>
#if NET6_0_OR_GREATER
, ISpanFormattable
#endif
+12
ファイルの表示
@@ -0,0 +1,12 @@
namespace ComputeSharp;
/// <summary>
/// An interface representing a pixel type and its normalized representation on the GPU side, when used within a shader.
/// </summary>
/// <typeparam name="T">The pixel type, when stored in memory (either on the CPU or the GPU side).</typeparam>
/// <typeparam name="TPixel">The type of pixel when normalized and used within a shader.</typeparam>
public interface IPixel<T, TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
}
+1 -4
ファイルの表示
@@ -1,9 +1,6 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using ComputeSharp.__Internals;
#pragma warning disable CS0618
namespace ComputeSharp;
@@ -14,7 +11,7 @@ namespace ComputeSharp;
/// </para>
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct R16 : IEquatable<R16>, IUnorm<float>
public struct R16 : IEquatable<R16>, IPixel<R16, float>
#if NET6_0_OR_GREATER
, ISpanFormattable
#endif
+1 -4
ファイルの表示
@@ -1,9 +1,6 @@
using System;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using ComputeSharp.__Internals;
#pragma warning disable CS0618
namespace ComputeSharp;
@@ -14,7 +11,7 @@ namespace ComputeSharp;
/// </para>
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct R8 : IEquatable<R8>, IUnorm<float>
public struct R8 : IEquatable<R8>, IPixel<R8, float>
#if NET6_0_OR_GREATER
, ISpanFormattable
#endif
+1 -4
ファイルの表示
@@ -2,9 +2,6 @@
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using ComputeSharp.__Internals;
#pragma warning disable CS0618
namespace ComputeSharp;
@@ -15,7 +12,7 @@ namespace ComputeSharp;
/// </para>
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct Rg16 : IEquatable<Rg16>, IUnorm<Vector2>, IUnorm<Float2>
public struct Rg16 : IEquatable<Rg16>, IPixel<Rg16, Vector2>, IPixel<Rg16, Float2>
#if NET6_0_OR_GREATER
, ISpanFormattable
#endif
+1 -4
ファイルの表示
@@ -2,9 +2,6 @@
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using ComputeSharp.__Internals;
#pragma warning disable CS0618
namespace ComputeSharp;
@@ -15,7 +12,7 @@ namespace ComputeSharp;
/// </para>
/// </summary>
[StructLayout(LayoutKind.Sequential)]
public struct Rg32 : IEquatable<Rg32>, IUnorm<Vector2>, IUnorm<Float2>
public struct Rg32 : IEquatable<Rg32>, IPixel<Rg32, Vector2>, IPixel<Rg32, Float2>
#if NET6_0_OR_GREATER
, ISpanFormattable
#endif
+1 -4
ファイルの表示
@@ -2,9 +2,6 @@
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using ComputeSharp.__Internals;
#pragma warning disable CS0618
namespace ComputeSharp;
@@ -17,7 +14,7 @@ namespace ComputeSharp;
/// </summary>
/// <remarks>This struct is fully mutable.</remarks>
[StructLayout(LayoutKind.Sequential)]
public struct Rgba32 : IEquatable<Rgba32>, IUnorm<Vector4>, IUnorm<Float4>
public struct Rgba32 : IEquatable<Rgba32>, IPixel<Rgba32, Vector4>, IPixel<Rgba32, Float4>
#if NET6_0_OR_GREATER
, ISpanFormattable
#endif
+1 -4
ファイルの表示
@@ -2,9 +2,6 @@
using System.Numerics;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using ComputeSharp.__Internals;
#pragma warning disable CS0618
namespace ComputeSharp;
@@ -17,7 +14,7 @@ namespace ComputeSharp;
/// </summary>
/// <remarks>This struct is fully mutable.</remarks>
[StructLayout(LayoutKind.Sequential)]
public struct Rgba64 : IEquatable<Rgba64>, IUnorm<Vector4>, IUnorm<Float4>
public struct Rgba64 : IEquatable<Rgba64>, IPixel<Rgba64, Vector4>, IPixel<Rgba64, Float4>
#if NET6_0_OR_GREATER
, ISpanFormattable
#endif
-15
ファイルの表示
@@ -1,15 +0,0 @@
using System;
using System.ComponentModel;
namespace ComputeSharp.__Internals;
/// <summary>
/// Indicates the supported HLSL pixel types to represent a given normalized pixel type.
/// </summary>
/// <typeparam name="TPixel">The type of pixels used on the GPU side.</typeparam>
[EditorBrowsable(EditorBrowsableState.Never)]
[Obsolete("This interface is not intended to be used directly by user code")]
public interface IUnorm<TPixel>
where TPixel : unmanaged
{
}
+28 -31
ファイルの表示
@@ -1,12 +1,9 @@
using System;
using System.IO;
using ComputeSharp.__Internals;
using ComputeSharp.Graphics.Helpers;
using ComputeSharp.Resources;
using Microsoft.Toolkit.Diagnostics;
#pragma warning disable CS0618
namespace ComputeSharp;
/// <inheritdoc cref="GraphicsDeviceExtensions"/>
@@ -227,7 +224,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
/// <returns>A zeroed <see cref="ReadOnlyTexture2D{T, TPixel}"/> instance of size [<paramref name="width"/>, <paramref name="height"/>].</returns>
public static ReadOnlyTexture2D<T, TPixel> AllocateReadOnlyTexture2D<T, TPixel>(this GraphicsDevice device, int width, int height, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
return new(device, width, height, allocationMode);
@@ -244,7 +241,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="height">The height of the texture.</param>
/// <returns>A <see cref="ReadOnlyTexture2D{T, TPixel}"/> instance with the contents of the input array.</returns>
public static ReadOnlyTexture2D<T, TPixel> AllocateReadOnlyTexture2D<T, TPixel>(this GraphicsDevice device, T[] source, int width, int height)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
return device.AllocateReadOnlyTexture2D<T, TPixel>(source.AsSpan(), width, height);
@@ -262,7 +259,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="height">The height of the texture.</param>
/// <returns>A <see cref="ReadOnlyTexture2D{T, TPixel}"/> instance with the contents of the input array.</returns>
public static ReadOnlyTexture2D<T, TPixel> AllocateReadOnlyTexture2D<T, TPixel>(this GraphicsDevice device, T[] source, int offset, int width, int height)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
return device.AllocateReadOnlyTexture2D<T, TPixel>(source.AsSpan(offset), width, height);
@@ -277,7 +274,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="source">The input <typeparamref name="T"/> array with the data to copy on the allocated texture.</param>
/// <returns>A read write <see cref="ReadOnlyTexture2D{T, TPixel}"/> instance with the contents of the input array.</returns>
public static ReadOnlyTexture2D<T, TPixel> AllocateReadOnlyTexture2D<T, TPixel>(this GraphicsDevice device, T[,] source)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
ReadOnlyTexture2D<T, TPixel> texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default);
@@ -298,7 +295,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="height">The height of the texture.</param>
/// <returns>A <see cref="ReadOnlyTexture2D{T, TPixel}"/> instance with the contents of the input <see cref="ReadOnlySpan{T}"/>.</returns>
public static ReadOnlyTexture2D<T, TPixel> AllocateReadOnlyTexture2D<T, TPixel>(this GraphicsDevice device, ReadOnlySpan<T> source, int width, int height)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
ReadOnlyTexture2D<T, TPixel> texture = new(device, width, height, AllocationMode.Default);
@@ -410,7 +407,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
/// <returns>A zeroed <see cref="ReadOnlyTexture3D{T, TPixel}"/> instance of size [<paramref name="width"/>, <paramref name="height"/>, <paramref name="depth"/>].</returns>
public static ReadOnlyTexture3D<T, TPixel> AllocateReadOnlyTexture3D<T, TPixel>(this GraphicsDevice device, int width, int height, int depth, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
return new(device, width, height, depth, allocationMode);
@@ -428,7 +425,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="depth">The depth of the texture.</param>
/// <returns>A <see cref="ReadOnlyTexture3D{T, TPixel}"/> instance with the contents of the input array.</returns>
public static ReadOnlyTexture3D<T, TPixel> AllocateReadOnlyTexture3D<T, TPixel>(this GraphicsDevice device, T[] source, int width, int height, int depth)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
return device.AllocateReadOnlyTexture3D<T, TPixel>(source.AsSpan(), width, height, depth);
@@ -447,7 +444,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="depth">The depth of the texture.</param>
/// <returns>A <see cref="ReadOnlyTexture3D{T, TPixel}"/> instance with the contents of the input array.</returns>
public static ReadOnlyTexture3D<T, TPixel> AllocateReadOnlyTexture3D<T, TPixel>(this GraphicsDevice device, T[] source, int offset, int width, int height, int depth)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
return device.AllocateReadOnlyTexture3D<T, TPixel>(source.AsSpan(offset), width, height, depth);
@@ -466,7 +463,7 @@ public static partial class GraphicsDeviceExtensions
/// That is, the expected layout of the input array has to be [depth, height, width].
/// </remarks>
public static ReadOnlyTexture3D<T, TPixel> AllocateReadOnlyTexture3D<T, TPixel>(this GraphicsDevice device, T[,,] source)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
ReadOnlyTexture3D<T, TPixel> texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default);
@@ -488,7 +485,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="depth">The depth of the texture.</param>
/// <returns>A <see cref="ReadOnlyTexture3D{T, TPixel}"/> instance with the contents of the input <see cref="ReadOnlySpan{T}"/>.</returns>
public static ReadOnlyTexture3D<T, TPixel> AllocateReadOnlyTexture3D<T, TPixel>(this GraphicsDevice device, ReadOnlySpan<T> source, int width, int height, int depth)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
ReadOnlyTexture3D<T, TPixel> texture = new(device, width, height, depth, AllocationMode.Default);
@@ -652,7 +649,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
/// <returns>A zeroed <see cref="ReadWriteTexture2D{T, TPixel}"/> instance of size [<paramref name="width"/>, <paramref name="height"/>].</returns>
public static ReadWriteTexture2D<T, TPixel> AllocateReadWriteTexture2D<T, TPixel>(this GraphicsDevice device, int width, int height, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
return new(device, width, height, allocationMode);
@@ -669,7 +666,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="height">The height of the texture.</param>
/// <returns>A <see cref="ReadWriteTexture2D{T, TPixel}"/> instance with the contents of the input array.</returns>
public static ReadWriteTexture2D<T, TPixel> AllocateReadWriteTexture2D<T, TPixel>(this GraphicsDevice device, T[] source, int width, int height)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
return device.AllocateReadWriteTexture2D<T, TPixel>(source.AsSpan(), width, height);
@@ -687,7 +684,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="height">The height of the texture.</param>
/// <returns>A <see cref="ReadWriteTexture2D{T, TPixel}"/> instance with the contents of the input array.</returns>
public static ReadWriteTexture2D<T, TPixel> AllocateReadWriteTexture2D<T, TPixel>(this GraphicsDevice device, T[] source, int offset, int width, int height)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
return device.AllocateReadWriteTexture2D<T, TPixel>(source.AsSpan(offset), width, height);
@@ -702,7 +699,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="source">The input <typeparamref name="T"/> array with the data to copy on the allocated texture.</param>
/// <returns>A read write <see cref="ReadWriteTexture2D{T, TPixel}"/> instance with the contents of the input array.</returns>
public static ReadWriteTexture2D<T, TPixel> AllocateReadWriteTexture2D<T, TPixel>(this GraphicsDevice device, T[,] source)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
ReadWriteTexture2D<T, TPixel> texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default);
@@ -723,7 +720,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="height">The height of the texture.</param>
/// <returns>A <see cref="ReadWriteTexture2D{T, TPixel}"/> instance with the contents of the input <see cref="ReadOnlySpan{T}"/>.</returns>
public static ReadWriteTexture2D<T, TPixel> AllocateReadWriteTexture2D<T, TPixel>(this GraphicsDevice device, ReadOnlySpan<T> source, int width, int height)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
ReadWriteTexture2D<T, TPixel> texture = new(device, width, height, AllocationMode.Default);
@@ -835,7 +832,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
/// <returns>A <see cref="ReadWriteTexture3D{T, TPixel}"/> instance of size [<paramref name="width"/>, <paramref name="height"/>, <paramref name="depth"/>].</returns>
public static ReadWriteTexture3D<T, TPixel> AllocateReadWriteTexture3D<T, TPixel>(this GraphicsDevice device, int width, int height, int depth, AllocationMode allocationMode = AllocationMode.Default)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
return new(device, width, height, depth, allocationMode);
@@ -853,7 +850,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="depth">The depth of the texture.</param>
/// <returns>A <see cref="ReadWriteTexture3D{T, TPixel}"/> instance with the contents of the input array.</returns>
public static ReadWriteTexture3D<T, TPixel> AllocateReadWriteTexture3D<T, TPixel>(this GraphicsDevice device, T[] source, int width, int height, int depth)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
return device.AllocateReadWriteTexture3D<T, TPixel>(source.AsSpan(), width, height, depth);
@@ -872,7 +869,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="depth">The depth of the texture.</param>
/// <returns>A <see cref="ReadWriteTexture3D{T, TPixel}"/> instance with the contents of the input array.</returns>
public static ReadWriteTexture3D<T, TPixel> AllocateReadWriteTexture3D<T, TPixel>(this GraphicsDevice device, T[] source, int offset, int width, int height, int depth)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
return device.AllocateReadWriteTexture3D<T, TPixel>(source.AsSpan(offset), width, height, depth);
@@ -891,7 +888,7 @@ public static partial class GraphicsDeviceExtensions
/// That is, the expected layout of the input array has to be [depth, height, width].
/// </remarks>
public static ReadWriteTexture3D<T, TPixel> AllocateReadWriteTexture3D<T, TPixel>(this GraphicsDevice device, T[,,] source)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
ReadWriteTexture3D<T, TPixel> texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default);
@@ -913,7 +910,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="depth">The depth of the texture.</param>
/// <returns>A <see cref="ReadWriteTexture3D{T, TPixel}"/> instance with the contents of the input <see cref="ReadOnlySpan{T}"/>.</returns>
public static ReadWriteTexture3D<T, TPixel> AllocateReadWriteTexture3D<T, TPixel>(this GraphicsDevice device, ReadOnlySpan<T> source, int width, int height, int depth)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
ReadWriteTexture3D<T, TPixel> texture = new(device, width, height, depth, AllocationMode.Default);
@@ -1022,7 +1019,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="filename">The filename of the image file to load and decode into the texture.</param>
/// <returns>A <see cref="ReadOnlyTexture2D{T, TPixel}"/> instance with the contents of the specified file.</returns>
public static ReadOnlyTexture2D<T, TPixel> LoadReadOnlyTexture2D<T, TPixel>(this GraphicsDevice device, string filename)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(filename, nameof(filename));
@@ -1039,7 +1036,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="filename">The filename of the image file to load and decode into the texture.</param>
/// <returns>A <see cref="ReadOnlyTexture2D{T, TPixel}"/> instance with the contents of the specified file.</returns>
public static ReadOnlyTexture2D<T, TPixel> LoadReadOnlyTexture2D<T, TPixel>(this GraphicsDevice device, ReadOnlySpan<char> filename)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
using UploadTexture2D<T> upload = WICHelper.Instance.LoadTexture<T>(device, filename);
@@ -1060,7 +1057,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="span">The buffer with the image data to load and decode into the texture.</param>
/// <returns>A <see cref="ReadOnlyTexture2D{T, TPixel}"/> instance with the contents of the specified file.</returns>
public static ReadOnlyTexture2D<T, TPixel> LoadReadOnlyTexture2D<T, TPixel>(this GraphicsDevice device, ReadOnlySpan<byte> span)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
using UploadTexture2D<T> upload = WICHelper.Instance.LoadTexture<T>(device, span);
@@ -1081,7 +1078,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="stream">The stream with the image data to load and decode into the texture.</param>
/// <returns>A <see cref="ReadOnlyTexture2D{T, TPixel}"/> instance with the contents of the specified file.</returns>
public static ReadOnlyTexture2D<T, TPixel> LoadReadOnlyTexture2D<T, TPixel>(this GraphicsDevice device, Stream stream)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(stream, nameof(stream));
@@ -1104,7 +1101,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="filename">The filename of the image file to load and decode into the texture.</param>
/// <returns>A <see cref="ReadWriteTexture2D{T, TPixel}"/> instance with the contents of the specified file.</returns>
public static ReadWriteTexture2D<T, TPixel> LoadReadWriteTexture2D<T, TPixel>(this GraphicsDevice device, string filename)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(filename, nameof(filename));
@@ -1121,7 +1118,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="filename">The filename of the image file to load and decode into the texture.</param>
/// <returns>A <see cref="ReadWriteTexture2D{T, TPixel}"/> instance with the contents of the specified file.</returns>
public static ReadWriteTexture2D<T, TPixel> LoadReadWriteTexture2D<T, TPixel>(this GraphicsDevice device, ReadOnlySpan<char> filename)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
using UploadTexture2D<T> upload = WICHelper.Instance.LoadTexture<T>(device, filename);
@@ -1142,7 +1139,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="span">The buffer with the image data to load and decode into the texture.</param>
/// <returns>A <see cref="ReadWriteTexture2D{T, TPixel}"/> instance with the contents of the specified file.</returns>
public static ReadWriteTexture2D<T, TPixel> LoadReadWriteTexture2D<T, TPixel>(this GraphicsDevice device, ReadOnlySpan<byte> span)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
using UploadTexture2D<T> upload = WICHelper.Instance.LoadTexture<T>(device, span);
@@ -1163,7 +1160,7 @@ public static partial class GraphicsDeviceExtensions
/// <param name="stream">The stream with the image data to load and decode into the texture.</param>
/// <returns>A <see cref="ReadWriteTexture2D{T, TPixel}"/> instance with the contents of the specified file.</returns>
public static ReadWriteTexture2D<T, TPixel> LoadReadWriteTexture2D<T, TPixel>(this GraphicsDevice device, Stream stream)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
Guard.IsNotNull(stream, nameof(stream));
+1 -4
ファイルの表示
@@ -1,13 +1,10 @@
using System.Diagnostics;
using ComputeSharp.__Internals;
using ComputeSharp.Exceptions;
using ComputeSharp.Graphics.Resources.Enums;
using ComputeSharp.Resources;
using ComputeSharp.Resources.Debug;
using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1;
#pragma warning disable CS0618
namespace ComputeSharp;
/// <summary>
@@ -18,7 +15,7 @@ namespace ComputeSharp;
[DebuggerTypeProxy(typeof(Texture2DDebugView<>))]
[DebuggerDisplay("{ToString(),raw}")]
public sealed class ReadOnlyTexture2D<T, TPixel> : Texture2D<T>, IReadOnlyTexture2D<TPixel>
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
/// <summary>
+1 -4
ファイルの表示
@@ -1,13 +1,10 @@
using System.Diagnostics;
using ComputeSharp.__Internals;
using ComputeSharp.Exceptions;
using ComputeSharp.Graphics.Resources.Enums;
using ComputeSharp.Resources;
using ComputeSharp.Resources.Debug;
using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1;
#pragma warning disable CS0618
namespace ComputeSharp;
/// <summary>
@@ -18,7 +15,7 @@ namespace ComputeSharp;
[DebuggerTypeProxy(typeof(Texture3DDebugView<>))]
[DebuggerDisplay("{ToString(),raw}")]
public sealed class ReadOnlyTexture3D<T, TPixel> : Texture3D<T>, IReadOnlyTexture3D<TPixel>
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
/// <summary>
+1 -4
ファイルの表示
@@ -1,13 +1,10 @@
using System.Diagnostics;
using ComputeSharp.__Internals;
using ComputeSharp.Exceptions;
using ComputeSharp.Graphics.Resources.Enums;
using ComputeSharp.Resources;
using ComputeSharp.Resources.Debug;
using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1;
#pragma warning disable CS0618
namespace ComputeSharp;
/// <summary>
@@ -18,7 +15,7 @@ namespace ComputeSharp;
[DebuggerTypeProxy(typeof(Texture2DDebugView<>))]
[DebuggerDisplay("{ToString(),raw}")]
public sealed class ReadWriteTexture2D<T, TPixel> : Texture2D<T>, IReadWriteTexture2D<TPixel>
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
/// <summary>
+1 -4
ファイルの表示
@@ -1,13 +1,10 @@
using System.Diagnostics;
using ComputeSharp.__Internals;
using ComputeSharp.Exceptions;
using ComputeSharp.Graphics.Resources.Enums;
using ComputeSharp.Resources;
using ComputeSharp.Resources.Debug;
using static TerraFX.Interop.DirectX.D3D12_FORMAT_SUPPORT1;
#pragma warning disable CS0618
namespace ComputeSharp;
/// <summary>
@@ -18,7 +15,7 @@ namespace ComputeSharp;
[DebuggerTypeProxy(typeof(Texture3DDebugView<>))]
[DebuggerDisplay("{ToString(),raw}")]
public sealed class ReadWriteTexture3D<T, TPixel> : Texture3D<T>, IReadWriteTexture3D<TPixel>
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
/// <summary>
+4 -4
ファイルの表示
@@ -54,7 +54,7 @@ public static partial class ComputeContextExtensions
/// <param name="context">The <see cref="ComputeContext"/> to use to insert the resource barrier.</param>
/// <param name="texture">The input <see cref="ReadWriteTexture2D{T,TPixel}"/> instance to insert the barrier for.</param>
public static unsafe void Barrier<T, TPixel>(this in ComputeContext context, ReadWriteTexture2D<T, TPixel> texture)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
context.Barrier(texture.ValidateAndGetID3D12Resource(context.GraphicsDevice));
@@ -68,7 +68,7 @@ public static partial class ComputeContextExtensions
/// <param name="context">The <see cref="ComputeContext"/> to use to insert the resource barrier.</param>
/// <param name="texture">The input <see cref="ReadWriteTexture3D{T,TPixel}"/> instance to insert the barrier for.</param>
public static unsafe void Barrier<T, TPixel>(this in ComputeContext context, ReadWriteTexture3D<T, TPixel> texture)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
context.Barrier(texture.ValidateAndGetID3D12Resource(context.GraphicsDevice));
@@ -148,7 +148,7 @@ public static partial class ComputeContextExtensions
/// <param name="context">The <see cref="ComputeContext"/> to use to clear the resource.</param>
/// <param name="texture">The input <see cref="ReadWriteTexture2D{T,TPixel}"/> instance to clear.</param>
public static unsafe void Clear<T, TPixel>(this in ComputeContext context, ReadWriteTexture2D<T, TPixel> texture)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized);
@@ -164,7 +164,7 @@ public static partial class ComputeContextExtensions
/// <param name="context">The <see cref="ComputeContext"/> to use to clear the resource.</param>
/// <param name="texture">The input <see cref="ReadWriteTexture3D{T,TPixel}"/> instance to clear.</param>
public static unsafe void Clear<T, TPixel>(this in ComputeContext context, ReadWriteTexture3D<T, TPixel> texture)
where T : unmanaged, IUnorm<TPixel>
where T : unmanaged, IPixel<T, TPixel>
where TPixel : unmanaged
{
var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized);