diff --git a/src/ComputeSharp/Graphics/Helpers/TypeInfo{T}.cs b/src/ComputeSharp/Graphics/Helpers/TypeInfo{T}.cs index f13f3e86..1b0896c6 100644 --- a/src/ComputeSharp/Graphics/Helpers/TypeInfo{T}.cs +++ b/src/ComputeSharp/Graphics/Helpers/TypeInfo{T}.cs @@ -13,7 +13,7 @@ internal static class TypeInfo /// /// Whether or not type is or contains a field. /// - public static readonly bool IsDoubleOrContainsDoubles; + public static readonly bool IsDoubleOrContainsDoubles = ChecksIsDoubleOrContainsDoubles(typeof(T)); /// /// Checks the value for for type . diff --git a/tests/ComputeSharp.Tests/BufferTests.cs b/tests/ComputeSharp.Tests/BufferTests.cs index d857dcdf..ad49d19e 100644 --- a/tests/ComputeSharp.Tests/BufferTests.cs +++ b/tests/ComputeSharp.Tests/BufferTests.cs @@ -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 buffer = device.Get().AllocateBuffer(resourceType, 32); + + Assert.Fail(); + } }