Merge pull request #192 from Sergio0694/feature/improved-pixel-types
ComputeContext.Fill APIs, new IPixel<T, TPixel> interface
このコミットが含まれているのは:
28ファイル変更
+562
-419
検索条件に一致するファイルはありません
@@ -270,10 +270,10 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
|
||||
Span<Rgba32> span = MemoryMarshal.Cast<ImageSharpRgba32, Rgba32>(pixelSpan);
|
||||
|
||||
using ReadWriteTexture2D<Rgba32, Vector4> texture = GraphicsDevice.AllocateReadWriteTexture2D<Rgba32, Vector4>(span, source.Width, source.Height);
|
||||
using ReadWriteTexture2D<Vector4> temporary = GraphicsDevice.AllocateReadWriteTexture2D<Vector4>(source.Width, source.Height, AllocationMode.Clear);
|
||||
using ReadWriteTexture2D<Vector4> reals = GraphicsDevice.AllocateReadWriteTexture2D<Vector4>(source.Width, source.Height);
|
||||
using ReadWriteTexture2D<Vector4> imaginaries = GraphicsDevice.AllocateReadWriteTexture2D<Vector4>(source.Width, source.Height);
|
||||
using ReadWriteTexture2D<Rgba32, float4> texture = GraphicsDevice.AllocateReadWriteTexture2D<Rgba32, float4>(span, source.Width, source.Height);
|
||||
using ReadWriteTexture2D<float4> temporary = GraphicsDevice.AllocateReadWriteTexture2D<float4>(source.Width, source.Height, AllocationMode.Clear);
|
||||
using ReadWriteTexture2D<float4> reals = GraphicsDevice.AllocateReadWriteTexture2D<float4>(source.Width, source.Height);
|
||||
using ReadWriteTexture2D<float4> imaginaries = GraphicsDevice.AllocateReadWriteTexture2D<float4>(source.Width, source.Height);
|
||||
using ReadOnlyBuffer<Complex64> kernel = GraphicsDevice.AllocateReadOnlyBuffer<Complex64>(KernelSize);
|
||||
|
||||
// Preliminary gamma highlight pass
|
||||
@@ -315,16 +315,16 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
[AutoConstructor]
|
||||
internal partial struct VerticalConvolutionProcessor : IComputeShader
|
||||
{
|
||||
public IReadWriteTexture2D<Vector4> source;
|
||||
public ReadWriteTexture2D<Vector4> reals;
|
||||
public ReadWriteTexture2D<Vector4> imaginaries;
|
||||
public IReadWriteTexture2D<float4> source;
|
||||
public ReadWriteTexture2D<float4> reals;
|
||||
public ReadWriteTexture2D<float4> imaginaries;
|
||||
public ReadOnlyBuffer<Complex64> kernel;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
Vector4 real = Vector4.Zero;
|
||||
Vector4 imaginary = Vector4.Zero;
|
||||
float4 real = float4.Zero;
|
||||
float4 imaginary = float4.Zero;
|
||||
int maxY = source.Height;
|
||||
int maxX = source.Width;
|
||||
int kernelLength = kernel.Length;
|
||||
@@ -334,7 +334,7 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
{
|
||||
int offsetY = Hlsl.Clamp(ThreadIds.Y + i - radiusY, 0, maxY);
|
||||
int offsetX = Hlsl.Clamp(ThreadIds.X, 0, maxX);
|
||||
Vector4 color = source[offsetX, offsetY];
|
||||
float4 color = source[offsetX, offsetY];
|
||||
Complex64 factors = kernel[i];
|
||||
|
||||
real += factors.Real * color;
|
||||
@@ -355,16 +355,16 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
public float z;
|
||||
public float w;
|
||||
|
||||
public ReadWriteTexture2D<Vector4> reals;
|
||||
public ReadWriteTexture2D<Vector4> imaginaries;
|
||||
public ReadWriteTexture2D<Vector4> target;
|
||||
public ReadWriteTexture2D<float4> reals;
|
||||
public ReadWriteTexture2D<float4> imaginaries;
|
||||
public ReadWriteTexture2D<float4> target;
|
||||
public ReadOnlyBuffer<Complex64> kernel;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
Vector4 real = Vector4.Zero;
|
||||
Vector4 imaginary = Vector4.Zero;
|
||||
float4 real = float4.Zero;
|
||||
float4 imaginary = float4.Zero;
|
||||
int maxY = target.Height;
|
||||
int maxX = target.Width;
|
||||
int kernelLength = kernel.Length;
|
||||
@@ -374,8 +374,8 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
for (int i = 0; i < kernelLength; i++)
|
||||
{
|
||||
int offsetX = Hlsl.Clamp(ThreadIds.X + i - radiusX, 0, maxX);
|
||||
Vector4 sourceReal = reals[offsetX, offsetY];
|
||||
Vector4 sourceImaginary = imaginaries[offsetX, offsetY];
|
||||
float4 sourceReal = reals[offsetX, offsetY];
|
||||
float4 sourceImaginary = imaginaries[offsetX, offsetY];
|
||||
Complex64 factors = kernel[i];
|
||||
|
||||
real += factors.Real * sourceReal - factors.Imaginary * sourceImaginary;
|
||||
@@ -392,7 +392,7 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct GammaHighlightProcessor : IComputeShader
|
||||
{
|
||||
public readonly IReadWriteTexture2D<Vector4> source;
|
||||
public readonly IReadWriteTexture2D<float4> source;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
@@ -416,8 +416,8 @@ public sealed partial class HlslBokehBlurProcessor
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct InverseGammaHighlightProcessor : IComputeShader
|
||||
{
|
||||
public readonly ReadWriteTexture2D<Vector4> source;
|
||||
public readonly IReadWriteTexture2D<Vector4> target;
|
||||
public readonly ReadWriteTexture2D<float4> source;
|
||||
public readonly IReadWriteTexture2D<float4> target;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
|
||||
+10
-10
@@ -101,8 +101,8 @@ public sealed partial class HlslGaussianBlurProcessor
|
||||
|
||||
Span<Rgba32> span = MemoryMarshal.Cast<ImageSharpRgba32, Rgba32>(pixelSpan);
|
||||
|
||||
using ReadWriteTexture2D<Rgba32, Vector4> sourceTexture = GraphicsDevice.AllocateReadWriteTexture2D<Rgba32, Vector4>(span, source.Width, source.Height);
|
||||
using ReadWriteTexture2D<Rgba32, Vector4> firstPassTexture = GraphicsDevice.AllocateReadWriteTexture2D<Rgba32, Vector4>(source.Width, source.Height);
|
||||
using ReadWriteTexture2D<Rgba32, float4> sourceTexture = GraphicsDevice.AllocateReadWriteTexture2D<Rgba32, float4>(span, source.Width, source.Height);
|
||||
using ReadWriteTexture2D<Rgba32, float4> firstPassTexture = GraphicsDevice.AllocateReadWriteTexture2D<Rgba32, float4>(source.Width, source.Height);
|
||||
using ReadOnlyBuffer<float> kernelBuffer = GraphicsDevice.AllocateReadOnlyBuffer(Kernel);
|
||||
|
||||
using (var context = GraphicsDevice.CreateComputeContext())
|
||||
@@ -121,14 +121,14 @@ public sealed partial class HlslGaussianBlurProcessor
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct VerticalConvolutionProcessor : IComputeShader
|
||||
{
|
||||
public readonly IReadWriteTexture2D<Vector4> source;
|
||||
public readonly IReadWriteTexture2D<Vector4> target;
|
||||
public readonly IReadWriteTexture2D<float4> source;
|
||||
public readonly IReadWriteTexture2D<float4> target;
|
||||
public readonly ReadOnlyBuffer<float> kernel;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
Vector4 result = Vector4.Zero;
|
||||
float4 result = float4.Zero;
|
||||
int maxY = source.Height - 1;
|
||||
int maxX = source.Width - 1;
|
||||
int kernelLength = kernel.Length;
|
||||
@@ -138,7 +138,7 @@ public sealed partial class HlslGaussianBlurProcessor
|
||||
{
|
||||
int offsetY = Hlsl.Clamp(ThreadIds.Y + i - radiusY, 0, maxY);
|
||||
int offsetX = Hlsl.Clamp(ThreadIds.X, 0, maxX);
|
||||
Vector4 color = source[offsetX, offsetY];
|
||||
float4 color = source[offsetX, offsetY];
|
||||
|
||||
result += kernel[i] * color;
|
||||
}
|
||||
@@ -153,14 +153,14 @@ public sealed partial class HlslGaussianBlurProcessor
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct HorizontalConvolutionProcessor : IComputeShader
|
||||
{
|
||||
public readonly IReadWriteTexture2D<Vector4> source;
|
||||
public readonly IReadWriteTexture2D<Vector4> target;
|
||||
public readonly IReadWriteTexture2D<float4> source;
|
||||
public readonly IReadWriteTexture2D<float4> target;
|
||||
public readonly ReadOnlyBuffer<float> kernel;
|
||||
|
||||
/// <inheritdoc/>
|
||||
public void Execute()
|
||||
{
|
||||
Vector4 result = Vector4.Zero;
|
||||
float4 result = float4.Zero;
|
||||
int maxY = source.Height - 1;
|
||||
int maxX = source.Width - 1;
|
||||
int kernelLength = kernel.Length;
|
||||
@@ -170,7 +170,7 @@ public sealed partial class HlslGaussianBlurProcessor
|
||||
for (int i = 0; i < kernelLength; i++)
|
||||
{
|
||||
int offsetX = Hlsl.Clamp(ThreadIds.X + i - radiusX, 0, maxX);
|
||||
Vector4 color = source[offsetX, offsetY];
|
||||
float4 color = source[offsetX, offsetY];
|
||||
|
||||
result += kernel[i] * color;
|
||||
}
|
||||
|
||||
@@ -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, Float4>
|
||||
#if NET6_0_OR_GREATER
|
||||
, ISpanFormattable
|
||||
#endif
|
||||
@@ -52,10 +49,10 @@ public struct Bgra32 : IEquatable<Bgra32>, IUnorm<Vector4>, IUnorm<Float4>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public Bgra32(byte r, byte g, byte b)
|
||||
{
|
||||
R = r;
|
||||
G = g;
|
||||
B = b;
|
||||
A = byte.MaxValue;
|
||||
this.R = r;
|
||||
this.G = g;
|
||||
this.B = b;
|
||||
this.A = byte.MaxValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -68,10 +65,10 @@ public struct Bgra32 : IEquatable<Bgra32>, IUnorm<Vector4>, IUnorm<Float4>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public Bgra32(byte r, byte g, byte b, byte a)
|
||||
{
|
||||
R = r;
|
||||
G = g;
|
||||
B = b;
|
||||
A = a;
|
||||
this.R = r;
|
||||
this.G = g;
|
||||
this.B = b;
|
||||
this.A = a;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -80,12 +77,22 @@ public struct Bgra32 : IEquatable<Bgra32>, IUnorm<Vector4>, IUnorm<Float4>
|
||||
public uint PackedValue
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => Unsafe.As<Bgra32, uint>(ref Unsafe.AsRef(this));
|
||||
readonly get => Unsafe.As<Bgra32, uint>(ref Unsafe.AsRef(in this));
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set => Unsafe.As<Bgra32, uint>(ref this) = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly Float4 ToPixel()
|
||||
{
|
||||
Vector4 linear = new(this.R, this.G, this.B, this.A);
|
||||
Vector4 normalized = linear / byte.MaxValue;
|
||||
|
||||
return normalized;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compares two <see cref="Bgra32"/> objects for equality.
|
||||
/// </summary>
|
||||
|
||||
@@ -0,0 +1,22 @@
|
||||
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
|
||||
{
|
||||
/// <summary>
|
||||
/// Converts the current <typeparamref name="T"/> value into its normalized <typeparamref name="TPixel"/> representation.
|
||||
/// </summary>
|
||||
/// <returns>The <typeparamref name="TPixel"/> representation for the current value.</returns>
|
||||
/// <remarks>
|
||||
/// This method is primarily meant to be used to support
|
||||
/// <see cref="ComputeContextExtensions.Fill{TPixel}(in ComputeContext, IReadWriteTexture2D{TPixel}, TPixel)"/>
|
||||
/// and <see cref="ComputeContextExtensions.Fill{TPixel}(in ComputeContext, IReadWriteTexture3D{TPixel}, TPixel)"/>.
|
||||
/// </remarks>
|
||||
TPixel ToPixel();
|
||||
}
|
||||
@@ -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
|
||||
@@ -30,7 +27,7 @@ public struct R16 : IEquatable<R16>, IUnorm<float>
|
||||
/// <param name="r">The red component.</param>
|
||||
public R16(ushort r)
|
||||
{
|
||||
R = r;
|
||||
this.R = r;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -39,12 +36,19 @@ public struct R16 : IEquatable<R16>, IUnorm<float>
|
||||
public ushort PackedValue
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => Unsafe.As<R16, ushort>(ref Unsafe.AsRef(this));
|
||||
readonly get => Unsafe.As<R16, ushort>(ref Unsafe.AsRef(in this));
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set => Unsafe.As<R16, ushort>(ref this) = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly float ToPixel()
|
||||
{
|
||||
return this.R / (float)ushort.MaxValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compares two <see cref="R16"/> objects for equality.
|
||||
/// </summary>
|
||||
|
||||
@@ -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
|
||||
@@ -30,7 +27,7 @@ public struct R8 : IEquatable<R8>, IUnorm<float>
|
||||
/// <param name="r">The red component.</param>
|
||||
public R8(byte r)
|
||||
{
|
||||
R = r;
|
||||
this.R = r;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -39,12 +36,19 @@ public struct R8 : IEquatable<R8>, IUnorm<float>
|
||||
public byte PackedValue
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => Unsafe.As<R8, byte>(ref Unsafe.AsRef(this));
|
||||
readonly get => Unsafe.As<R8, byte>(ref Unsafe.AsRef(in this));
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set => Unsafe.As<R8, byte>(ref this) = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly float ToPixel()
|
||||
{
|
||||
return this.R / (float)byte.MaxValue;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compares two <see cref="R8"/> objects for equality.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.__Internals;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace ComputeSharp;
|
||||
|
||||
@@ -15,7 +11,7 @@ namespace ComputeSharp;
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Rg16 : IEquatable<Rg16>, IUnorm<Vector2>, IUnorm<Float2>
|
||||
public struct Rg16 : IEquatable<Rg16>, IPixel<Rg16, Float2>
|
||||
#if NET6_0_OR_GREATER
|
||||
, ISpanFormattable
|
||||
#endif
|
||||
@@ -37,8 +33,8 @@ public struct Rg16 : IEquatable<Rg16>, IUnorm<Vector2>, IUnorm<Float2>
|
||||
/// <param name="g">The green component.</param>
|
||||
public Rg16(byte r, byte g)
|
||||
{
|
||||
R = r;
|
||||
G = g;
|
||||
this.R = r;
|
||||
this.G = g;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -47,12 +43,19 @@ public struct Rg16 : IEquatable<Rg16>, IUnorm<Vector2>, IUnorm<Float2>
|
||||
public ushort PackedValue
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => Unsafe.As<Rg16, ushort>(ref Unsafe.AsRef(this));
|
||||
readonly get => Unsafe.As<Rg16, ushort>(ref Unsafe.AsRef(in this));
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set => Unsafe.As<Rg16, ushort>(ref this) = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly Float2 ToPixel()
|
||||
{
|
||||
return new(this.R / (float)byte.MaxValue, this.G / (float)byte.MaxValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compares two <see cref="Rg16"/> objects for equality.
|
||||
/// </summary>
|
||||
|
||||
@@ -1,10 +1,6 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
using ComputeSharp.__Internals;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace ComputeSharp;
|
||||
|
||||
@@ -15,7 +11,7 @@ namespace ComputeSharp;
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Rg32 : IEquatable<Rg32>, IUnorm<Vector2>, IUnorm<Float2>
|
||||
public struct Rg32 : IEquatable<Rg32>, IPixel<Rg32, Float2>
|
||||
#if NET6_0_OR_GREATER
|
||||
, ISpanFormattable
|
||||
#endif
|
||||
@@ -37,8 +33,8 @@ public struct Rg32 : IEquatable<Rg32>, IUnorm<Vector2>, IUnorm<Float2>
|
||||
/// <param name="g">The green component.</param>
|
||||
public Rg32(ushort r, ushort g)
|
||||
{
|
||||
R = r;
|
||||
G = g;
|
||||
this.R = r;
|
||||
this.G = g;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -47,12 +43,19 @@ public struct Rg32 : IEquatable<Rg32>, IUnorm<Vector2>, IUnorm<Float2>
|
||||
public uint PackedValue
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => Unsafe.As<Rg32, uint>(ref Unsafe.AsRef(this));
|
||||
readonly get => Unsafe.As<Rg32, uint>(ref Unsafe.AsRef(in this));
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set => Unsafe.As<Rg32, uint>(ref this) = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly Float2 ToPixel()
|
||||
{
|
||||
return new(this.R / (float)ushort.MaxValue, this.G / (float)ushort.MaxValue);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compares two <see cref="Rg32"/> objects for equality.
|
||||
/// </summary>
|
||||
|
||||
@@ -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, Float4>
|
||||
#if NET6_0_OR_GREATER
|
||||
, ISpanFormattable
|
||||
#endif
|
||||
@@ -79,12 +76,22 @@ public struct Rgba32 : IEquatable<Rgba32>, IUnorm<Vector4>, IUnorm<Float4>
|
||||
public uint PackedValue
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => Unsafe.As<Rgba32, uint>(ref Unsafe.AsRef(this));
|
||||
readonly get => Unsafe.As<Rgba32, uint>(ref Unsafe.AsRef(in this));
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set => Unsafe.As<Rgba32, uint>(ref this) = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly Float4 ToPixel()
|
||||
{
|
||||
Vector4 linear = new(this.R, this.G, this.B, this.A);
|
||||
Vector4 normalized = linear / byte.MaxValue;
|
||||
|
||||
return normalized;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compares two <see cref="Rgba32"/> objects for equality.
|
||||
/// </summary>
|
||||
|
||||
@@ -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, Float4>
|
||||
#if NET6_0_OR_GREATER
|
||||
, ISpanFormattable
|
||||
#endif
|
||||
@@ -79,12 +76,22 @@ public struct Rgba64 : IEquatable<Rgba64>, IUnorm<Vector4>, IUnorm<Float4>
|
||||
public ulong PackedValue
|
||||
{
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
readonly get => Unsafe.As<Rgba64, ulong>(ref Unsafe.AsRef(this));
|
||||
readonly get => Unsafe.As<Rgba64, ulong>(ref Unsafe.AsRef(in this));
|
||||
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
set => Unsafe.As<Rgba64, ulong>(ref this) = value;
|
||||
}
|
||||
|
||||
/// <inheritdoc/>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public readonly Float4 ToPixel()
|
||||
{
|
||||
Vector4 linear = new(this.R, this.G, this.B, this.A);
|
||||
Vector4 normalized = linear / ushort.MaxValue;
|
||||
|
||||
return normalized;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Compares two <see cref="Rgba64"/> objects for equality.
|
||||
/// </summary>
|
||||
|
||||
@@ -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
|
||||
{
|
||||
}
|
||||
@@ -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));
|
||||
|
||||
@@ -259,6 +259,30 @@ internal static unsafe class ID3D12GraphicsCommandListExtensions
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fills a target UAV resource.
|
||||
/// </summary>
|
||||
/// <param name="d3D12GraphicsCommandList">The <see cref="ID3D12GraphicsCommandList"/> instance in use.</param>
|
||||
/// <param name="d3D12Resource">The <see cref="ID3D12Resource"/> to fill.</param>
|
||||
/// <param name="d3D12GpuDescriptorHandle">The <see cref="D3D12_GPU_DESCRIPTOR_HANDLE"/> value for the target resource.</param>
|
||||
/// <param name="d3D12CpuDescriptorHandle">The <see cref="D3D12_CPU_DESCRIPTOR_HANDLE"/> value for the target resource.</param>
|
||||
/// <param name="value">The value to use to fill the view.</param>
|
||||
public static unsafe void FillUnorderedAccessView(
|
||||
this ref ID3D12GraphicsCommandList d3D12GraphicsCommandList,
|
||||
ID3D12Resource* d3D12Resource,
|
||||
D3D12_GPU_DESCRIPTOR_HANDLE d3D12GpuDescriptorHandle,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE d3D12CpuDescriptorHandle,
|
||||
Float4 value)
|
||||
{
|
||||
d3D12GraphicsCommandList.ClearUnorderedAccessViewFloat(
|
||||
ViewGPUHandleInCurrentHeap: d3D12GpuDescriptorHandle,
|
||||
ViewCPUHandle: d3D12CpuDescriptorHandle,
|
||||
pResource: d3D12Resource,
|
||||
Values: (float*)&value,
|
||||
NumRects: 0,
|
||||
pRects: null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Binds an input constant buffer to the first root parameter.
|
||||
/// </summary>
|
||||
|
||||
@@ -50,7 +50,7 @@ internal static class DXGIFormatHelper
|
||||
/// Gets whether or not the input type corresponds to a normalized format.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The input type argument to check.</typeparam>
|
||||
/// <returns>TWhether or not the input type corresponds to a normalized format..</returns>
|
||||
/// <returns>Whether or not the input type corresponds to a normalized format.</returns>
|
||||
/// <exception cref="System.ArgumentException">Thrown when the input type <typeparamref name="T"/> is not supported.</exception>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static bool IsNormalizedType<T>()
|
||||
@@ -88,4 +88,25 @@ internal static class DXGIFormatHelper
|
||||
|
||||
return ThrowHelper.ThrowArgumentException<bool>("Invalid texture type");
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Extends a given pixel type to its <see cref="Float4"/> equivalent.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The input pixel value to convert.</typeparam>
|
||||
/// <returns>The <see cref="Float4"/> equivalent value for <paramref name="value"/>.</returns>
|
||||
[MethodImpl(MethodImplOptions.AggressiveInlining)]
|
||||
public static Float4 ExtendToNormalizedValue<T>(T value)
|
||||
where T : unmanaged
|
||||
{
|
||||
if (typeof(T) == typeof(Float4))
|
||||
{
|
||||
return Unsafe.As<T, Float4>(ref value);
|
||||
}
|
||||
|
||||
Float4 result = default;
|
||||
|
||||
Unsafe.As<Float4, T>(ref result) = value;
|
||||
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -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,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,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,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>
|
||||
|
||||
@@ -52,6 +52,19 @@ public struct ComputeContext : IDisposable, IAsyncDisposable
|
||||
}
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserts a resource barrier for a specific resource.
|
||||
/// </summary>
|
||||
/// <param name="d3D12Resource">The <see cref="ID3D12Resource"/> to insert the barrier for.</param>
|
||||
internal readonly unsafe void Barrier(ID3D12Resource* d3D12Resource)
|
||||
{
|
||||
ThrowInvalidOperationExceptionIfDeviceIsNull();
|
||||
|
||||
ref CommandList commandList = ref GetCommandList(in this);
|
||||
|
||||
commandList.D3D12GraphicsCommandList->UnorderedAccessViewBarrier(d3D12Resource);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears a specific resource.
|
||||
/// </summary>
|
||||
@@ -73,16 +86,23 @@ public struct ComputeContext : IDisposable, IAsyncDisposable
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Inserts a resource barrier for a specific resource.
|
||||
/// Fills a specific resource.
|
||||
/// </summary>
|
||||
/// <param name="d3D12Resource">The <see cref="ID3D12Resource"/> to insert the barrier for.</param>
|
||||
internal readonly unsafe void Barrier(ID3D12Resource* d3D12Resource)
|
||||
/// <param name="d3D12Resource">The <see cref="ID3D12Resource"/> to fill.</param>
|
||||
/// <param name="d3D12GpuDescriptorHandle">The <see cref="D3D12_GPU_DESCRIPTOR_HANDLE"/> value for the target resource.</param>
|
||||
/// <param name="d3D12CpuDescriptorHandle">The <see cref="D3D12_CPU_DESCRIPTOR_HANDLE"/> value for the target resource.</param>
|
||||
/// <param name="value">The value to use to fill the resource.</param>
|
||||
internal readonly unsafe void Fill(
|
||||
ID3D12Resource* d3D12Resource,
|
||||
D3D12_GPU_DESCRIPTOR_HANDLE d3D12GpuDescriptorHandle,
|
||||
D3D12_CPU_DESCRIPTOR_HANDLE d3D12CpuDescriptorHandle,
|
||||
Float4 value)
|
||||
{
|
||||
ThrowInvalidOperationExceptionIfDeviceIsNull();
|
||||
|
||||
ref CommandList commandList = ref GetCommandList(in this);
|
||||
ref CommandList commandList = ref GetCommandList(in this, null);
|
||||
|
||||
commandList.D3D12GraphicsCommandList->UnorderedAccessViewBarrier(d3D12Resource);
|
||||
commandList.D3D12GraphicsCommandList->FillUnorderedAccessView(d3D12Resource, d3D12GpuDescriptorHandle, d3D12CpuDescriptorHandle, value);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System.Runtime.CompilerServices;
|
||||
using ComputeSharp.__Internals;
|
||||
using ComputeSharp.Graphics.Helpers;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
@@ -8,7 +9,7 @@ namespace ComputeSharp;
|
||||
/// <summary>
|
||||
/// A <see langword="class"/> that contains extension methods for the <see cref="ComputeContext"/> type, used to run compute shaders.
|
||||
/// </summary>
|
||||
public static partial class ComputeContextExtensions
|
||||
public static class ComputeContextExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Inserts a resource barrier for a specific resource.
|
||||
@@ -54,7 +55,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 +69,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));
|
||||
@@ -113,7 +114,7 @@ public static partial class ComputeContextExtensions
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears a specific resource, with a specified value.
|
||||
/// Clears a specific resource.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
|
||||
/// <param name="context">The <see cref="ComputeContext"/> to use to clear the resource.</param>
|
||||
@@ -127,7 +128,7 @@ public static partial class ComputeContextExtensions
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears a specific resource, with a specified value.
|
||||
/// Clears a specific resource.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
|
||||
/// <param name="context">The <see cref="ComputeContext"/> to use to clear the resource.</param>
|
||||
@@ -141,39 +142,39 @@ public static partial class ComputeContextExtensions
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears a specific resource, with a specified value.
|
||||
/// Clears a specific resource.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
|
||||
/// <typeparam name="TPixel">The type of pixels used on the GPU side.</typeparam>
|
||||
/// <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);
|
||||
var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
|
||||
|
||||
context.Clear(texture.D3D12Resource, handles.Gpu, handles.Cpu, isNormalized);
|
||||
context.Clear(texture.D3D12Resource, handles.Gpu, handles.Cpu, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears a specific resource, with a specified value.
|
||||
/// Clears a specific resource.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
|
||||
/// <typeparam name="TPixel">The type of pixels used on the GPU side.</typeparam>
|
||||
/// <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);
|
||||
var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
|
||||
|
||||
context.Clear(texture.D3D12Resource, handles.Gpu, handles.Cpu, isNormalized);
|
||||
context.Clear(texture.D3D12Resource, handles.Gpu, handles.Cpu, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears a specific resource, with a specified value.
|
||||
/// Clears a specific resource.
|
||||
/// </summary>
|
||||
/// <typeparam name="TPixel">The type of pixels stored on the texture.</typeparam>
|
||||
/// <param name="context">The <see cref="ComputeContext"/> to use to clear the resource.</param>
|
||||
@@ -181,13 +182,13 @@ public static partial class ComputeContextExtensions
|
||||
public static unsafe void Clear<TPixel>(this in ComputeContext context, IReadWriteTexture2D<TPixel> texture)
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized);
|
||||
var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
|
||||
|
||||
context.Clear(((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetID3D12Resource(context.GraphicsDevice), handles.Gpu, handles.Cpu, isNormalized);
|
||||
context.Clear(((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetID3D12Resource(context.GraphicsDevice), handles.Gpu, handles.Cpu, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Clears a specific resource, with a specified value.
|
||||
/// Clears a specific resource.
|
||||
/// </summary>
|
||||
/// <typeparam name="TPixel">The type of pixels stored on the texture.</typeparam>
|
||||
/// <param name="context">The <see cref="ComputeContext"/> to use to clear the resource.</param>
|
||||
@@ -195,9 +196,81 @@ public static partial class ComputeContextExtensions
|
||||
public static unsafe void Clear<TPixel>(this in ComputeContext context, IReadWriteTexture3D<TPixel> texture)
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out bool isNormalized);
|
||||
var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
|
||||
|
||||
context.Clear(((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetID3D12Resource(context.GraphicsDevice), handles.Gpu, handles.Cpu, isNormalized);
|
||||
context.Clear(((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetID3D12Resource(context.GraphicsDevice), handles.Gpu, handles.Cpu, true);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fills a specific texture with a given value.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
|
||||
/// <typeparam name="TPixel">The type of pixels used on the GPU side.</typeparam>
|
||||
/// <param name="context">The <see cref="ComputeContext"/> to use to fill the resource.</param>
|
||||
/// <param name="texture">The input <see cref="ReadWriteTexture2D{T,TPixel}"/> instance to fill.</param>
|
||||
/// <param name="value">The value to use to fill <paramref name="texture"/>.</param>
|
||||
public static unsafe void Fill<T, TPixel>(this in ComputeContext context, ReadWriteTexture2D<T, TPixel> texture, T value)
|
||||
where T : unmanaged, IPixel<T, TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
|
||||
|
||||
context.Fill(texture.D3D12Resource, handles.Gpu, handles.Cpu, DXGIFormatHelper.ExtendToNormalizedValue(value.ToPixel()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fills a specific texture with a given value.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of items stored on the texture.</typeparam>
|
||||
/// <typeparam name="TPixel">The type of pixels used on the GPU side.</typeparam>
|
||||
/// <param name="context">The <see cref="ComputeContext"/> to use to fill the resource.</param>
|
||||
/// <param name="texture">The input <see cref="ReadWriteTexture3D{T,TPixel}"/> instance to fill.</param>
|
||||
/// <param name="value">The value to use to fill <paramref name="texture"/>.</param>
|
||||
public static unsafe void Fill<T, TPixel>(this in ComputeContext context, ReadWriteTexture3D<T, TPixel> texture, T value)
|
||||
where T : unmanaged, IPixel<T, TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
var handles = texture.ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
|
||||
|
||||
context.Fill(texture.D3D12Resource, handles.Gpu, handles.Cpu, DXGIFormatHelper.ExtendToNormalizedValue(value.ToPixel()));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fills a specific texture with a given value.
|
||||
/// </summary>
|
||||
/// <typeparam name="TPixel">The type of pixels stored on the texture.</typeparam>
|
||||
/// <param name="context">The <see cref="ComputeContext"/> to use to fill the resource.</param>
|
||||
/// <param name="texture">The input <see cref="IReadWriteTexture2D{TPixel}"/> instance to fill.</param>
|
||||
/// <param name="value">The value to use to fill <paramref name="texture"/>.</param>
|
||||
public static unsafe void Fill<TPixel>(this in ComputeContext context, IReadWriteTexture2D<TPixel> texture, TPixel value)
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
|
||||
|
||||
context.Fill(
|
||||
((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetID3D12Resource(context.GraphicsDevice),
|
||||
handles.Gpu,
|
||||
handles.Cpu,
|
||||
DXGIFormatHelper.ExtendToNormalizedValue(value));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Fills a specific texture with a given value.
|
||||
/// </summary>
|
||||
/// <typeparam name="TPixel">The type of pixels stored on the texture.</typeparam>
|
||||
/// <param name="context">The <see cref="ComputeContext"/> to use to fill the resource.</param>
|
||||
/// <param name="texture">The input <see cref="IReadWriteTexture3D{TPixel}"/> instance to fill.</param>
|
||||
/// <param name="value">The value to use to fill <paramref name="texture"/>.</param>
|
||||
public static unsafe void Fill<TPixel>(this in ComputeContext context, IReadWriteTexture3D<TPixel> texture, TPixel value)
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
var handles = ((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetGpuAndCpuDescriptorHandlesForClear(context.GraphicsDevice, out _);
|
||||
|
||||
context.Fill(
|
||||
((GraphicsResourceHelper.IGraphicsResource)texture).ValidateAndGetID3D12Resource(context.GraphicsDevice),
|
||||
handles.Gpu,
|
||||
handles.Cpu,
|
||||
DXGIFormatHelper.ExtendToNormalizedValue(value));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
|
||||
@@ -1,15 +1,12 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using ComputeSharp.__Internals;
|
||||
using ComputeSharp.Tests.Attributes;
|
||||
using ComputeSharp.Tests.Extensions;
|
||||
using ComputeSharp.Tests.Helpers;
|
||||
using Microsoft.Toolkit.HighPerformance;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace ComputeSharp.Tests;
|
||||
|
||||
[TestClass]
|
||||
@@ -182,7 +179,7 @@ public partial class ComputeContextTests
|
||||
public void Clear_ReadWriteTexture2D_WithPixel(Device device, Type cpuType, Type gpuType)
|
||||
{
|
||||
static void Test<T, TPixel>(Device device)
|
||||
where T : unmanaged, IUnorm<TPixel>
|
||||
where T : unmanaged, IPixel<T, TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
if (!device.Get().IsReadWriteTexture2DSupportedForType<T>())
|
||||
@@ -224,7 +221,7 @@ public partial class ComputeContextTests
|
||||
public void Clear_ReadWriteTexture3D_WithPixel(Device device, Type cpuType, Type gpuType)
|
||||
{
|
||||
static void Test<T, TPixel>(Device device)
|
||||
where T : unmanaged, IUnorm<TPixel>
|
||||
where T : unmanaged, IPixel<T, TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
if (!device.Get().IsReadWriteTexture2DSupportedForType<T>())
|
||||
@@ -266,7 +263,7 @@ public partial class ComputeContextTests
|
||||
public void Clear_ReadWriteTexture2D_WithPixel_AsNormalizedTexture(Device device, Type cpuType, Type gpuType)
|
||||
{
|
||||
static void Test<T, TPixel>(Device device)
|
||||
where T : unmanaged, IUnorm<TPixel>
|
||||
where T : unmanaged, IPixel<T, TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
if (!device.Get().IsReadWriteTexture2DSupportedForType<T>())
|
||||
@@ -308,7 +305,7 @@ public partial class ComputeContextTests
|
||||
public void Clear_ReadWriteTexture3D_WithPixel_AsNormalizedTexture(Device device, Type cpuType, Type gpuType)
|
||||
{
|
||||
static void Test<T, TPixel>(Device device)
|
||||
where T : unmanaged, IUnorm<TPixel>
|
||||
where T : unmanaged, IPixel<T, TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
if (!device.Get().IsReadWriteTexture2DSupportedForType<T>())
|
||||
@@ -338,6 +335,212 @@ public partial class ComputeContextTests
|
||||
TestHelper.Run(Test<Bgra32, Float4>, cpuType, gpuType, device);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Gets a sample pixel color of the specified type.
|
||||
/// </summary>
|
||||
/// <typeparam name="T">The type of pixel to get.</typeparam>
|
||||
/// <returns>A sample pixel color of the specified type.</returns>
|
||||
/// <exception cref="ArgumentException">Thrown when <typeparamref name="T"/> isn't valid.</exception>
|
||||
private static T GetColor<T>()
|
||||
{
|
||||
if (typeof(T) == typeof(Bgra32))
|
||||
{
|
||||
return (T)(object)new Bgra32(0x6B, 0x6D, 0x9E, 0xC0);
|
||||
}
|
||||
|
||||
if (typeof(T) == typeof(Rgba32))
|
||||
{
|
||||
return (T)(object)new Rgba32(0x6B, 0x6D, 0x9E, 0xC0);
|
||||
}
|
||||
|
||||
if (typeof(T) == typeof(Rgba64))
|
||||
{
|
||||
return (T)(object)new Rgba64(0x6B, 0x6D05, 0x9E, 0xC0);
|
||||
}
|
||||
|
||||
if (typeof(T) == typeof(R8))
|
||||
{
|
||||
return (T)(object)new R8(0x6B);
|
||||
}
|
||||
|
||||
if (typeof(T) == typeof(R16))
|
||||
{
|
||||
return (T)(object)new R16(0x6D05);
|
||||
}
|
||||
|
||||
if (typeof(T) == typeof(Rg16))
|
||||
{
|
||||
return (T)(object)new Rg16(0x6B, 0x6D);
|
||||
}
|
||||
|
||||
if (typeof(T) == typeof(Rg32))
|
||||
{
|
||||
return (T)(object)new Rg32(0x6B, 0x6D05);
|
||||
}
|
||||
|
||||
throw new ArgumentException("Invalid pixel type");
|
||||
}
|
||||
|
||||
[CombinatorialTestMethod]
|
||||
[AllDevices]
|
||||
[Data(typeof(Bgra32), typeof(Float4))]
|
||||
[Data(typeof(Rgba32), typeof(Float4))]
|
||||
[Data(typeof(Rgba64), typeof(Float4))]
|
||||
[Data(typeof(R8), typeof(float))]
|
||||
[Data(typeof(R16), typeof(float))]
|
||||
[Data(typeof(Rg16), typeof(Float2))]
|
||||
[Data(typeof(Rg32), typeof(Float2))]
|
||||
public void Fill_ReadWriteTexture2D_WithPixel(Device device, Type cpuType, Type gpuType)
|
||||
{
|
||||
static void Test<T, TPixel>(Device device)
|
||||
where T : unmanaged, IPixel<T, TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
if (!device.Get().IsReadWriteTexture2DSupportedForType<T>())
|
||||
{
|
||||
Assert.Inconclusive();
|
||||
}
|
||||
|
||||
T color = GetColor<T>();
|
||||
|
||||
using ReadWriteTexture2D<T, TPixel> texture = device.Get().AllocateReadWriteTexture2D<T, TPixel>(128, 128);
|
||||
|
||||
using (ComputeContext context = device.Get().CreateComputeContext())
|
||||
{
|
||||
context.Fill(texture, color);
|
||||
}
|
||||
|
||||
T[,] result = texture.ToArray();
|
||||
|
||||
foreach (T value in result)
|
||||
{
|
||||
Assert.AreEqual(value, color);
|
||||
}
|
||||
}
|
||||
|
||||
TestHelper.Run(Test<Bgra32, Float4>, cpuType, gpuType, device);
|
||||
}
|
||||
|
||||
[CombinatorialTestMethod]
|
||||
[AllDevices]
|
||||
[Data(typeof(Bgra32), typeof(Float4))]
|
||||
[Data(typeof(Rgba32), typeof(Float4))]
|
||||
[Data(typeof(Rgba64), typeof(Float4))]
|
||||
[Data(typeof(R8), typeof(float))]
|
||||
[Data(typeof(R16), typeof(float))]
|
||||
[Data(typeof(Rg16), typeof(Float2))]
|
||||
[Data(typeof(Rg32), typeof(Float2))]
|
||||
public void Fill_ReadWriteTexture3D_WithPixel(Device device, Type cpuType, Type gpuType)
|
||||
{
|
||||
static void Test<T, TPixel>(Device device)
|
||||
where T : unmanaged, IPixel<T, TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
if (!device.Get().IsReadWriteTexture2DSupportedForType<T>())
|
||||
{
|
||||
Assert.Inconclusive();
|
||||
}
|
||||
|
||||
T color = GetColor<T>();
|
||||
|
||||
using ReadWriteTexture3D<T, TPixel> texture = device.Get().AllocateReadWriteTexture3D<T, TPixel>(128, 128, 3);
|
||||
|
||||
using (ComputeContext context = device.Get().CreateComputeContext())
|
||||
{
|
||||
context.Fill(texture, color);
|
||||
}
|
||||
|
||||
T[,,] result = texture.ToArray();
|
||||
|
||||
foreach (T value in result)
|
||||
{
|
||||
Assert.AreEqual(value, color);
|
||||
}
|
||||
}
|
||||
|
||||
TestHelper.Run(Test<Bgra32, Float4>, cpuType, gpuType, device);
|
||||
}
|
||||
|
||||
[CombinatorialTestMethod]
|
||||
[AllDevices]
|
||||
[Data(typeof(Bgra32), typeof(Float4))]
|
||||
[Data(typeof(Rgba32), typeof(Float4))]
|
||||
[Data(typeof(Rgba64), typeof(Float4))]
|
||||
[Data(typeof(R8), typeof(float))]
|
||||
[Data(typeof(R16), typeof(float))]
|
||||
[Data(typeof(Rg16), typeof(Float2))]
|
||||
[Data(typeof(Rg32), typeof(Float2))]
|
||||
public void Fill_ReadWriteTexture2D_WithPixel_AsNormalizedTexture(Device device, Type cpuType, Type gpuType)
|
||||
{
|
||||
static void Test<T, TPixel>(Device device)
|
||||
where T : unmanaged, IPixel<T, TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
if (!device.Get().IsReadWriteTexture2DSupportedForType<T>())
|
||||
{
|
||||
Assert.Inconclusive();
|
||||
}
|
||||
|
||||
T color = GetColor<T>();
|
||||
|
||||
using ReadWriteTexture2D<T, TPixel> texture = device.Get().AllocateReadWriteTexture2D<T, TPixel>(128, 128);
|
||||
|
||||
using (ComputeContext context = device.Get().CreateComputeContext())
|
||||
{
|
||||
context.Fill((IReadWriteTexture2D<TPixel>)texture, color.ToPixel());
|
||||
}
|
||||
|
||||
T[,] result = texture.ToArray();
|
||||
|
||||
foreach (T value in result)
|
||||
{
|
||||
Assert.AreEqual(value, color);
|
||||
}
|
||||
}
|
||||
|
||||
TestHelper.Run(Test<Bgra32, Float4>, cpuType, gpuType, device);
|
||||
}
|
||||
|
||||
[CombinatorialTestMethod]
|
||||
[AllDevices]
|
||||
[Data(typeof(Bgra32), typeof(Float4))]
|
||||
[Data(typeof(Rgba32), typeof(Float4))]
|
||||
[Data(typeof(Rgba64), typeof(Float4))]
|
||||
[Data(typeof(R8), typeof(float))]
|
||||
[Data(typeof(R16), typeof(float))]
|
||||
[Data(typeof(Rg16), typeof(Float2))]
|
||||
[Data(typeof(Rg32), typeof(Float2))]
|
||||
public void Fill_ReadWriteTexture3D_WithPixel_AsNormalizedTexture(Device device, Type cpuType, Type gpuType)
|
||||
{
|
||||
static void Test<T, TPixel>(Device device)
|
||||
where T : unmanaged, IPixel<T, TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
if (!device.Get().IsReadWriteTexture2DSupportedForType<T>())
|
||||
{
|
||||
Assert.Inconclusive();
|
||||
}
|
||||
|
||||
T color = GetColor<T>();
|
||||
|
||||
using ReadWriteTexture3D<T, TPixel> texture = device.Get().AllocateReadWriteTexture3D<T, TPixel>(128, 128, 3);
|
||||
|
||||
using (ComputeContext context = device.Get().CreateComputeContext())
|
||||
{
|
||||
context.Fill((IReadWriteTexture3D<TPixel>)texture, color.ToPixel());
|
||||
}
|
||||
|
||||
T[,,] result = texture.ToArray();
|
||||
|
||||
foreach (T value in result)
|
||||
{
|
||||
Assert.AreEqual(value, color);
|
||||
}
|
||||
}
|
||||
|
||||
TestHelper.Run(Test<Bgra32, Float4>, cpuType, gpuType, device);
|
||||
}
|
||||
|
||||
[CombinatorialTestMethod]
|
||||
[AllDevices]
|
||||
public void For_Batched(Device device)
|
||||
|
||||
@@ -1,10 +1,7 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using ComputeSharp.__Internals;
|
||||
using ComputeSharp.Resources;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace ComputeSharp.Tests.Extensions;
|
||||
|
||||
/// <summary>
|
||||
@@ -66,7 +63,7 @@ public static class GraphicsDeviceExtensions
|
||||
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
|
||||
/// <returns>A <see cref="Texture2D{T}"/> instance of the requested size.</returns>
|
||||
public static Texture2D<T> AllocateTexture2D<T, TPixel>(this GraphicsDevice device, Type type, int width, int height, AllocationMode allocationMode = AllocationMode.Default)
|
||||
where T : unmanaged, IUnorm<TPixel>
|
||||
where T : unmanaged, IPixel<T, TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
return type switch
|
||||
@@ -112,7 +109,7 @@ public static class GraphicsDeviceExtensions
|
||||
/// <param name="allocationMode">The allocation mode to use for the new resource.</param>
|
||||
/// <returns>A <see cref="Texture3D{T}"/> instance of the requested size.</returns>
|
||||
public static Texture3D<T> AllocateTexture3D<T, TPixel>(this GraphicsDevice device, Type type, 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 type switch
|
||||
@@ -322,7 +319,7 @@ public static class GraphicsDeviceExtensions
|
||||
/// <param name="filename">The filename of the image file to load and decode into the texture.</param>
|
||||
/// <returns>A <see cref="Texture2D{T}"/> instance with the contents of the specified file.</returns>
|
||||
public static Texture2D<T> LoadTexture2D<T, TPixel>(this GraphicsDevice device, Type textureType, Type inputType, string filename)
|
||||
where T : unmanaged, IUnorm<TPixel>
|
||||
where T : unmanaged, IPixel<T, TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
return textureType switch
|
||||
@@ -353,7 +350,7 @@ public static class GraphicsDeviceExtensions
|
||||
/// <param name="buffer">The buffer with the image data to load and decode into the texture.</param>
|
||||
/// <returns>A <see cref="Texture2D{T}"/> instance with the contents of the specified buffer.</returns>
|
||||
public static Texture2D<T> LoadTexture2D<T, TPixel>(this GraphicsDevice device, Type type, byte[] buffer)
|
||||
where T : unmanaged, IUnorm<TPixel>
|
||||
where T : unmanaged, IPixel<T, TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
return type switch
|
||||
@@ -374,7 +371,7 @@ public static class GraphicsDeviceExtensions
|
||||
/// <param name="stream">The stream with the image data to load and decode into the texture.</param>
|
||||
/// <returns>A <see cref="Texture2D{T}"/> instance with the contents of the specified stream.</returns>
|
||||
public static Texture2D<T> LoadTexture2D<T, TPixel>(this GraphicsDevice device, Type type, Stream stream)
|
||||
where T : unmanaged, IUnorm<TPixel>
|
||||
where T : unmanaged, IPixel<T, TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
return type switch
|
||||
|
||||
@@ -1,8 +1,6 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
using ComputeSharp.__Internals;
|
||||
using ComputeSharp.Resources;
|
||||
using ComputeSharp.Tests.Attributes;
|
||||
using ComputeSharp.Tests.Extensions;
|
||||
@@ -10,8 +8,6 @@ using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
using SixLabors.ImageSharp;
|
||||
using ImageSharpRgba32 = SixLabors.ImageSharp.PixelFormats.Rgba32;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace ComputeSharp.Tests;
|
||||
|
||||
public partial class Texture2DTests
|
||||
@@ -20,22 +16,17 @@ public partial class Texture2DTests
|
||||
[AllDevices]
|
||||
[Resource(typeof(ReadOnlyTexture2D<,>))]
|
||||
[Resource(typeof(ReadWriteTexture2D<,>))]
|
||||
[Data(typeof(Bgra32), typeof(Vector4))]
|
||||
[Data(typeof(Bgra32), typeof(float4))]
|
||||
[Data(typeof(R16), typeof(float))]
|
||||
[Data(typeof(R8), typeof(float))]
|
||||
[Data(typeof(Rg16), typeof(Vector2))]
|
||||
[Data(typeof(Rg16), typeof(float2))]
|
||||
[Data(typeof(Rg32), typeof(Vector2))]
|
||||
[Data(typeof(Rg32), typeof(float2))]
|
||||
[Data(typeof(Rgba32), typeof(Vector4))]
|
||||
[Data(typeof(Rgba32), typeof(float4))]
|
||||
[Data(typeof(Rgba64), typeof(Vector4))]
|
||||
[Data(typeof(Rgba64), typeof(float4))]
|
||||
public void Allocate_Uninitialized_Pixel_Ok(Device device, Type textureType, Type t, Type tPixel)
|
||||
{
|
||||
static void Test<T, TPixel>(Device device, Type textureType)
|
||||
where T : unmanaged, IUnorm<TPixel>
|
||||
where T : unmanaged, IPixel<T, TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
using Texture2D<T> texture = device.Get().AllocateTexture2D<T, TPixel>(textureType, 128, 128);
|
||||
@@ -57,7 +48,7 @@ public partial class Texture2DTests
|
||||
|
||||
try
|
||||
{
|
||||
new Action<Device, Type>(Test<Rgba32, Vector4>).Method.GetGenericMethodDefinition().MakeGenericMethod(t, tPixel).Invoke(null, new object[] { device, textureType });
|
||||
new Action<Device, Type>(Test<Rgba32, float4>).Method.GetGenericMethodDefinition().MakeGenericMethod(t, tPixel).Invoke(null, new object[] { device, textureType });
|
||||
}
|
||||
catch (TargetInvocationException e) when (e.InnerException is not null)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using ComputeSharp.Tests.Attributes;
|
||||
using ComputeSharp.Tests.Extensions;
|
||||
|
||||
@@ -9,27 +8,15 @@ public partial class Texture2DTests
|
||||
{
|
||||
[CombinatorialTestMethod]
|
||||
[AllDevices]
|
||||
[Data(typeof(Bgra32), typeof(Vector4))]
|
||||
[Data(typeof(Bgra32), typeof(Float4))]
|
||||
[Data(typeof(R16), typeof(float))]
|
||||
[Data(typeof(R8), typeof(float))]
|
||||
[Data(typeof(Rg16), typeof(Vector2))]
|
||||
[Data(typeof(Rg16), typeof(Float2))]
|
||||
[Data(typeof(Rg32), typeof(Vector2))]
|
||||
[Data(typeof(Rg32), typeof(Float2))]
|
||||
[Data(typeof(Rgba32), typeof(Vector4))]
|
||||
[Data(typeof(Rgba32), typeof(Float4))]
|
||||
[Data(typeof(Rgba64), typeof(Vector4))]
|
||||
[Data(typeof(Rgba64), typeof(Float4))]
|
||||
public void Dispatch_NormalizedTexture2D(Device device, Type t, Type tPixel)
|
||||
{
|
||||
if (t == typeof(Bgra32) && tPixel == typeof(Vector4))
|
||||
{
|
||||
using ReadOnlyTexture2D<Bgra32, Vector4> source = device.Get().AllocateReadOnlyTexture2D<Bgra32, Vector4>(128, 128);
|
||||
using ReadWriteTexture2D<Bgra32, Vector4> destination = device.Get().AllocateReadWriteTexture2D<Bgra32, Vector4>(128, 128);
|
||||
|
||||
device.Get().For(128, 128, new Shader_Unorm_Bgra32_Vector4(source, destination));
|
||||
}
|
||||
if (t == typeof(Bgra32) && tPixel == typeof(Float4))
|
||||
{
|
||||
using ReadOnlyTexture2D<Bgra32, Float4> source = device.Get().AllocateReadOnlyTexture2D<Bgra32, Float4>(128, 128);
|
||||
@@ -51,13 +38,6 @@ public partial class Texture2DTests
|
||||
|
||||
device.Get().For(128, 128, new Shader_Unorm_R8_float(source, destination));
|
||||
}
|
||||
if (t == typeof(Rg16) && tPixel == typeof(Vector2))
|
||||
{
|
||||
using ReadOnlyTexture2D<Rg16, Vector2> source = device.Get().AllocateReadOnlyTexture2D<Rg16, Vector2>(128, 128);
|
||||
using ReadWriteTexture2D<Rg16, Vector2> destination = device.Get().AllocateReadWriteTexture2D<Rg16, Vector2>(128, 128);
|
||||
|
||||
device.Get().For(128, 128, new Shader_Unorm_Rg16_Vector2(source, destination));
|
||||
}
|
||||
if (t == typeof(Rg16) && tPixel == typeof(Float2))
|
||||
{
|
||||
using ReadOnlyTexture2D<Rg16, Float2> source = device.Get().AllocateReadOnlyTexture2D<Rg16, Float2>(128, 128);
|
||||
@@ -65,13 +45,6 @@ public partial class Texture2DTests
|
||||
|
||||
device.Get().For(128, 128, new Shader_Unorm_Rg16_Float2(source, destination));
|
||||
}
|
||||
if (t == typeof(Rg32) && tPixel == typeof(Vector2))
|
||||
{
|
||||
using ReadOnlyTexture2D<Rg32, Vector2> source = device.Get().AllocateReadOnlyTexture2D<Rg32, Vector2>(128, 128);
|
||||
using ReadWriteTexture2D<Rg32, Vector2> destination = device.Get().AllocateReadWriteTexture2D<Rg32, Vector2>(128, 128);
|
||||
|
||||
device.Get().For(128, 128, new Shader_Unorm_Rg32_Vector2(source, destination));
|
||||
}
|
||||
if (t == typeof(Rg32) && tPixel == typeof(Float2))
|
||||
{
|
||||
using ReadOnlyTexture2D<Rg32, Float2> source = device.Get().AllocateReadOnlyTexture2D<Rg32, Float2>(128, 128);
|
||||
@@ -79,13 +52,6 @@ public partial class Texture2DTests
|
||||
|
||||
device.Get().For(128, 128, new Shader_Unorm_Rg32_Float2(source, destination));
|
||||
}
|
||||
if (t == typeof(Rgba32) && tPixel == typeof(Vector4))
|
||||
{
|
||||
using ReadOnlyTexture2D<Rgba32, Vector4> source = device.Get().AllocateReadOnlyTexture2D<Rgba32, Vector4>(128, 128);
|
||||
using ReadWriteTexture2D<Rgba32, Vector4> destination = device.Get().AllocateReadWriteTexture2D<Rgba32, Vector4>(128, 128);
|
||||
|
||||
device.Get().For(128, 128, new Shader_Unorm_Rgba32_Vector4(source, destination));
|
||||
}
|
||||
if (t == typeof(Rgba32) && tPixel == typeof(Float4))
|
||||
{
|
||||
using ReadOnlyTexture2D<Rgba32, Float4> source = device.Get().AllocateReadOnlyTexture2D<Rgba32, Float4>(128, 128);
|
||||
@@ -93,13 +59,6 @@ public partial class Texture2DTests
|
||||
|
||||
device.Get().For(128, 128, new Shader_Unorm_Rgba32_Float4(source, destination));
|
||||
}
|
||||
if (t == typeof(Rgba64) && tPixel == typeof(Vector4))
|
||||
{
|
||||
using ReadOnlyTexture2D<Rgba64, Vector4> source = device.Get().AllocateReadOnlyTexture2D<Rgba64, Vector4>(128, 128);
|
||||
using ReadWriteTexture2D<Rgba64, Vector4> destination = device.Get().AllocateReadWriteTexture2D<Rgba64, Vector4>(128, 128);
|
||||
|
||||
device.Get().For(128, 128, new Shader_Unorm_Rgba64_Vector4(source, destination));
|
||||
}
|
||||
if (t == typeof(Rgba64) && tPixel == typeof(Float4))
|
||||
{
|
||||
using ReadOnlyTexture2D<Rgba64, Float4> source = device.Get().AllocateReadOnlyTexture2D<Rgba64, Float4>(128, 128);
|
||||
@@ -109,18 +68,6 @@ public partial class Texture2DTests
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Bgra32_Vector4 : IComputeShader
|
||||
{
|
||||
public readonly ReadOnlyTexture2D<Bgra32, Vector4> source;
|
||||
public readonly ReadWriteTexture2D<Bgra32, Vector4> destination;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.XY] = (source[ThreadIds.XY] + destination[ThreadIds.XY]) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Bgra32_Float4 : IComputeShader
|
||||
{
|
||||
@@ -157,18 +104,6 @@ public partial class Texture2DTests
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Rg16_Vector2 : IComputeShader
|
||||
{
|
||||
public readonly ReadOnlyTexture2D<Rg16, Vector2> source;
|
||||
public readonly ReadWriteTexture2D<Rg16, Vector2> destination;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.XY] = (source[ThreadIds.XY] + destination[ThreadIds.XY]) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Rg16_Float2 : IComputeShader
|
||||
{
|
||||
@@ -181,18 +116,6 @@ public partial class Texture2DTests
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Rg32_Vector2 : IComputeShader
|
||||
{
|
||||
public readonly ReadOnlyTexture2D<Rg32, Vector2> source;
|
||||
public readonly ReadWriteTexture2D<Rg32, Vector2> destination;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.XY] = (source[ThreadIds.XY] + destination[ThreadIds.XY]) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Rg32_Float2 : IComputeShader
|
||||
{
|
||||
@@ -205,18 +128,6 @@ public partial class Texture2DTests
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Rgba32_Vector4 : IComputeShader
|
||||
{
|
||||
public readonly ReadOnlyTexture2D<Rgba32, Vector4> source;
|
||||
public readonly ReadWriteTexture2D<Rgba32, Vector4> destination;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.XY] = (source[ThreadIds.XY] + destination[ThreadIds.XY]) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Rgba32_Float4 : IComputeShader
|
||||
{
|
||||
@@ -229,18 +140,6 @@ public partial class Texture2DTests
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Rgba64_Vector4 : IComputeShader
|
||||
{
|
||||
public readonly ReadOnlyTexture2D<Rgba64, Vector4> source;
|
||||
public readonly ReadWriteTexture2D<Rgba64, Vector4> destination;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.XY] = (source[ThreadIds.XY] + destination[ThreadIds.XY]) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Rgba64_Float4 : IComputeShader
|
||||
{
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
<#
|
||||
var typesMap = new Dictionary<string, string[]>
|
||||
{
|
||||
["Bgra32"] = new[] { "Vector4", "Float4" },
|
||||
["Bgra32"] = new[] { "Float4" },
|
||||
["R16"] = new[] { "float" },
|
||||
["R8"] = new[] { "float" },
|
||||
["Rg16"] = new[] { "Vector2", "Float2" },
|
||||
["Rg32"] = new[] { "Vector2", "Float2" },
|
||||
["Rgba32"] = new[] { "Vector4", "Float4" },
|
||||
["Rgba64"] = new[] { "Vector4", "Float4" }
|
||||
["Rg16"] = new[] { "Float2" },
|
||||
["Rg32"] = new[] { "Float2" },
|
||||
["Rgba32"] = new[] { "Float4" },
|
||||
["Rgba64"] = new[] { "Float4" }
|
||||
};
|
||||
|
||||
IEnumerable<(string T, string TPixel)> EnumerateTypes()
|
||||
@@ -24,7 +24,6 @@ IEnumerable<(string T, string TPixel)> EnumerateTypes()
|
||||
}
|
||||
#>
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using ComputeSharp.Tests.Attributes;
|
||||
using ComputeSharp.Tests.Extensions;
|
||||
|
||||
|
||||
@@ -1,14 +1,10 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
using ComputeSharp.__Internals;
|
||||
using ComputeSharp.Resources;
|
||||
using ComputeSharp.Tests.Attributes;
|
||||
using ComputeSharp.Tests.Extensions;
|
||||
using Microsoft.VisualStudio.TestTools.UnitTesting;
|
||||
|
||||
#pragma warning disable CS0618
|
||||
|
||||
namespace ComputeSharp.Tests;
|
||||
|
||||
public partial class Texture3DTests
|
||||
@@ -17,22 +13,17 @@ public partial class Texture3DTests
|
||||
[AllDevices]
|
||||
[Resource(typeof(ReadOnlyTexture3D<,>))]
|
||||
[Resource(typeof(ReadWriteTexture3D<,>))]
|
||||
[Data(typeof(Bgra32), typeof(Vector4))]
|
||||
[Data(typeof(Bgra32), typeof(float4))]
|
||||
[Data(typeof(R16), typeof(float))]
|
||||
[Data(typeof(R8), typeof(float))]
|
||||
[Data(typeof(Rg16), typeof(Vector2))]
|
||||
[Data(typeof(Rg16), typeof(float2))]
|
||||
[Data(typeof(Rg32), typeof(Vector2))]
|
||||
[Data(typeof(Rg32), typeof(float2))]
|
||||
[Data(typeof(Rgba32), typeof(Vector4))]
|
||||
[Data(typeof(Rgba32), typeof(float4))]
|
||||
[Data(typeof(Rgba64), typeof(Vector4))]
|
||||
[Data(typeof(Rgba64), typeof(float4))]
|
||||
public void Allocate_Uninitialized_Pixel_Ok(Device device, Type textureType, Type t, Type tPixel)
|
||||
{
|
||||
static void Test<T, TPixel>(Device device, Type textureType)
|
||||
where T : unmanaged, IUnorm<TPixel>
|
||||
where T : unmanaged, IPixel<T, TPixel>
|
||||
where TPixel : unmanaged
|
||||
{
|
||||
using Texture3D<T> texture = device.Get().AllocateTexture3D<T, TPixel>(textureType, 128, 128, 2);
|
||||
@@ -55,7 +46,7 @@ public partial class Texture3DTests
|
||||
|
||||
try
|
||||
{
|
||||
new Action<Device, Type>(Test<Rgba32, Vector4>).Method.GetGenericMethodDefinition().MakeGenericMethod(t, tPixel).Invoke(null, new object[] { device, textureType });
|
||||
new Action<Device, Type>(Test<Rgba32, float4>).Method.GetGenericMethodDefinition().MakeGenericMethod(t, tPixel).Invoke(null, new object[] { device, textureType });
|
||||
}
|
||||
catch (TargetInvocationException e) when (e.InnerException is not null)
|
||||
{
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using ComputeSharp.Tests.Attributes;
|
||||
using ComputeSharp.Tests.Extensions;
|
||||
|
||||
@@ -9,27 +8,15 @@ public partial class Texture3DTests
|
||||
{
|
||||
[CombinatorialTestMethod]
|
||||
[AllDevices]
|
||||
[Data(typeof(Bgra32), typeof(Vector4))]
|
||||
[Data(typeof(Bgra32), typeof(Float4))]
|
||||
[Data(typeof(R16), typeof(float))]
|
||||
[Data(typeof(R8), typeof(float))]
|
||||
[Data(typeof(Rg16), typeof(Vector2))]
|
||||
[Data(typeof(Rg16), typeof(Float2))]
|
||||
[Data(typeof(Rg32), typeof(Vector2))]
|
||||
[Data(typeof(Rg32), typeof(Float2))]
|
||||
[Data(typeof(Rgba32), typeof(Vector4))]
|
||||
[Data(typeof(Rgba32), typeof(Float4))]
|
||||
[Data(typeof(Rgba64), typeof(Vector4))]
|
||||
[Data(typeof(Rgba64), typeof(Float4))]
|
||||
public void Dispatch_NormalizedTexture3D(Device device, Type t, Type tPixel)
|
||||
{
|
||||
if (t == typeof(Bgra32) && tPixel == typeof(Vector4))
|
||||
{
|
||||
using ReadOnlyTexture3D<Bgra32, Vector4> source = device.Get().AllocateReadOnlyTexture3D<Bgra32, Vector4>(128, 128, 2);
|
||||
using ReadWriteTexture3D<Bgra32, Vector4> destination = device.Get().AllocateReadWriteTexture3D<Bgra32, Vector4>(128, 128, 2);
|
||||
|
||||
device.Get().For(128, 128, 2, new Shader_Unorm_Bgra32_Vector4(source, destination));
|
||||
}
|
||||
if (t == typeof(Bgra32) && tPixel == typeof(Float4))
|
||||
{
|
||||
using ReadOnlyTexture3D<Bgra32, Float4> source = device.Get().AllocateReadOnlyTexture3D<Bgra32, Float4>(128, 128, 2);
|
||||
@@ -51,13 +38,6 @@ public partial class Texture3DTests
|
||||
|
||||
device.Get().For(128, 128, 2, new Shader_Unorm_R8_float(source, destination));
|
||||
}
|
||||
if (t == typeof(Rg16) && tPixel == typeof(Vector2))
|
||||
{
|
||||
using ReadOnlyTexture3D<Rg16, Vector2> source = device.Get().AllocateReadOnlyTexture3D<Rg16, Vector2>(128, 128, 2);
|
||||
using ReadWriteTexture3D<Rg16, Vector2> destination = device.Get().AllocateReadWriteTexture3D<Rg16, Vector2>(128, 128, 2);
|
||||
|
||||
device.Get().For(128, 128, 2, new Shader_Unorm_Rg16_Vector2(source, destination));
|
||||
}
|
||||
if (t == typeof(Rg16) && tPixel == typeof(Float2))
|
||||
{
|
||||
using ReadOnlyTexture3D<Rg16, Float2> source = device.Get().AllocateReadOnlyTexture3D<Rg16, Float2>(128, 128, 2);
|
||||
@@ -65,13 +45,6 @@ public partial class Texture3DTests
|
||||
|
||||
device.Get().For(128, 128, 2, new Shader_Unorm_Rg16_Float2(source, destination));
|
||||
}
|
||||
if (t == typeof(Rg32) && tPixel == typeof(Vector2))
|
||||
{
|
||||
using ReadOnlyTexture3D<Rg32, Vector2> source = device.Get().AllocateReadOnlyTexture3D<Rg32, Vector2>(128, 128, 2);
|
||||
using ReadWriteTexture3D<Rg32, Vector2> destination = device.Get().AllocateReadWriteTexture3D<Rg32, Vector2>(128, 128, 2);
|
||||
|
||||
device.Get().For(128, 128, 2, new Shader_Unorm_Rg32_Vector2(source, destination));
|
||||
}
|
||||
if (t == typeof(Rg32) && tPixel == typeof(Float2))
|
||||
{
|
||||
using ReadOnlyTexture3D<Rg32, Float2> source = device.Get().AllocateReadOnlyTexture3D<Rg32, Float2>(128, 128, 2);
|
||||
@@ -79,13 +52,6 @@ public partial class Texture3DTests
|
||||
|
||||
device.Get().For(128, 128, 2, new Shader_Unorm_Rg32_Float2(source, destination));
|
||||
}
|
||||
if (t == typeof(Rgba32) && tPixel == typeof(Vector4))
|
||||
{
|
||||
using ReadOnlyTexture3D<Rgba32, Vector4> source = device.Get().AllocateReadOnlyTexture3D<Rgba32, Vector4>(128, 128, 2);
|
||||
using ReadWriteTexture3D<Rgba32, Vector4> destination = device.Get().AllocateReadWriteTexture3D<Rgba32, Vector4>(128, 128, 2);
|
||||
|
||||
device.Get().For(128, 128, 2, new Shader_Unorm_Rgba32_Vector4(source, destination));
|
||||
}
|
||||
if (t == typeof(Rgba32) && tPixel == typeof(Float4))
|
||||
{
|
||||
using ReadOnlyTexture3D<Rgba32, Float4> source = device.Get().AllocateReadOnlyTexture3D<Rgba32, Float4>(128, 128, 2);
|
||||
@@ -93,13 +59,6 @@ public partial class Texture3DTests
|
||||
|
||||
device.Get().For(128, 128, 2, new Shader_Unorm_Rgba32_Float4(source, destination));
|
||||
}
|
||||
if (t == typeof(Rgba64) && tPixel == typeof(Vector4))
|
||||
{
|
||||
using ReadOnlyTexture3D<Rgba64, Vector4> source = device.Get().AllocateReadOnlyTexture3D<Rgba64, Vector4>(128, 128, 2);
|
||||
using ReadWriteTexture3D<Rgba64, Vector4> destination = device.Get().AllocateReadWriteTexture3D<Rgba64, Vector4>(128, 128, 2);
|
||||
|
||||
device.Get().For(128, 128, 2, new Shader_Unorm_Rgba64_Vector4(source, destination));
|
||||
}
|
||||
if (t == typeof(Rgba64) && tPixel == typeof(Float4))
|
||||
{
|
||||
using ReadOnlyTexture3D<Rgba64, Float4> source = device.Get().AllocateReadOnlyTexture3D<Rgba64, Float4>(128, 128, 2);
|
||||
@@ -109,18 +68,6 @@ public partial class Texture3DTests
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Bgra32_Vector4 : IComputeShader
|
||||
{
|
||||
public readonly ReadOnlyTexture3D<Bgra32, Vector4> source;
|
||||
public readonly ReadWriteTexture3D<Bgra32, Vector4> destination;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.XYZ] = (source[ThreadIds.XYZ] + destination[ThreadIds.XYZ]) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Bgra32_Float4 : IComputeShader
|
||||
{
|
||||
@@ -157,18 +104,6 @@ public partial class Texture3DTests
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Rg16_Vector2 : IComputeShader
|
||||
{
|
||||
public readonly ReadOnlyTexture3D<Rg16, Vector2> source;
|
||||
public readonly ReadWriteTexture3D<Rg16, Vector2> destination;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.XYZ] = (source[ThreadIds.XYZ] + destination[ThreadIds.XYZ]) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Rg16_Float2 : IComputeShader
|
||||
{
|
||||
@@ -181,18 +116,6 @@ public partial class Texture3DTests
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Rg32_Vector2 : IComputeShader
|
||||
{
|
||||
public readonly ReadOnlyTexture3D<Rg32, Vector2> source;
|
||||
public readonly ReadWriteTexture3D<Rg32, Vector2> destination;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.XYZ] = (source[ThreadIds.XYZ] + destination[ThreadIds.XYZ]) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Rg32_Float2 : IComputeShader
|
||||
{
|
||||
@@ -205,18 +128,6 @@ public partial class Texture3DTests
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Rgba32_Vector4 : IComputeShader
|
||||
{
|
||||
public readonly ReadOnlyTexture3D<Rgba32, Vector4> source;
|
||||
public readonly ReadWriteTexture3D<Rgba32, Vector4> destination;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.XYZ] = (source[ThreadIds.XYZ] + destination[ThreadIds.XYZ]) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Rgba32_Float4 : IComputeShader
|
||||
{
|
||||
@@ -229,18 +140,6 @@ public partial class Texture3DTests
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Rgba64_Vector4 : IComputeShader
|
||||
{
|
||||
public readonly ReadOnlyTexture3D<Rgba64, Vector4> source;
|
||||
public readonly ReadWriteTexture3D<Rgba64, Vector4> destination;
|
||||
|
||||
public void Execute()
|
||||
{
|
||||
destination[ThreadIds.XYZ] = (source[ThreadIds.XYZ] + destination[ThreadIds.XYZ]) / 2;
|
||||
}
|
||||
}
|
||||
|
||||
[AutoConstructor]
|
||||
internal readonly partial struct Shader_Unorm_Rgba64_Float4 : IComputeShader
|
||||
{
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
<#
|
||||
var typesMap = new Dictionary<string, string[]>
|
||||
{
|
||||
["Bgra32"] = new[] { "Vector4", "Float4" },
|
||||
["Bgra32"] = new[] { "Float4" },
|
||||
["R16"] = new[] { "float" },
|
||||
["R8"] = new[] { "float" },
|
||||
["Rg16"] = new[] { "Vector2", "Float2" },
|
||||
["Rg32"] = new[] { "Vector2", "Float2" },
|
||||
["Rgba32"] = new[] { "Vector4", "Float4" },
|
||||
["Rgba64"] = new[] { "Vector4", "Float4" }
|
||||
["Rg16"] = new[] { "Float2" },
|
||||
["Rg32"] = new[] { "Float2" },
|
||||
["Rgba32"] = new[] { "Float4" },
|
||||
["Rgba64"] = new[] { "Float4" }
|
||||
};
|
||||
|
||||
IEnumerable<(string T, string TPixel)> EnumerateTypes()
|
||||
@@ -24,7 +24,6 @@ IEnumerable<(string T, string TPixel)> EnumerateTypes()
|
||||
}
|
||||
#>
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using ComputeSharp.Tests.Attributes;
|
||||
using ComputeSharp.Tests.Extensions;
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする