Fix unit tests

このコミットが含まれているのは:
Sergio Pedri committed 2022-01-08 19:56:44 +01:00
1 親 67571a7626
コミット a0eb6427eb
4ファイル変更
+11 -23

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

+4 -7
ファイルの表示
@@ -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>())
+5 -8
ファイルの表示
@@ -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 -4
ファイルの表示
@@ -2,7 +2,6 @@
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 +9,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
@@ -35,7 +32,7 @@ public partial class Texture2DTests
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);
+1 -4
ファイルの表示
@@ -1,14 +1,11 @@
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
@@ -32,7 +29,7 @@ public partial class Texture3DTests
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);