Remove System.Numerics types from pixel format conversions
このコミットが含まれているのは:
1 親
c5d4822e9f
コミット
c72b0c7fd2
13ファイル変更
+47
-268
検索条件に一致するファイルはありません
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@@ -15,7 +14,7 @@ namespace ComputeSharp;
|
||||
/// </summary>
|
||||
/// <remarks>This struct is fully mutable.</remarks>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Bgra32 : IEquatable<Bgra32>, IPixel<Bgra32, Vector4>, IPixel<Bgra32, Float4>
|
||||
public struct Bgra32 : IEquatable<Bgra32>, IPixel<Bgra32, Float4>
|
||||
#if NET6_0_OR_GREATER
|
||||
, ISpanFormattable
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@@ -12,7 +11,7 @@ namespace ComputeSharp;
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Rg16 : IEquatable<Rg16>, IPixel<Rg16, Vector2>, IPixel<Rg16, Float2>
|
||||
public struct Rg16 : IEquatable<Rg16>, IPixel<Rg16, Float2>
|
||||
#if NET6_0_OR_GREATER
|
||||
, ISpanFormattable
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@@ -12,7 +11,7 @@ namespace ComputeSharp;
|
||||
/// </para>
|
||||
/// </summary>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Rg32 : IEquatable<Rg32>, IPixel<Rg32, Vector2>, IPixel<Rg32, Float2>
|
||||
public struct Rg32 : IEquatable<Rg32>, IPixel<Rg32, Float2>
|
||||
#if NET6_0_OR_GREATER
|
||||
, ISpanFormattable
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@@ -14,7 +13,7 @@ namespace ComputeSharp;
|
||||
/// </summary>
|
||||
/// <remarks>This struct is fully mutable.</remarks>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Rgba32 : IEquatable<Rgba32>, IPixel<Rgba32, Vector4>, IPixel<Rgba32, Float4>
|
||||
public struct Rgba32 : IEquatable<Rgba32>, IPixel<Rgba32, Float4>
|
||||
#if NET6_0_OR_GREATER
|
||||
, ISpanFormattable
|
||||
#endif
|
||||
|
||||
@@ -1,5 +1,4 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Runtime.CompilerServices;
|
||||
using System.Runtime.InteropServices;
|
||||
|
||||
@@ -14,7 +13,7 @@ namespace ComputeSharp;
|
||||
/// </summary>
|
||||
/// <remarks>This struct is fully mutable.</remarks>
|
||||
[StructLayout(LayoutKind.Sequential)]
|
||||
public struct Rgba64 : IEquatable<Rgba64>, IPixel<Rgba64, Vector4>, IPixel<Rgba64, Float4>
|
||||
public struct Rgba64 : IEquatable<Rgba64>, IPixel<Rgba64, Float4>
|
||||
#if NET6_0_OR_GREATER
|
||||
, ISpanFormattable
|
||||
#endif
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
using System;
|
||||
using System.IO;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
using ComputeSharp.Resources;
|
||||
using ComputeSharp.Tests.Attributes;
|
||||
@@ -17,17 +16,12 @@ 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)
|
||||
{
|
||||
@@ -54,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,5 +1,4 @@
|
||||
using System;
|
||||
using System.Numerics;
|
||||
using System.Reflection;
|
||||
using ComputeSharp.Resources;
|
||||
using ComputeSharp.Tests.Attributes;
|
||||
@@ -14,17 +13,12 @@ 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)
|
||||
{
|
||||
@@ -52,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;
|
||||
|
||||
|
||||
新しいイシューから参照
ユーザーをブロックする