From 333b04b9dec49691ff2bb64be5c6286b62f8c809 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 1 Sep 2019 02:46:08 +0200 Subject: [PATCH] Added asdouble and asfloat intrinsics --- src/ComputeSharp.Core/Intrinsics/Hlsl.cs | 82 ++++++++++++++++++++++++ 1 file changed, 82 insertions(+) diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.cs b/src/ComputeSharp.Core/Intrinsics/Hlsl.cs index f8a4f86f..892a0b9c 100644 --- a/src/ComputeSharp.Core/Intrinsics/Hlsl.cs +++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.cs @@ -297,6 +297,88 @@ namespace ComputeSharp [Pure] public static bool Any(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Any)}({nameof(Vector4)})"); + /// + /// Reinterprets a cast value (two 32-bit values) into a + /// + /// The low 32-bit pattern of the input value + /// The high 32-bit pattern of the input value + /// The input (two 32-bit values) recast as a + [Pure] + public static double AsDouble(uint lowBits, uint highBits) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(AsDouble)}(uint,uint)"); + + /// + /// Reinterprets a cast value (two 32-bit values) into a + /// + /// The low 32-bit pattern of the input value + /// The high 32-bit pattern of the input value + /// The input (two 32-bit values) recast as a + [Pure] + public static Double2 AsDouble(UInt2 lowBits, UInt2 highBits) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(AsDouble)}({nameof(UInt2)},{nameof(UInt2)})"); + + /// + /// Interprets the bit pattern of as a floating-point number + /// + /// The input value + /// The input interpreted as a floating-point number + [Pure] + public static float AsFloat(int x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(AsFloat)}(int)"); + + /// + /// Interprets the bit pattern of as a floating-point number + /// + /// The input value + /// The input interpreted as a floating-point number + [Pure] + public static Float2 AsFloat(Int2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(AsFloat)}({nameof(Int2)})"); + + /// + /// Interprets the bit pattern of as a floating-point number + /// + /// The input value + /// The input interpreted as a floating-point number + [Pure] + public static Float3 AsFloat(Int3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(AsFloat)}({nameof(Int3)})"); + + /// + /// Interprets the bit pattern of as a floating-point number + /// + /// The input value + /// The input interpreted as a floating-point number + [Pure] + public static Float4 AsFloat(Int4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(AsFloat)}({nameof(Int4)})"); + + /// + /// Interprets the bit pattern of as a floating-point number + /// + /// The input value + /// The input interpreted as a floating-point number + [Pure] + public static float AsFloat(uint x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(AsFloat)}(uint)"); + + /// + /// Interprets the bit pattern of as a floating-point number + /// + /// The input value + /// The input interpreted as a floating-point number + [Pure] + public static Float2 AsFloat(UInt2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(AsFloat)}({nameof(UInt2)})"); + + /// + /// Interprets the bit pattern of as a floating-point number + /// + /// The input value + /// The input interpreted as a floating-point number + [Pure] + public static Float3 AsFloat(UInt3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(AsFloat)}({nameof(UInt3)})"); + + /// + /// Interprets the bit pattern of as a floating-point number + /// + /// The input value + /// The input interpreted as a floating-point number + [Pure] + public static Float4 AsFloat(UInt4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(AsFloat)}({nameof(UInt4)})"); + /// /// Returns the arcsine of the specified value ///