Remove System.Numerics types from pixel format conversions

このコミットが含まれているのは:
Sergio Pedri committed 2022-01-08 19:56:44 +01:00
1 親 c5d4822e9f
コミット c72b0c7fd2
13ファイル変更
+47 -268

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

+1 -7
ファイルの表示
@@ -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)
{
-101
ファイルの表示
@@ -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
{
+5 -6
ファイルの表示
@@ -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 -7
ファイルの表示
@@ -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)
{
-101
ファイルの表示
@@ -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
{
+5 -6
ファイルの表示
@@ -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;