Add .NET Framework 4.7.2 target to test projects
このコミットが含まれているのは:
1 親
d7a94fdf37
コミット
f13253dfdb
9ファイル変更
+123
-71
検索条件に一致するファイルはありません
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Linq;
|
||||
using System.Runtime.CompilerServices;
|
||||
using ComputeSharp.Resources;
|
||||
using ComputeSharp.Tests.Attributes;
|
||||
using ComputeSharp.Tests.Extensions;
|
||||
@@ -97,7 +98,7 @@ public partial class TransferTexture2DTests
|
||||
|
||||
[CombinatorialTestMethod]
|
||||
[AllDevices]
|
||||
public void Allocate_UploadTexture2D_Copy_Full(Device device)
|
||||
public unsafe void Allocate_UploadTexture2D_Copy_Full(Device device)
|
||||
{
|
||||
using UploadTexture2D<int> uploadTexture2D = device.Get().AllocateUploadTexture2D<int>(256, 256);
|
||||
|
||||
@@ -115,9 +116,12 @@ public partial class TransferTexture2DTests
|
||||
Assert.AreEqual(uploadTexture2D.Width, result.GetLength(1));
|
||||
Assert.AreEqual(uploadTexture2D.Height, result.GetLength(0));
|
||||
|
||||
for (int i = 0; i < uploadTexture2D.Height; i++)
|
||||
fixed (int* _ = result)
|
||||
{
|
||||
Assert.IsTrue(uploadTexture2D.View.GetRowSpan(i).SequenceEqual(result.GetRowSpan(i)));
|
||||
for (int i = 0; i < uploadTexture2D.Height; i++)
|
||||
{
|
||||
Assert.IsTrue(uploadTexture2D.View.GetRowSpan(i).SequenceEqual(new Span<int>(Unsafe.AsPointer(ref result[i, 0]), result.GetLength(1))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,7 +131,7 @@ public partial class TransferTexture2DTests
|
||||
[Data(128, 0, 1813, 2048)]
|
||||
[Data(0, 128, 2000, 944)]
|
||||
[Data(97, 33, 512, 794)]
|
||||
public void Allocate_UploadTexture2D_Copy_Range(Device device, int x, int y, int width, int height)
|
||||
public unsafe void Allocate_UploadTexture2D_Copy_Range(Device device, int x, int y, int width, int height)
|
||||
{
|
||||
using UploadTexture2D<int> uploadTexture2D = device.Get().AllocateUploadTexture2D<int>(2048, 2048);
|
||||
|
||||
@@ -142,24 +146,27 @@ public partial class TransferTexture2DTests
|
||||
|
||||
int[,] result = readOnlyTexture2D.ToArray();
|
||||
|
||||
for (int i = 0; i < height; i++)
|
||||
fixed (void* _ = result)
|
||||
{
|
||||
Span<int> sourceRow = uploadTexture2D.View.GetRowSpan(i + y).Slice(x, width);
|
||||
Span<int> destinationRow = result.GetRowSpan(i).Slice(0, width);
|
||||
for (int i = 0; i < height; i++)
|
||||
{
|
||||
Span<int> sourceRow = uploadTexture2D.View.GetRowSpan(i + y).Slice(x, width);
|
||||
Span<int> destinationRow = new Span<int>(Unsafe.AsPointer(ref result[i, 0]), result.GetLength(1)).Slice(0, width);
|
||||
|
||||
Assert.IsTrue(sourceRow.SequenceEqual(destinationRow));
|
||||
Assert.IsTrue(sourceRow.SequenceEqual(destinationRow));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
[CombinatorialTestMethod]
|
||||
[AllDevices]
|
||||
public void Allocate_ReadBackTexture2D_Copy_Full(Device device)
|
||||
public unsafe void Allocate_ReadBackTexture2D_Copy_Full(Device device)
|
||||
{
|
||||
int[,] source = new int[256, 256];
|
||||
|
||||
for (int i = 0; i < 256; i++)
|
||||
fixed (int* p = source)
|
||||
{
|
||||
new Random(42).NextBytes(source.GetRowSpan(i).AsBytes());
|
||||
new Random(42).NextBytes(new Span<int>(p, source.Length).AsBytes());
|
||||
}
|
||||
|
||||
using ReadOnlyTexture2D<int> readOnlyTexture2D = device.Get().AllocateReadOnlyTexture2D(source);
|
||||
@@ -170,9 +177,12 @@ public partial class TransferTexture2DTests
|
||||
Assert.AreEqual(readBackTexture2D.Width, 256);
|
||||
Assert.AreEqual(readBackTexture2D.Height, 256);
|
||||
|
||||
for (int i = 0; i < readBackTexture2D.Height; i++)
|
||||
fixed (int* p = source)
|
||||
{
|
||||
Assert.IsTrue(readBackTexture2D.View.GetRowSpan(i).SequenceEqual(source.GetRowSpan(i)));
|
||||
for (int i = 0; i < readBackTexture2D.Height; i++)
|
||||
{
|
||||
Assert.IsTrue(readBackTexture2D.View.GetRowSpan(i).SequenceEqual(new Span<int>(Unsafe.AsPointer(ref source[i, 0]), source.GetLength(1))));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -182,13 +192,13 @@ public partial class TransferTexture2DTests
|
||||
[Data(128, 0, 1813, 2048)]
|
||||
[Data(0, 128, 2000, 944)]
|
||||
[Data(97, 33, 512, 794)]
|
||||
public void Allocate_ReadBackTexture2D_Copy_Range(Device device, int x, int y, int width, int height)
|
||||
public unsafe void Allocate_ReadBackTexture2D_Copy_Range(Device device, int x, int y, int width, int height)
|
||||
{
|
||||
int[,] source = new int[2048, 2048];
|
||||
|
||||
for (int i = 0; i < 2048; i++)
|
||||
fixed (int* p = source)
|
||||
{
|
||||
new Random(42).NextBytes(source.GetRowSpan(i).AsBytes());
|
||||
new Random(42).NextBytes(new Span<int>(p, source.Length).AsBytes());
|
||||
}
|
||||
|
||||
using ReadOnlyTexture2D<int> readOnlyTexture2D = device.Get().AllocateReadOnlyTexture2D(source);
|
||||
@@ -196,12 +206,15 @@ public partial class TransferTexture2DTests
|
||||
|
||||
readOnlyTexture2D.CopyTo(readBackTexture2D, x, y, width, height);
|
||||
|
||||
for (int i = 0; i < height; i++)
|
||||
fixed (int* p = source)
|
||||
{
|
||||
Span<int> sourceRow = source.GetRowSpan(i + y).Slice(x, width);
|
||||
Span<int> destinationRow = readBackTexture2D.View.GetRowSpan(i).Slice(0, width);
|
||||
for (int i = 0; i < height; i++)
|
||||
{
|
||||
Span<int> sourceRow = new Span<int>(Unsafe.AsPointer(ref source[i + y, 0]), source.GetLength(1)).Slice(x, width);
|
||||
Span<int> destinationRow = readBackTexture2D.View.GetRowSpan(i).Slice(0, width);
|
||||
|
||||
Assert.IsTrue(sourceRow.SequenceEqual(destinationRow));
|
||||
Assert.IsTrue(sourceRow.SequenceEqual(destinationRow));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
新しいイシューから参照
ユーザーをブロックする