From 7fa194bf72d5eb9cb0bd1c046c9e27ef0df5b6ad Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 24 Aug 2019 23:38:21 +0200 Subject: [PATCH] Added HLSL intrinsics with out parameters --- src/ComputeSharp.Shaders/Intrinsics/Hlsl.cs | 113 ++++++++++++++++++++ 1 file changed, 113 insertions(+) diff --git a/src/ComputeSharp.Shaders/Intrinsics/Hlsl.cs b/src/ComputeSharp.Shaders/Intrinsics/Hlsl.cs index 6d4fa9a9..1479ac71 100644 --- a/src/ComputeSharp.Shaders/Intrinsics/Hlsl.cs +++ b/src/ComputeSharp.Shaders/Intrinsics/Hlsl.cs @@ -647,6 +647,42 @@ namespace ComputeSharp [Pure] public static Vector4 Frac(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Frac)}({nameof(Vector4)})"); + /// + /// Returns the mantissa and exponent of the specified floating-point value + /// + /// The specified floating-point value (if the x parameter is 0, this function returns 0 for both the mantissa and the exponent) + /// The returned exponent of the parameter + /// The fractional part of the parameter + [Pure] + public static float Frexp(float x, out float exp) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Frexp)}(float,float)"); + + /// + /// Returns the mantissa and exponent of the specified floating-point value + /// + /// The specified floating-point value (if the x parameter is 0, this function returns 0 for both the mantissa and the exponent) + /// The returned exponent of the parameter + /// The fractional part of the parameter + [Pure] + public static Vector2 Frexp(Vector2 x, out Vector2 exp) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Frexp)}({nameof(Vector2)},{nameof(Vector2)})"); + + /// + /// Returns the mantissa and exponent of the specified floating-point value + /// + /// The specified floating-point value (if the x parameter is 0, this function returns 0 for both the mantissa and the exponent) + /// The returned exponent of the parameter + /// The fractional part of the parameter + [Pure] + public static Vector3 Frexp(Vector3 x, out Vector3 exp) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Frac)}({nameof(Vector3)},{nameof(Vector3)})"); + + /// + /// Returns the mantissa and exponent of the specified floating-point value + /// + /// The specified floating-point value (if the x parameter is 0, this function returns 0 for both the mantissa and the exponent) + /// The returned exponent of the parameter + /// The fractional part of the parameter + [Pure] + public static Vector4 Frexp(Vector4 x, out Vector4 exp) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Frexp)}({nameof(Vector4)},{nameof(Vector4)})"); + /// /// Determines if the specified floating-point value is finite /// @@ -943,6 +979,51 @@ namespace ComputeSharp [Pure] public static Vector4 Min(Vector4 x, Vector4 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Min)}({nameof(Vector4)},{nameof(Vector4)})"); + /// + /// Splits the value into fractional and integer parts, each of which has the same sign as + /// + /// The input value + /// The integer portion of + /// The signed-fractional portion of + [Pure] + public static int Modf(int x, int ip) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Modf)}(int,int)"); + + /// + /// Splits the value into fractional and integer parts, each of which has the same sign as + /// + /// The input value + /// The integer portion of + /// The signed-fractional portion of + [Pure] + public static float Modf(float x, float ip) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Modf)}(float,float)"); + + /// + /// Splits the value into fractional and integer parts, each of which has the same sign as + /// + /// The input value + /// The integer portion of + /// The signed-fractional portion of + [Pure] + public static Vector2 Modf(Vector2 x, Vector2 ip) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Modf)}({nameof(Vector2)},{nameof(Vector2)})"); + + /// + /// Splits the value into fractional and integer parts, each of which has the same sign as + /// + /// The input value + /// The integer portion of + /// The signed-fractional portion of + [Pure] + public static Vector3 Modf(Vector3 x, Vector3 ip) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Modf)}({nameof(Vector3)},{nameof(Vector3)})"); + + /// + /// Splits the value into fractional and integer parts, each of which has the same sign as + /// + /// The input value + /// The integer portion of + /// The signed-fractional portion of + [Pure] + public static Vector4 Modf(Vector4 x, Vector4 ip) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Modf)}({nameof(Vector4)},{nameof(Vector4)})"); + /// /// Multiplies and using matrix math /// @@ -1316,6 +1397,38 @@ namespace ComputeSharp [Pure] public static Vector4 Sin(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Sin)}({nameof(Vector4)})"); + /// + /// Returns the sine and cosine of + /// + /// The specified value, in radians + /// Returns the sine of + /// Returns the cosine of + public static void SinCos(float x, out float s, out float c) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(SinCos)}(float,float,float)"); + + /// + /// Returns the sine and cosine of + /// + /// The specified value, in radians + /// Returns the sine of + /// Returns the cosine of + public static void SinCos(Vector2 x, out Vector2 s, out Vector2 c) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(SinCos)}({nameof(Vector2)},{nameof(Vector2)},{nameof(Vector2)})"); + + /// + /// Returns the sine and cosine of + /// + /// The specified value, in radians + /// Returns the sine of + /// Returns the cosine of + public static void SinCos(Vector3 x, out Vector3 s, out Vector3 c) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(SinCos)}({nameof(Vector3)},{nameof(Vector3)},{nameof(Vector3)})"); + + /// + /// Returns the sine and cosine of + /// + /// The specified value, in radians + /// Returns the sine of + /// Returns the cosine of + public static void SinCos(Vector4 x, out Vector4 s, out Vector4 c) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(SinCos)}({nameof(Vector4)},{nameof(Vector4)},{nameof(Vector4)})"); + /// /// Returns the hyperbolic sine of the specified value ///