diff --git a/src/ComputeSharp/Core/Imaging/Bgra32.cs b/src/ComputeSharp/Core/Imaging/Bgra32.cs index 2c01623b..27ed1544 100644 --- a/src/ComputeSharp/Core/Imaging/Bgra32.cs +++ b/src/ComputeSharp/Core/Imaging/Bgra32.cs @@ -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; /// /// This struct is fully mutable. [StructLayout(LayoutKind.Sequential)] -public struct Bgra32 : IEquatable, IUnorm, IUnorm +public struct Bgra32 : IEquatable, IPixel, IPixel #if NET6_0_OR_GREATER , ISpanFormattable #endif diff --git a/src/ComputeSharp/Core/Imaging/Interfaces/IPixel{T,TPixel}.cs b/src/ComputeSharp/Core/Imaging/Interfaces/IPixel{T,TPixel}.cs new file mode 100644 index 00000000..be3f2740 --- /dev/null +++ b/src/ComputeSharp/Core/Imaging/Interfaces/IPixel{T,TPixel}.cs @@ -0,0 +1,12 @@ +namespace ComputeSharp; + +/// +/// An interface representing a pixel type and its normalized representation on the GPU side, when used within a shader. +/// +/// The pixel type, when stored in memory (either on the CPU or the GPU side). +/// The type of pixel when normalized and used within a shader. +public interface IPixel + where T : unmanaged, IPixel + where TPixel : unmanaged +{ +} diff --git a/src/ComputeSharp/Core/Imaging/R16.cs b/src/ComputeSharp/Core/Imaging/R16.cs index d79580d7..850d9222 100644 --- a/src/ComputeSharp/Core/Imaging/R16.cs +++ b/src/ComputeSharp/Core/Imaging/R16.cs @@ -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; /// /// [StructLayout(LayoutKind.Sequential)] -public struct R16 : IEquatable, IUnorm +public struct R16 : IEquatable, IPixel #if NET6_0_OR_GREATER , ISpanFormattable #endif diff --git a/src/ComputeSharp/Core/Imaging/R8.cs b/src/ComputeSharp/Core/Imaging/R8.cs index 84bf2230..7f95b8c4 100644 --- a/src/ComputeSharp/Core/Imaging/R8.cs +++ b/src/ComputeSharp/Core/Imaging/R8.cs @@ -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; /// /// [StructLayout(LayoutKind.Sequential)] -public struct R8 : IEquatable, IUnorm +public struct R8 : IEquatable, IPixel #if NET6_0_OR_GREATER , ISpanFormattable #endif diff --git a/src/ComputeSharp/Core/Imaging/Rg16.cs b/src/ComputeSharp/Core/Imaging/Rg16.cs index 863fe74b..c6aab570 100644 --- a/src/ComputeSharp/Core/Imaging/Rg16.cs +++ b/src/ComputeSharp/Core/Imaging/Rg16.cs @@ -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; /// /// [StructLayout(LayoutKind.Sequential)] -public struct Rg16 : IEquatable, IUnorm, IUnorm +public struct Rg16 : IEquatable, IPixel, IPixel #if NET6_0_OR_GREATER , ISpanFormattable #endif diff --git a/src/ComputeSharp/Core/Imaging/Rg32.cs b/src/ComputeSharp/Core/Imaging/Rg32.cs index 1b4170cc..dda953ce 100644 --- a/src/ComputeSharp/Core/Imaging/Rg32.cs +++ b/src/ComputeSharp/Core/Imaging/Rg32.cs @@ -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; /// /// [StructLayout(LayoutKind.Sequential)] -public struct Rg32 : IEquatable, IUnorm, IUnorm +public struct Rg32 : IEquatable, IPixel, IPixel #if NET6_0_OR_GREATER , ISpanFormattable #endif diff --git a/src/ComputeSharp/Core/Imaging/Rgba32.cs b/src/ComputeSharp/Core/Imaging/Rgba32.cs index 66a82ab6..5cc7cd9c 100644 --- a/src/ComputeSharp/Core/Imaging/Rgba32.cs +++ b/src/ComputeSharp/Core/Imaging/Rgba32.cs @@ -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; /// /// This struct is fully mutable. [StructLayout(LayoutKind.Sequential)] -public struct Rgba32 : IEquatable, IUnorm, IUnorm +public struct Rgba32 : IEquatable, IPixel, IPixel #if NET6_0_OR_GREATER , ISpanFormattable #endif diff --git a/src/ComputeSharp/Core/Imaging/Rgba64.cs b/src/ComputeSharp/Core/Imaging/Rgba64.cs index c689737a..6652717b 100644 --- a/src/ComputeSharp/Core/Imaging/Rgba64.cs +++ b/src/ComputeSharp/Core/Imaging/Rgba64.cs @@ -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; /// /// This struct is fully mutable. [StructLayout(LayoutKind.Sequential)] -public struct Rgba64 : IEquatable, IUnorm, IUnorm +public struct Rgba64 : IEquatable, IPixel, IPixel #if NET6_0_OR_GREATER , ISpanFormattable #endif diff --git a/src/ComputeSharp/Core/Imaging/__Internals/IUnorm{TPixel}.cs b/src/ComputeSharp/Core/Imaging/__Internals/IUnorm{TPixel}.cs deleted file mode 100644 index 3a5d812f..00000000 --- a/src/ComputeSharp/Core/Imaging/__Internals/IUnorm{TPixel}.cs +++ /dev/null @@ -1,15 +0,0 @@ -using System; -using System.ComponentModel; - -namespace ComputeSharp.__Internals; - -/// -/// Indicates the supported HLSL pixel types to represent a given normalized pixel type. -/// -/// The type of pixels used on the GPU side. -[EditorBrowsable(EditorBrowsableState.Never)] -[Obsolete("This interface is not intended to be used directly by user code")] -public interface IUnorm - where TPixel : unmanaged -{ -} diff --git a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs index c504ef37..c235c555 100644 --- a/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs +++ b/src/ComputeSharp/Graphics/Extensions/GraphicsDeviceExtensions.Resources.cs @@ -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; /// @@ -227,7 +224,7 @@ public static partial class GraphicsDeviceExtensions /// The allocation mode to use for the new resource. /// A zeroed instance of size [, ]. public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, int width, int height, AllocationMode allocationMode = AllocationMode.Default) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { return new(device, width, height, allocationMode); @@ -244,7 +241,7 @@ public static partial class GraphicsDeviceExtensions /// The height of the texture. /// A instance with the contents of the input array. public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[] source, int width, int height) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { return device.AllocateReadOnlyTexture2D(source.AsSpan(), width, height); @@ -262,7 +259,7 @@ public static partial class GraphicsDeviceExtensions /// The height of the texture. /// A instance with the contents of the input array. public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[] source, int offset, int width, int height) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { return device.AllocateReadOnlyTexture2D(source.AsSpan(offset), width, height); @@ -277,7 +274,7 @@ public static partial class GraphicsDeviceExtensions /// The input array with the data to copy on the allocated texture. /// A read write instance with the contents of the input array. public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, T[,] source) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { ReadOnlyTexture2D texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default); @@ -298,7 +295,7 @@ public static partial class GraphicsDeviceExtensions /// The height of the texture. /// A instance with the contents of the input . public static ReadOnlyTexture2D AllocateReadOnlyTexture2D(this GraphicsDevice device, ReadOnlySpan source, int width, int height) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { ReadOnlyTexture2D texture = new(device, width, height, AllocationMode.Default); @@ -410,7 +407,7 @@ public static partial class GraphicsDeviceExtensions /// The allocation mode to use for the new resource. /// A zeroed instance of size [, , ]. public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, int width, int height, int depth, AllocationMode allocationMode = AllocationMode.Default) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { return new(device, width, height, depth, allocationMode); @@ -428,7 +425,7 @@ public static partial class GraphicsDeviceExtensions /// The depth of the texture. /// A instance with the contents of the input array. public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[] source, int width, int height, int depth) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { return device.AllocateReadOnlyTexture3D(source.AsSpan(), width, height, depth); @@ -447,7 +444,7 @@ public static partial class GraphicsDeviceExtensions /// The depth of the texture. /// A instance with the contents of the input array. public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[] source, int offset, int width, int height, int depth) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { return device.AllocateReadOnlyTexture3D(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]. /// public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, T[,,] source) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { ReadOnlyTexture3D texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default); @@ -488,7 +485,7 @@ public static partial class GraphicsDeviceExtensions /// The depth of the texture. /// A instance with the contents of the input . public static ReadOnlyTexture3D AllocateReadOnlyTexture3D(this GraphicsDevice device, ReadOnlySpan source, int width, int height, int depth) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { ReadOnlyTexture3D texture = new(device, width, height, depth, AllocationMode.Default); @@ -652,7 +649,7 @@ public static partial class GraphicsDeviceExtensions /// The allocation mode to use for the new resource. /// A zeroed instance of size [, ]. public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, int width, int height, AllocationMode allocationMode = AllocationMode.Default) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { return new(device, width, height, allocationMode); @@ -669,7 +666,7 @@ public static partial class GraphicsDeviceExtensions /// The height of the texture. /// A instance with the contents of the input array. public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[] source, int width, int height) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { return device.AllocateReadWriteTexture2D(source.AsSpan(), width, height); @@ -687,7 +684,7 @@ public static partial class GraphicsDeviceExtensions /// The height of the texture. /// A instance with the contents of the input array. public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[] source, int offset, int width, int height) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { return device.AllocateReadWriteTexture2D(source.AsSpan(offset), width, height); @@ -702,7 +699,7 @@ public static partial class GraphicsDeviceExtensions /// The input array with the data to copy on the allocated texture. /// A read write instance with the contents of the input array. public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, T[,] source) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { ReadWriteTexture2D texture = new(device, source.GetLength(1), source.GetLength(0), AllocationMode.Default); @@ -723,7 +720,7 @@ public static partial class GraphicsDeviceExtensions /// The height of the texture. /// A instance with the contents of the input . public static ReadWriteTexture2D AllocateReadWriteTexture2D(this GraphicsDevice device, ReadOnlySpan source, int width, int height) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { ReadWriteTexture2D texture = new(device, width, height, AllocationMode.Default); @@ -835,7 +832,7 @@ public static partial class GraphicsDeviceExtensions /// The allocation mode to use for the new resource. /// A instance of size [, , ]. public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, int width, int height, int depth, AllocationMode allocationMode = AllocationMode.Default) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { return new(device, width, height, depth, allocationMode); @@ -853,7 +850,7 @@ public static partial class GraphicsDeviceExtensions /// The depth of the texture. /// A instance with the contents of the input array. public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[] source, int width, int height, int depth) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { return device.AllocateReadWriteTexture3D(source.AsSpan(), width, height, depth); @@ -872,7 +869,7 @@ public static partial class GraphicsDeviceExtensions /// The depth of the texture. /// A instance with the contents of the input array. public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[] source, int offset, int width, int height, int depth) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { return device.AllocateReadWriteTexture3D(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]. /// public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, T[,,] source) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { ReadWriteTexture3D texture = new(device, source.GetLength(2), source.GetLength(1), source.GetLength(0), AllocationMode.Default); @@ -913,7 +910,7 @@ public static partial class GraphicsDeviceExtensions /// The depth of the texture. /// A instance with the contents of the input . public static ReadWriteTexture3D AllocateReadWriteTexture3D(this GraphicsDevice device, ReadOnlySpan source, int width, int height, int depth) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { ReadWriteTexture3D texture = new(device, width, height, depth, AllocationMode.Default); @@ -1022,7 +1019,7 @@ public static partial class GraphicsDeviceExtensions /// The filename of the image file to load and decode into the texture. /// A instance with the contents of the specified file. public static ReadOnlyTexture2D LoadReadOnlyTexture2D(this GraphicsDevice device, string filename) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { Guard.IsNotNull(filename, nameof(filename)); @@ -1039,7 +1036,7 @@ public static partial class GraphicsDeviceExtensions /// The filename of the image file to load and decode into the texture. /// A instance with the contents of the specified file. public static ReadOnlyTexture2D LoadReadOnlyTexture2D(this GraphicsDevice device, ReadOnlySpan filename) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { using UploadTexture2D upload = WICHelper.Instance.LoadTexture(device, filename); @@ -1060,7 +1057,7 @@ public static partial class GraphicsDeviceExtensions /// The buffer with the image data to load and decode into the texture. /// A instance with the contents of the specified file. public static ReadOnlyTexture2D LoadReadOnlyTexture2D(this GraphicsDevice device, ReadOnlySpan span) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { using UploadTexture2D upload = WICHelper.Instance.LoadTexture(device, span); @@ -1081,7 +1078,7 @@ public static partial class GraphicsDeviceExtensions /// The stream with the image data to load and decode into the texture. /// A instance with the contents of the specified file. public static ReadOnlyTexture2D LoadReadOnlyTexture2D(this GraphicsDevice device, Stream stream) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { Guard.IsNotNull(stream, nameof(stream)); @@ -1104,7 +1101,7 @@ public static partial class GraphicsDeviceExtensions /// The filename of the image file to load and decode into the texture. /// A instance with the contents of the specified file. public static ReadWriteTexture2D LoadReadWriteTexture2D(this GraphicsDevice device, string filename) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { Guard.IsNotNull(filename, nameof(filename)); @@ -1121,7 +1118,7 @@ public static partial class GraphicsDeviceExtensions /// The filename of the image file to load and decode into the texture. /// A instance with the contents of the specified file. public static ReadWriteTexture2D LoadReadWriteTexture2D(this GraphicsDevice device, ReadOnlySpan filename) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { using UploadTexture2D upload = WICHelper.Instance.LoadTexture(device, filename); @@ -1142,7 +1139,7 @@ public static partial class GraphicsDeviceExtensions /// The buffer with the image data to load and decode into the texture. /// A instance with the contents of the specified file. public static ReadWriteTexture2D LoadReadWriteTexture2D(this GraphicsDevice device, ReadOnlySpan span) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { using UploadTexture2D upload = WICHelper.Instance.LoadTexture(device, span); @@ -1163,7 +1160,7 @@ public static partial class GraphicsDeviceExtensions /// The stream with the image data to load and decode into the texture. /// A instance with the contents of the specified file. public static ReadWriteTexture2D LoadReadWriteTexture2D(this GraphicsDevice device, Stream stream) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { Guard.IsNotNull(stream, nameof(stream)); diff --git a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs index 2e8ec3e4..ec1c9cfc 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture2D{T,TPixel}.cs @@ -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; /// @@ -18,7 +15,7 @@ namespace ComputeSharp; [DebuggerTypeProxy(typeof(Texture2DDebugView<>))] [DebuggerDisplay("{ToString(),raw}")] public sealed class ReadOnlyTexture2D : Texture2D, IReadOnlyTexture2D - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { /// diff --git a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs index a97300b5..e67020da 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadOnlyTexture3D{T,TPixel}.cs @@ -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; /// @@ -18,7 +15,7 @@ namespace ComputeSharp; [DebuggerTypeProxy(typeof(Texture3DDebugView<>))] [DebuggerDisplay("{ToString(),raw}")] public sealed class ReadOnlyTexture3D : Texture3D, IReadOnlyTexture3D - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { /// diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.cs index 09472c1e..ac9b2214 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture2D{T,TPixel}.cs @@ -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; /// @@ -18,7 +15,7 @@ namespace ComputeSharp; [DebuggerTypeProxy(typeof(Texture2DDebugView<>))] [DebuggerDisplay("{ToString(),raw}")] public sealed class ReadWriteTexture2D : Texture2D, IReadWriteTexture2D - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { /// diff --git a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.cs b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.cs index 25765ebe..3007240b 100644 --- a/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.cs +++ b/src/ComputeSharp/Graphics/Resources/ReadWriteTexture3D{T,TPixel}.cs @@ -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; /// @@ -18,7 +15,7 @@ namespace ComputeSharp; [DebuggerTypeProxy(typeof(Texture3DDebugView<>))] [DebuggerDisplay("{ToString(),raw}")] public sealed class ReadWriteTexture3D : Texture3D, IReadWriteTexture3D - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { /// diff --git a/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs b/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs index ac2019ed..d7da40f7 100644 --- a/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs +++ b/src/ComputeSharp/Shaders/Extensions/ComputeContextExtensions.cs @@ -54,7 +54,7 @@ public static partial class ComputeContextExtensions /// The to use to insert the resource barrier. /// The input instance to insert the barrier for. public static unsafe void Barrier(this in ComputeContext context, ReadWriteTexture2D texture) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { context.Barrier(texture.ValidateAndGetID3D12Resource(context.GraphicsDevice)); @@ -68,7 +68,7 @@ public static partial class ComputeContextExtensions /// The to use to insert the resource barrier. /// The input instance to insert the barrier for. public static unsafe void Barrier(this in ComputeContext context, ReadWriteTexture3D texture) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { context.Barrier(texture.ValidateAndGetID3D12Resource(context.GraphicsDevice)); @@ -148,7 +148,7 @@ public static partial class ComputeContextExtensions /// The to use to clear the resource. /// The input instance to clear. public static unsafe void Clear(this in ComputeContext context, ReadWriteTexture2D texture) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized); @@ -164,7 +164,7 @@ public static partial class ComputeContextExtensions /// The to use to clear the resource. /// The input instance to clear. public static unsafe void Clear(this in ComputeContext context, ReadWriteTexture3D texture) - where T : unmanaged, IUnorm + where T : unmanaged, IPixel where TPixel : unmanaged { var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized);