Fix missing double support check in Buffer<T> resources

このコミットが含まれているのは:
Sergio Pedri committed 2022-01-18 11:36:03 +01:00
1 親 e45aab0eed
コミット 89da6ebe30
2ファイル変更
+20 -1

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

+1 -1
ファイルの表示
@@ -13,7 +13,7 @@ internal static class TypeInfo<T>
/// <summary>
/// Whether or not type <typeparamref name="T"/> is <see cref="double"/> or contains a <see cref="double"/> field.
/// </summary>
public static readonly bool IsDoubleOrContainsDoubles;
public static readonly bool IsDoubleOrContainsDoubles = ChecksIsDoubleOrContainsDoubles(typeof(T));
/// <summary>
/// Checks the value for <see cref="IsDoubleOrContainsDoubles"/> for type <typeparamref name="T"/>.
+19
ファイルの表示
@@ -1,5 +1,6 @@
using System;
using System.Linq;
using ComputeSharp.Exceptions;
using ComputeSharp.Resources;
using ComputeSharp.Tests.Attributes;
using ComputeSharp.Tests.Extensions;
@@ -407,4 +408,22 @@ public partial class BufferTests
buffer[ThreadIds.X] = buffer[ThreadIds.X] * factor + 3.14;
}
}
[CombinatorialTestMethod]
[AllDevices]
[Resource(typeof(ConstantBuffer<>))]
[Resource(typeof(ReadOnlyBuffer<>))]
[Resource(typeof(ReadWriteBuffer<>))]
[ExpectedException(typeof(UnsupportedDoubleOperationsException))]
public void Dispatch_ReadWriteBuffer_DoublePrecision_ThrowsExceptionIfUnsupported(Device device, Type resourceType)
{
if (device.Get().IsDoublePrecisionSupportAvailable())
{
Assert.Inconclusive();
}
using Buffer<double> buffer = device.Get().AllocateBuffer<double>(resourceType, 32);
Assert.Fail();
}
}