From 7a87cf1841d780e2bc06b02a6c83bdfc85264a2d Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Tue, 5 Jan 2021 18:38:02 +0100 Subject: [PATCH] Added implicit FloatN <-> VectorN conversions --- src/ComputeSharp.Core/Intrinsics/Hlsl.cs | 1240 ----------------- .../Primitives/Float/Float2.cs | 13 + .../Primitives/Float/Float3.cs | 13 + .../Primitives/Float/Float4.cs | 13 + .../ComputeSharp.SourceGenerators.csproj | 3 +- 5 files changed, 41 insertions(+), 1241 deletions(-) diff --git a/src/ComputeSharp.Core/Intrinsics/Hlsl.cs b/src/ComputeSharp.Core/Intrinsics/Hlsl.cs index 7e5e0fcb..c58a3301 100644 --- a/src/ComputeSharp.Core/Intrinsics/Hlsl.cs +++ b/src/ComputeSharp.Core/Intrinsics/Hlsl.cs @@ -1,5 +1,4 @@ using System.Diagnostics.Contracts; -using System.Numerics; using ComputeSharp.Core.Intrinsics.Attributes; using ComputeSharp.Exceptions; @@ -74,30 +73,6 @@ namespace ComputeSharp [Pure] public static Float4 Abs(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Abs)}({nameof(Float4)})"); - /// - /// Returns the absolute value of the specified value. - /// - /// The specified value. - /// The absolute value of the parameter. - [Pure] - public static Vector2 Abs(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Abs)}({nameof(Vector2)})"); - - /// - /// Returns the absolute value of the specified value. - /// - /// The specified value. - /// The absolute value of the parameter. - [Pure] - public static Vector3 Abs(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Abs)}({nameof(Vector3)})"); - - /// - /// Returns the absolute value of the specified value. - /// - /// The specified value. - /// The absolute value of the parameter. - [Pure] - public static Vector4 Abs(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Abs)}({nameof(Vector4)})"); - /// /// Returns the arccosine of the specified value. /// @@ -130,30 +105,6 @@ namespace ComputeSharp [Pure] public static Float3 Acos(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Acos)}({nameof(Float4)})"); - /// - /// Returns the arccosine of the specified value. - /// - /// The specified value, where each component should be within the range [-1 to 1] - /// The arccosine of the parameter. - [Pure] - public static Vector2 Acos(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Acos)}({nameof(Vector2)})"); - - /// - /// Returns the arccosine of the specified value. - /// - /// The specified value, where each component should be within the range [-1 to 1] - /// The arccosine of the parameter. - [Pure] - public static Vector3 Acos(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Acos)}({nameof(Vector3)})"); - - /// - /// Returns the arccosine of the specified value. - /// - /// The specified value, where each component should be within the range [-1 to 1] - /// The arccosine of the parameter. - [Pure] - public static Vector3 Acos(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Acos)}({nameof(Vector4)})"); - /// /// Determines if all components of the specified value are non-zero. /// @@ -202,30 +153,6 @@ namespace ComputeSharp [Pure] public static bool All(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(All)}({nameof(Float4)})"); - /// - /// Determines if all components of the specified value are non-zero. - /// - /// The specified value. - /// if all components of the parameter are non-zero; otherwise, . - [Pure] - public static bool All(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(All)}({nameof(Vector2)})"); - - /// - /// Determines if all components of the specified value are non-zero. - /// - /// The specified value. - /// if all components of the parameter are non-zero; otherwise, . - [Pure] - public static bool All(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(All)}({nameof(Vector3)})"); - - /// - /// Determines if all components of the specified value are non-zero. - /// - /// The specified value. - /// if all components of the parameter are non-zero; otherwise, . - [Pure] - public static bool All(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(All)}({nameof(Vector4)})"); - /// /// Determines if any components of the specified value are non-zero. /// @@ -274,30 +201,6 @@ namespace ComputeSharp [Pure] public static bool Any(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Any)}({nameof(Float4)})"); - /// - /// Determines if any components of the specified value are non-zero. - /// - /// The specified value. - /// if any components of the parameter are non-zero; otherwise, . - [Pure] - public static bool Any(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Any)}({nameof(Vector2)})"); - - /// - /// Determines if any components of the specified value are non-zero. - /// - /// The specified value. - /// if any components of the parameter are non-zero; otherwise, . - [Pure] - public static bool Any(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Any)}({nameof(Vector3)})"); - - /// - /// Determines if any components of the specified value are non-zero. - /// - /// The specified value. - /// if any components of the parameter are non-zero; otherwise, . - [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 . /// @@ -412,30 +315,6 @@ namespace ComputeSharp [Pure] public static Float3 Asin(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Asin)}({nameof(Float4)})"); - /// - /// Returns the arcsine of the specified value. - /// - /// The specified value, where each component should be within the range [-1 to 1] - /// The arcsine of the parameter. - [Pure] - public static Vector2 Asin(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Asin)}({nameof(Vector2)})"); - - /// - /// Returns the arcsine of the specified value. - /// - /// The specified value, where each component should be within the range [-1 to 1] - /// The arcsine of the parameter. - [Pure] - public static Vector3 Asin(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Asin)}({nameof(Vector3)})"); - - /// - /// Returns the arcsine of the specified value. - /// - /// The specified value, where each component should be within the range [-1 to 1] - /// The arcsine of the parameter. - [Pure] - public static Vector3 Asin(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Asin)}({nameof(Vector4)})"); - /// /// Returns the arctangent of the specified value. /// @@ -468,30 +347,6 @@ namespace ComputeSharp [Pure] public static Float3 Atan(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Atan)}({nameof(Float4)})"); - /// - /// Returns the arctangent of the specified value. - /// - /// The specified value. - /// The arctangent of the parameter. - [Pure] - public static Vector2 Atan(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Atan)}({nameof(Vector2)})"); - - /// - /// Returns the arctangent of the specified value. - /// - /// The specified value. - /// The arctangent of the parameter. - [Pure] - public static Vector3 Atan(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Atan)}({nameof(Vector3)})"); - - /// - /// Returns the arctangent of the specified value. - /// - /// The specified value. - /// The arctangent of the parameter. - [Pure] - public static Vector3 Atan(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Atan)}({nameof(Vector4)})"); - /// /// Returns the arctangent of two values (,) /// @@ -528,33 +383,6 @@ namespace ComputeSharp [Pure] public static Float3 Atan2(Float4 y, Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Atan2)}({nameof(Float4)},{nameof(Float4)})"); - /// - /// Returns the arctangent of two values (,) - /// - /// The value. - /// The value. - /// The arctangent of (,) - [Pure] - public static Vector2 Atan2(Vector2 y, Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Atan2)}({nameof(Vector2)},{nameof(Vector2)})"); - - /// - /// Returns the arctangent of two values (,) - /// - /// The value. - /// The value. - /// The arctangent of (,) - [Pure] - public static Vector3 Atan2(Vector3 y, Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Atan2)}({nameof(Vector3)},{nameof(Vector3)})"); - - /// - /// Returns the arctangent of two values (,) - /// - /// The value. - /// The value. - /// The arctangent of (,) - [Pure] - public static Vector3 Atan2(Vector4 y, Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Atan2)}({nameof(Vector4)},{nameof(Vector4)})"); - /// /// Returns the smallest integer value that is greater than or equal to the specified value. /// @@ -587,30 +415,6 @@ namespace ComputeSharp [Pure] public static Float3 Ceil(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Ceil)}({nameof(Float4)})"); - /// - /// Returns the smallest integer value that is greater than or equal to the specified value. - /// - /// The specified value. - /// The smallest integer value (returned as a floating-point type) that is greater than or equal to the parameter. - [Pure] - public static Vector2 Ceil(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Ceil)}({nameof(Vector2)})"); - - /// - /// Returns the smallest integer value that is greater than or equal to the specified value. - /// - /// The specified value. - /// The smallest integer value (returned as a floating-point type) that is greater than or equal to the parameter. - [Pure] - public static Vector3 Ceil(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Ceil)}({nameof(Vector3)})"); - - /// - /// Returns the smallest integer value that is greater than or equal to the specified value. - /// - /// The specified value. - /// The smallest integer value (returned as a floating-point type) that is greater than or equal to the parameter. - [Pure] - public static Vector3 Ceil(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Ceil)}({nameof(Vector4)})"); - /// /// Clamps the specified value to the specified minimum and maximum range. /// @@ -699,39 +503,6 @@ namespace ComputeSharp [Pure] public static Float4 Clamp(Float4 x, Float4 min, Float4 max) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Clamp)}({nameof(Float4)},{nameof(Float4)},{nameof(Float4)})"); - /// - /// Clamps the specified value to the specified minimum and maximum range. - /// - /// A value to clamp. - /// The specified minimum range. - /// The specified maximum range. - /// The clamped value for the x parameter. - /// For values of -INF or INF, clamp will behave as expected. However for values of NaN, the results are undefined. - [Pure] - public static Vector2 Clamp(Vector2 x, Vector2 min, Vector2 max) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Clamp)}({nameof(Vector2)},{nameof(Vector2)},{nameof(Vector2)})"); - - /// - /// Clamps the specified value to the specified minimum and maximum range. - /// - /// A value to clamp. - /// The specified minimum range. - /// The specified maximum range. - /// The clamped value for the x parameter. - /// For values of -INF or INF, clamp will behave as expected. However for values of NaN, the results are undefined. - [Pure] - public static Vector3 Clamp(Vector3 x, Vector3 min, Vector3 max) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Clamp)}({nameof(Vector3)},{nameof(Vector3)},{nameof(Vector3)})"); - - /// - /// Clamps the specified value to the specified minimum and maximum range. - /// - /// A value to clamp. - /// The specified minimum range. - /// The specified maximum range. - /// The clamped value for the x parameter. - /// For values of -INF or INF, clamp will behave as expected. However for values of NaN, the results are undefined. - [Pure] - public static Vector4 Clamp(Vector4 x, Vector4 min, Vector4 max) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Clamp)}({nameof(Vector4)},{nameof(Vector4)},{nameof(Vector4)})"); - /// /// Returns the cosine of the specified value. /// @@ -764,30 +535,6 @@ namespace ComputeSharp [Pure] public static Float3 Cos(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Cos)}({nameof(Float4)})"); - /// - /// Returns the cosine of the specified value. - /// - /// The specified value, radians. - /// The cosine of the parameter. - [Pure] - public static Vector2 Cos(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Cos)}({nameof(Vector2)})"); - - /// - /// Returns the cosine of the specified value. - /// - /// The specified value, radians. - /// The cosine of the parameter. - [Pure] - public static Vector3 Cos(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Cos)}({nameof(Vector3)})"); - - /// - /// Returns the cosine of the specified value. - /// - /// The specified value, radians. - /// The cosine of the parameter. - [Pure] - public static Vector3 Cos(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Cos)}({nameof(Vector4)})"); - /// /// Returns the hyperbolic cosine of the specified value. /// @@ -820,30 +567,6 @@ namespace ComputeSharp [Pure] public static Float3 Cosh(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Cosh)}({nameof(Float4)})"); - /// - /// Returns the hyperbolic cosine of the specified value. - /// - /// The specified value, radians. - /// The hyperbolic cosine of the parameter. - [Pure] - public static Vector2 Cosh(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Cosh)}({nameof(Vector2)})"); - - /// - /// Returns the hyperbolic cosine of the specified value. - /// - /// The specified value, radians. - /// The hyperbolic cosine of the parameter. - [Pure] - public static Vector3 Cosh(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Cosh)}({nameof(Vector3)})"); - - /// - /// Returns the hyperbolic cosine of the specified value. - /// - /// The specified value, radians. - /// The hyperbolic cosine of the parameter. - [Pure] - public static Vector3 Cosh(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Cosh)}({nameof(Vector4)})"); - /// /// Counts the number of bits in the input value. /// @@ -861,15 +584,6 @@ namespace ComputeSharp [Pure] public static Float3 Cross(Float3 x, Float3 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Cross)}({nameof(Float3)})"); - /// - /// Returns the cross product of two values. - /// - /// The first vector. - /// The second vector. - /// The cross product of the parameter and the parameter. - [Pure] - public static Vector3 Cross(Vector3 x, Vector3 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Cross)}({nameof(Vector3)})"); - /// /// Converts the specified value from radians to degrees. /// @@ -902,30 +616,6 @@ namespace ComputeSharp [Pure] public static Float3 Degrees(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Degrees)}({nameof(Float4)})"); - /// - /// Converts the specified value from radians to degrees. - /// - /// The specified value. - /// The result of converting the parameter from radians to degrees. - [Pure] - public static Vector2 Degrees(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Degrees)}({nameof(Vector2)})"); - - /// - /// Converts the specified value from radians to degrees. - /// - /// The specified value. - /// The result of converting the parameter from radians to degrees. - [Pure] - public static Vector3 Degrees(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Degrees)}({nameof(Vector3)})"); - - /// - /// Converts the specified value from radians to degrees. - /// - /// The specified value. - /// The result of converting the parameter from radians to degrees. - [Pure] - public static Vector3 Degrees(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Degrees)}({nameof(Vector4)})"); - /// /// Returns a distance scalar between two values. /// @@ -953,33 +643,6 @@ namespace ComputeSharp [Pure] public static float Distance(Float4 x, Float4 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Distance)}({nameof(Float4)},{nameof(Float4)})"); - /// - /// Returns a distance scalar between two values. - /// - /// The first value to compare. - /// The second value to compare. - /// A scalar value that represents the distance between the parameter and the parameter. - [Pure] - public static float Distance(Vector2 x, Vector2 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Distance)}({nameof(Vector2)},{nameof(Vector2)})"); - - /// - /// Returns a distance scalar between two values. - /// - /// The first value to compare. - /// The second value to compare. - /// A scalar value that represents the distance between the parameter and the parameter. - [Pure] - public static float Distance(Vector3 x, Vector3 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Distance)}({nameof(Vector3)},{nameof(Vector3)})"); - - /// - /// Returns a distance scalar between two values. - /// - /// The first value to compare. - /// The second value to compare. - /// A scalar value that represents the distance between the parameter and the parameter. - [Pure] - public static float Distance(Vector4 x, Vector4 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Distance)}({nameof(Vector4)},{nameof(Vector4)})"); - /// /// Returns the dot product of two values. /// @@ -1007,33 +670,6 @@ namespace ComputeSharp [Pure] public static float Dot(Float4 x, Float4 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Dot)}({nameof(Float4)},{nameof(Float4)})"); - /// - /// Returns the dot product of two values. - /// - /// The first vector. - /// The second vector. - /// The dot product of the parameter and the parameter. - [Pure] - public static float Dot(Vector2 x, Vector2 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Dot)}({nameof(Vector2)},{nameof(Vector2)})"); - - /// - /// Returns the dot product of two values. - /// - /// The first vector. - /// The second vector. - /// The dot product of the parameter and the parameter. - [Pure] - public static float Dot(Vector3 x, Vector3 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Dot)}({nameof(Vector3)},{nameof(Vector3)})"); - - /// - /// Returns the dot product of two values. - /// - /// The first vector. - /// The second vector. - /// The dot product of the parameter and the parameter. - [Pure] - public static float Dot(Vector4 x, Vector4 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Dot)}({nameof(Vector4)},{nameof(Vector4)})"); - /// /// Returns the base-e exponential of the specified value. /// @@ -1066,30 +702,6 @@ namespace ComputeSharp [Pure] public static Float4 Exp(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Exp)}({nameof(Float4)})"); - /// - /// Returns the base-e exponential of the specified value. - /// - /// The specified value. - /// The base-e exponential of the parameter. - [Pure] - public static Vector2 Exp(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Exp)}({nameof(Vector2)})"); - - /// - /// Returns the base-e exponential of the specified value. - /// - /// The specified value. - /// The base-e exponential of the parameter. - [Pure] - public static Vector3 Exp(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Exp)}({nameof(Vector3)})"); - - /// - /// Returns the base-e exponential of the specified value. - /// - /// The specified value. - /// The base-e exponential of the parameter. - [Pure] - public static Vector4 Exp(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Exp)}({nameof(Vector4)})"); - /// /// Returns the base-2 exponential of the specified value. /// @@ -1122,30 +734,6 @@ namespace ComputeSharp [Pure] public static Float4 Exp2(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Exp2)}({nameof(Float4)})"); - /// - /// Returns the base-2 exponential of the specified value. - /// - /// The specified value. - /// The base-2 exponential of the parameter. - [Pure] - public static Vector2 Exp2(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Exp2)}({nameof(Vector2)})"); - - /// - /// Returns the base-2 exponential of the specified value. - /// - /// The specified value. - /// The base-2 exponential of the parameter. - [Pure] - public static Vector3 Exp2(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Exp2)}({nameof(Vector3)})"); - - /// - /// Returns the base-2 exponential of the specified value. - /// - /// The specified value. - /// The base-2 exponential of the parameter. - [Pure] - public static Vector4 Exp2(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Exp2)}({nameof(Vector4)})"); - /// /// Returns the largest integer that is less than or equal to the specified value. /// @@ -1178,30 +766,6 @@ namespace ComputeSharp [Pure] public static Float4 Floor(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Floor)}({nameof(Float4)})"); - /// - /// Returns the largest integer that is less than or equal to the specified value. - /// - /// The specified value. - /// The largest integer value (returned as a floating-point type) that is less than or equal to the parameter. - [Pure] - public static Vector2 Floor(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Floor)}({nameof(Vector2)})"); - - /// - /// Returns the largest integer that is less than or equal to the specified value. - /// - /// The specified value. - /// The largest integer value (returned as a floating-point type) that is less than or equal to the parameter. - [Pure] - public static Vector3 Floor(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Floor)}({nameof(Vector3)})"); - - /// - /// Returns the largest integer that is less than or equal to the specified value. - /// - /// The specified value. - /// The largest integer value (returned as a floating-point type) that is less than or equal to the parameter. - [Pure] - public static Vector4 Floor(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Floor)}({nameof(Vector4)})"); - /// /// Returns the floating-point remainder of /. /// @@ -1238,33 +802,6 @@ namespace ComputeSharp [Pure] public static Float4 Fmod(Float4 x, Float4 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Fmod)}({nameof(Float4)},{nameof(Float4)})"); - /// - /// Returns the floating-point remainder of /. - /// - /// The divident. - /// The divisor. - /// The floating-point remainder of the parameter divided by the parameter. - [Pure] - public static Vector2 Fmod(Vector2 x, Vector2 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Fmod)}({nameof(Vector2)},{nameof(Vector2)})"); - - /// - /// Returns the floating-point remainder of /. - /// - /// The divident. - /// The divisor. - /// The floating-point remainder of the parameter divided by the parameter. - [Pure] - public static Vector3 Fmod(Vector3 x, Vector3 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Fmod)}({nameof(Vector3)},{nameof(Vector3)})"); - - /// - /// Returns the floating-point remainder of /. - /// - /// The divident. - /// The divisor. - /// The floating-point remainder of the parameter divided by the parameter. - [Pure] - public static Vector4 Fmod(Vector4 x, Vector4 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Fmod)}({nameof(Vector4)},{nameof(Vector4)})"); - /// /// Returns the fractional (or decimal) part of , which is greater than or equal to 0 and less than 1. /// @@ -1297,30 +834,6 @@ namespace ComputeSharp [Pure] public static Float4 Frac(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Frac)}({nameof(Float4)})"); - /// - /// Returns the fractional (or decimal) part of , which is greater than or equal to 0 and less than 1. - /// - /// The specified value. - /// The fractional part of the parameter. - [Pure] - public static Vector2 Frac(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Frac)}({nameof(Vector2)})"); - - /// - /// Returns the fractional (or decimal) part of , which is greater than or equal to 0 and less than 1. - /// - /// The specified value. - /// The fractional part of the parameter. - [Pure] - public static Vector3 Frac(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Frac)}({nameof(Vector3)})"); - - /// - /// Returns the fractional (or decimal) part of , which is greater than or equal to 0 and less than 1. - /// - /// The specified value. - /// The fractional part of the parameter. - [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. /// @@ -1357,33 +870,6 @@ namespace ComputeSharp [Pure] public static Float4 Frexp(Float4 x, out Float4 exp) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Frexp)}({nameof(Float4)},{nameof(Float4)})"); - /// - /// 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(Frexp)}({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)})"); - /// /// Performs a guaranteed atomic add of a value to a destination. /// @@ -1708,33 +1194,6 @@ namespace ComputeSharp [Pure] public static Float4 Ldexp(Float4 x, Float4 exp) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Ldexp)}({nameof(Float4)},{nameof(Float4)})"); - /// - /// Returns the result of multiplying the specified value by two, raised to the power of the specified exponent. - /// - /// The specified value. - /// The specified exponent. - /// The result of multiplying the parameter by two, raised to the power of the parameter. - [Pure] - public static Vector2 Ldexp(Vector2 x, Vector2 exp) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Ldexp)}({nameof(Vector2)},{nameof(Vector2)})"); - - /// - /// Returns the result of multiplying the specified value by two, raised to the power of the specified exponent. - /// - /// The specified value. - /// The specified exponent. - /// The result of multiplying the parameter by two, raised to the power of the parameter. - [Pure] - public static Vector3 Ldexp(Vector3 x, Vector3 exp) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Ldexp)}({nameof(Vector3)},{nameof(Vector3)})"); - - /// - /// Returns the result of multiplying the specified value by two, raised to the power of the specified exponent. - /// - /// The specified value. - /// The specified exponent. - /// The result of multiplying the parameter by two, raised to the power of the parameter. - [Pure] - public static Vector4 Ldexp(Vector4 x, Vector4 exp) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Ldexp)}({nameof(Vector4)},{nameof(Vector4)})"); - /// /// Performs a linear interpolation. /// @@ -1775,36 +1234,6 @@ namespace ComputeSharp [Pure] public static Float2 Lerp(Float4 x, Float4 y, Float4 s) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Lerp)}({nameof(Float4)},{nameof(Float4)},{nameof(Float4)})"); - /// - /// Performs a linear interpolation. - /// - /// The first value. - /// The second value. - /// A value that linearly interpolates between the parameter and the parameter. - /// The result of the linear interpolation. - [Pure] - public static Vector2 Lerp(Vector2 x, Vector2 y, Vector2 s) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Lerp)}({nameof(Vector2)},{nameof(Vector2)},{nameof(Vector2)})"); - - /// - /// Performs a linear interpolation. - /// - /// The first value. - /// The second value. - /// A value that linearly interpolates between the parameter and the parameter. - /// The result of the linear interpolation. - [Pure] - public static Vector3 Lerp(Vector3 x, Vector3 y, Vector3 s) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Lerp)}({nameof(Vector3)},{nameof(Vector3)},{nameof(Vector3)})"); - - /// - /// Performs a linear interpolation. - /// - /// The first value. - /// The second value. - /// A value that linearly interpolates between the parameter and the parameter. - /// The result of the linear interpolation. - [Pure] - public static Vector2 Lerp(Vector4 x, Vector4 y, Vector4 s) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Lerp)}({nameof(Vector4)},{nameof(Vector4)},{nameof(Vector4)})"); - /// /// Returns the base-e logarithm of the specified value. /// @@ -1837,30 +1266,6 @@ namespace ComputeSharp [Pure] public static Float4 Log(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Log)}({nameof(Float4)})"); - /// - /// Returns the base-e logarithm of the specified value. - /// - /// The specified value. - /// The base-e logarithm of the parameter (if parameter is negative this function returns indefinite, and if is 0, this function returns -INF) - [Pure] - public static Vector2 Log(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Log)}({nameof(Vector2)})"); - - /// - /// Returns the base-e logarithm of the specified value. - /// - /// The specified value. - /// The base-e logarithm of the parameter (if parameter is negative this function returns indefinite, and if is 0, this function returns -INF) - [Pure] - public static Vector3 Log(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Log)}({nameof(Vector3)})"); - - /// - /// Returns the base-e logarithm of the specified value. - /// - /// The specified value. - /// The base-e logarithm of the parameter (if parameter is negative this function returns indefinite, and if is 0, this function returns -INF) - [Pure] - public static Vector4 Log(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Log)}({nameof(Vector4)})"); - /// /// Returns the base-10 logarithm of the specified value. /// @@ -1893,30 +1298,6 @@ namespace ComputeSharp [Pure] public static Float4 Log10(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Log10)}({nameof(Float4)})"); - /// - /// Returns the base-10 logarithm of the specified value. - /// - /// The specified value. - /// The base-10 logarithm of the parameter (if parameter is negative this function returns indefinite, and if is 0, this function returns -INF) - [Pure] - public static Vector2 Log10(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Log10)}({nameof(Vector2)})"); - - /// - /// Returns the base-10 logarithm of the specified value. - /// - /// The specified value. - /// The base-10 logarithm of the parameter (if parameter is negative this function returns indefinite, and if is 0, this function returns -INF) - [Pure] - public static Vector3 Log10(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Log10)}({nameof(Vector3)})"); - - /// - /// Returns the base-10 logarithm of the specified value. - /// - /// The specified value. - /// The base-10 logarithm of the parameter (if parameter is negative this function returns indefinite, and if is 0, this function returns -INF) - [Pure] - public static Vector4 Log10(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Log10)}({nameof(Vector4)})"); - /// /// Returns the base-2 logarithm of the specified value. /// @@ -1949,30 +1330,6 @@ namespace ComputeSharp [Pure] public static Float4 Log2(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Log2)}({nameof(Float4)})"); - /// - /// Returns the base-2 logarithm of the specified value. - /// - /// The specified value. - /// The base-2 logarithm of the parameter (if parameter is negative this function returns indefinite, and if is 0, this function returns -INF) - [Pure] - public static Vector2 Log2(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Log2)}({nameof(Vector2)})"); - - /// - /// Returns the base-2 logarithm of the specified value. - /// - /// The specified value. - /// The base-2 logarithm of the parameter (if parameter is negative this function returns indefinite, and if is 0, this function returns -INF) - [Pure] - public static Vector3 Log2(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Log2)}({nameof(Vector3)})"); - - /// - /// Returns the base-2 logarithm of the specified value. - /// - /// The specified value. - /// The base-2 logarithm of the parameter (if parameter is negative this function returns indefinite, and if is 0, this function returns -INF) - [Pure] - public static Vector4 Log2(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Log2)}({nameof(Vector4)})"); - /// /// Selects the greater of and . /// @@ -2023,36 +1380,6 @@ namespace ComputeSharp [Pure] public static Float4 Max(Float4 x, Float4 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Max)}({nameof(Float4)},{nameof(Float4)})"); - /// - /// Selects the greater of and . - /// - /// The first specified value. - /// The second specified exponent. - /// The or parameter, whichever is the largest value. - /// For values of -INF or INF, will behave as expected, but for for values of , the results are undefined. - [Pure] - public static Vector2 Max(Vector2 x, Vector2 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Max)}({nameof(Vector2)},{nameof(Vector2)})"); - - /// - /// Selects the greater of and . - /// - /// The first specified value. - /// The second specified exponent. - /// The or parameter, whichever is the largest value. - /// For values of -INF or INF, will behave as expected, but for for values of , the results are undefined. - [Pure] - public static Vector3 Max(Vector3 x, Vector3 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Max)}({nameof(Vector3)},{nameof(Vector3)})"); - - /// - /// Selects the greater of and . - /// - /// The first specified value. - /// The second specified exponent. - /// The or parameter, whichever is the largest value. - /// For values of -INF or INF, will behave as expected, but for for values of , the results are undefined. - [Pure] - public static Vector4 Max(Vector4 x, Vector4 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Max)}({nameof(Vector4)},{nameof(Vector4)})"); - /// /// Selects the lesser of and . /// @@ -2103,36 +1430,6 @@ namespace ComputeSharp [Pure] public static Float4 Min(Float4 x, Float4 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Min)}({nameof(Float4)},{nameof(Float4)})"); - /// - /// Selects the lesser of and . - /// - /// The first specified value. - /// The second specified exponent. - /// The or parameter, whichever is the smallest value. - /// For values of -INF or INF, will behave as expected, but for for values of , the results are undefined. - [Pure] - public static Vector2 Min(Vector2 x, Vector2 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Min)}({nameof(Vector2)},{nameof(Vector2)})"); - - /// - /// Selects the lesser of and . - /// - /// The first specified value. - /// The second specified exponent. - /// The or parameter, whichever is the smallest value. - /// For values of -INF or INF, will behave as expected, but for for values of , the results are undefined. - [Pure] - public static Vector3 Min(Vector3 x, Vector3 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Min)}({nameof(Vector3)},{nameof(Vector3)})"); - - /// - /// Selects the lesser of and . - /// - /// The first specified value. - /// The second specified exponent. - /// The or parameter, whichever is the smallest value. - /// For values of -INF or INF, will behave as expected, but for for values of , the results are undefined. - [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 . /// @@ -2205,33 +1502,6 @@ namespace ComputeSharp [Pure] public static Float4 Modf(Float4 x, out Float4 ip) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Modf)}({nameof(Float4)},{nameof(Float4)})"); - /// - /// 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, out 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, out 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, out Vector4 ip) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Modf)}({nameof(Vector4)},{nameof(Vector4)})"); - /// /// Multiplies and using matrix math. /// @@ -2259,33 +1529,6 @@ namespace ComputeSharp [Pure] public static Float3 Mul(float x, Float4 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Mul)}(float,{nameof(Float4)})"); - /// - /// Multiplies and using matrix math. - /// - /// The first input value (if is a vector, it treated as a row vector) - /// The second input value (if is a vector, it treated as a column vector) - /// The result of times . - [Pure] - public static Vector2 Mul(float x, Vector2 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Mul)}(float,{nameof(Vector2)})"); - - /// - /// Multiplies and using matrix math. - /// - /// The first input value (if is a vector, it treated as a row vector) - /// The second input value (if is a vector, it treated as a column vector) - /// The result of times . - [Pure] - public static Vector3 Mul(float x, Vector3 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Mul)}(float,{nameof(Vector3)})"); - - /// - /// Multiplies and using matrix math. - /// - /// The first input value (if is a vector, it treated as a row vector) - /// The second input value (if is a vector, it treated as a column vector) - /// The result of times . - [Pure] - public static Vector3 Mul(float x, Vector4 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Mul)}(float,{nameof(Vector4)})"); - /// /// Multiplies and using matrix math. /// @@ -2313,33 +1556,6 @@ namespace ComputeSharp [Pure] public static Float4 Mul(Float4 x, float y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Mul)}({nameof(Float4)},float)"); - /// - /// Multiplies and using matrix math. - /// - /// The first input value (if is a vector, it treated as a row vector) - /// The second input value (if is a vector, it treated as a column vector) - /// The result of times . - [Pure] - public static Vector2 Mul(Vector2 x, float y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Mul)}({nameof(Vector2)},float)"); - - /// - /// Multiplies and using matrix math. - /// - /// The first input value (if is a vector, it treated as a row vector) - /// The second input value (if is a vector, it treated as a column vector) - /// The result of times . - [Pure] - public static Vector3 Mul(Vector3 x, float y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Mul)}({nameof(Vector3)},float)"); - - /// - /// Multiplies and using matrix math. - /// - /// The first input value (if is a vector, it treated as a row vector) - /// The second input value (if is a vector, it treated as a column vector) - /// The result of times . - [Pure] - public static Vector4 Mul(Vector4 x, float y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Mul)}({nameof(Vector4)},float)"); - /// /// Multiplies and using matrix math. /// @@ -2367,33 +1583,6 @@ namespace ComputeSharp [Pure] public static float Mul(Float4 x, Float4 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Mul)}({nameof(Float4)},{nameof(Float4)})"); - /// - /// Multiplies and using matrix math. - /// - /// The first input value (if is a vector, it treated as a row vector) - /// The second input value (if is a vector, it treated as a column vector) - /// The result of times . - [Pure] - public static float Mul(Vector2 x, Vector2 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Mul)}({nameof(Vector2)},{nameof(Vector2)})"); - - /// - /// Multiplies and using matrix math. - /// - /// The first input value (if is a vector, it treated as a row vector) - /// The second input value (if is a vector, it treated as a column vector) - /// The result of times . - [Pure] - public static float Mul(Vector3 x, Vector3 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Mul)}({nameof(Vector3)},{nameof(Vector3)})"); - - /// - /// Multiplies and using matrix math. - /// - /// The first input value (if is a vector, it treated as a row vector) - /// The second input value (if is a vector, it treated as a column vector) - /// The result of times . - [Pure] - public static float Mul(Vector4 x, Vector4 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Mul)}({nameof(Vector4)},{nameof(Vector4)})"); - /// /// Normalizes the specified floating-point vector according to / length() /// @@ -2418,30 +1607,6 @@ namespace ComputeSharp [Pure] public static Float4 Normalize(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Normalize)}({nameof(Float4)})"); - /// - /// Normalizes the specified floating-point vector according to / length() - /// - /// The specified value. - /// The normalized parameter. - [Pure] - public static Vector2 Normalize(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Normalize)}({nameof(Vector2)})"); - - /// - /// Normalizes the specified floating-point vector according to / length() - /// - /// The specified value. - /// The normalized parameter. - [Pure] - public static Vector3 Normalize(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Normalize)}({nameof(Vector3)})"); - - /// - /// Normalizes the specified floating-point vector according to / length() - /// - /// The specified value. - /// The normalized parameter. - [Pure] - public static Vector4 Normalize(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Normalize)}({nameof(Vector4)})"); - /// /// Returns the specified value raised to the specified power. /// @@ -2482,36 +1647,6 @@ namespace ComputeSharp [Pure] public static Float4 Pow(Float4 x, Float4 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Pow)}({nameof(Float4)},{nameof(Float4)})"); - /// - /// Returns the specified value raised to the specified power. - /// - /// The specified value. - /// The specified power. - /// The parameter raised to the power of the parameter. - /// See for details on special cases. - [Pure] - public static Vector2 Pow(Vector2 x, Vector2 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Pow)}({nameof(Vector2)},{nameof(Vector2)})"); - - /// - /// Returns the specified value raised to the specified power. - /// - /// The specified value. - /// The specified power. - /// The parameter raised to the power of the parameter. - /// See for details on special cases. - [Pure] - public static Vector3 Pow(Vector3 x, Vector3 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Pow)}({nameof(Vector3)},{nameof(Vector3)})"); - - /// - /// Returns the specified value raised to the specified power. - /// - /// The specified value. - /// The specified power. - /// The parameter raised to the power of the parameter. - /// See for details on special cases. - [Pure] - public static Vector4 Pow(Vector4 x, Vector4 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Pow)}({nameof(Vector4)},{nameof(Vector4)})"); - /// /// Converts the specified value from degrees to radians. /// @@ -2544,30 +1679,6 @@ namespace ComputeSharp [Pure] public static Float4 Radians(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Radians)}({nameof(Float4)})"); - /// - /// Converts the specified value from degrees to radians. - /// - /// The specified value. - /// The parameter converted from degrees to radians. - [Pure] - public static Vector2 Radians(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Radians)}({nameof(Vector2)})"); - - /// - /// Converts the specified value from degrees to radians. - /// - /// The specified value. - /// The parameter converted from degrees to radians. - [Pure] - public static Vector3 Radians(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Radians)}({nameof(Vector3)})"); - - /// - /// Converts the specified value from degrees to radians. - /// - /// The specified value. - /// The parameter converted from degrees to radians. - [Pure] - public static Vector4 Radians(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Radians)}({nameof(Vector4)})"); - /// /// Calculates a fast, approximate reciprocal of a given value. /// @@ -2600,30 +1711,6 @@ namespace ComputeSharp [Pure] public static Float4 Rcp(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Rcp)}({nameof(Float4)})"); - /// - /// Calculates a fast, approximate, per-component reciprocal. - /// - /// The specified value. - /// The reciprocal of the parameter. - [Pure] - public static Vector2 Rcp(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Rcp)}({nameof(Vector2)})"); - - /// - /// Calculates a fast, approximate, per-component reciprocal. - /// - /// The specified value. - /// The reciprocal of the parameter. - [Pure] - public static Vector3 Rcp(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Rcp)}({nameof(Vector3)})"); - - /// - /// Calculates a fast, approximate, per-component reciprocal. - /// - /// The specified value. - /// The reciprocal of the parameter. - [Pure] - public static Vector4 Rcp(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Rcp)}({nameof(Vector4)})"); - /// /// Rounds the specified value to the nearest integer. /// @@ -2656,30 +1743,6 @@ namespace ComputeSharp [Pure] public static Float4 Round(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Round)}({nameof(Float4)})"); - /// - /// Rounds the specified value to the nearest integer. - /// - /// The specified value. - /// The parameter, rounded to the nearest integer within a floating-point type. - [Pure] - public static Vector2 Round(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Round)}({nameof(Vector2)})"); - - /// - /// Rounds the specified value to the nearest integer. - /// - /// The specified value. - /// The parameter, rounded to the nearest integer within a floating-point type. - [Pure] - public static Vector3 Round(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Round)}({nameof(Vector3)})"); - - /// - /// Rounds the specified value to the nearest integer. - /// - /// The specified value. - /// The parameter, rounded to the nearest integer within a floating-point type. - [Pure] - public static Vector4 Round(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Round)}({nameof(Vector4)})"); - /// /// Returns the reciprocal of the square root of the specified value. /// @@ -2716,33 +1779,6 @@ namespace ComputeSharp [Pure] public static Float4 Rsqrt(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Rsqrt)}({nameof(Float4)})"); - /// - /// Returns the reciprocal of the square root of the specified value. - /// - /// The specified value. - /// The reciprocal of the square root of the parameter. - /// This function uses the following formula: 1 / sqrt() - [Pure] - public static Vector2 Rsqrt(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Rsqrt)}({nameof(Vector2)})"); - - /// - /// Returns the reciprocal of the square root of the specified value. - /// - /// The specified value. - /// The reciprocal of the square root of the parameter. - /// This function uses the following formula: 1 / sqrt() - [Pure] - public static Vector3 Rsqrt(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Rsqrt)}({nameof(Vector3)})"); - - /// - /// Returns the reciprocal of the square root of the specified value. - /// - /// The specified value. - /// The reciprocal of the square root of the parameter. - /// This function uses the following formula: 1 / sqrt() - [Pure] - public static Vector4 Rsqrt(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Rsqrt)}({nameof(Vector4)})"); - /// /// Clamps the specified value within the range [0,1] /// @@ -2775,30 +1811,6 @@ namespace ComputeSharp [Pure] public static Float4 Saturate(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Saturate)}({nameof(Float4)})"); - /// - /// Clamps the specified value within the range [0,1] - /// - /// The specified value. - /// The parameter, clamped within the range [0,1] - [Pure] - public static Vector2 Saturate(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Saturate)}({nameof(Vector2)})"); - - /// - /// Clamps the specified value within the range [0,1] - /// - /// The specified value. - /// The parameter, clamped within the range [0,1] - [Pure] - public static Vector3 Saturate(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Saturate)}({nameof(Vector3)})"); - - /// - /// Clamps the specified value within the range [0,1] - /// - /// The specified value. - /// The parameter, clamped within the range [0,1] - [Pure] - public static Vector4 Saturate(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Saturate)}({nameof(Vector4)})"); - /// /// Returns the sign of . /// @@ -2831,30 +1843,6 @@ namespace ComputeSharp [Pure] public static Float4 Sign(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Sign)}({nameof(Float4)})"); - /// - /// Returns the sign of . - /// - /// The input value. - /// Returns -1 if is less than zero, 0 if equals zero and 1 if is greater than zero. - [Pure] - public static Vector2 Sign(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Sign)}({nameof(Vector2)})"); - - /// - /// Returns the sign of . - /// - /// The input value. - /// Returns -1 if is less than zero, 0 if equals zero and 1 if is greater than zero. - [Pure] - public static Vector3 Sign(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Sign)}({nameof(Vector3)})"); - - /// - /// Returns the sign of . - /// - /// The input value. - /// Returns -1 if is less than zero, 0 if equals zero and 1 if is greater than zero. - [Pure] - public static Vector4 Sign(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Sign)}({nameof(Vector4)})"); - /// /// Returns the sine of the specified value. /// @@ -2887,30 +1875,6 @@ namespace ComputeSharp [Pure] public static Float4 Sin(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Sin)}({nameof(Float4)})"); - /// - /// Returns the sine of the specified value. - /// - /// The specified value, radians. - /// The sine of the parameter. - [Pure] - public static Vector2 Sin(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Sin)}({nameof(Vector2)})"); - - /// - /// Returns the sine of the specified value. - /// - /// The specified value, radians. - /// The sine of the parameter. - [Pure] - public static Vector3 Sin(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Sin)}({nameof(Vector3)})"); - - /// - /// Returns the sine of the specified value. - /// - /// The specified value, radians. - /// The sine of the parameter. - [Pure] - public static Vector4 Sin(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Sin)}({nameof(Vector4)})"); - /// /// Returns the sine and cosine of . /// @@ -2943,30 +1907,6 @@ namespace ComputeSharp /// Returns the cosine of . public static void SinCos(Float4 x, out Float4 s, out Float4 c) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(SinCos)}({nameof(Float4)},{nameof(Float4)},{nameof(Float4)})"); - /// - /// Returns the sine and cosine of . - /// - /// The specified value, 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, 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, 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. /// @@ -2999,30 +1939,6 @@ namespace ComputeSharp [Pure] public static Float4 Sinh(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Sinh)}({nameof(Float4)})"); - /// - /// Returns the hyperbolic sine of the specified value. - /// - /// The specified value, radians. - /// The hyperbolic sine of the parameter. - [Pure] - public static Vector2 Sinh(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Sinh)}({nameof(Vector2)})"); - - /// - /// Returns the hyperbolic sine of the specified value. - /// - /// The specified value, radians. - /// The hyperbolic sine of the parameter. - [Pure] - public static Vector3 Sinh(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Sinh)}({nameof(Vector3)})"); - - /// - /// Returns the hyperbolic sine of the specified value. - /// - /// The specified value, radians. - /// The hyperbolic sine of the parameter. - [Pure] - public static Vector4 Sinh(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Sinh)}({nameof(Vector4)})"); - /// /// Returns a smooth Hermite interpolation between 0 and 1, if is in the range [, ] /// @@ -3063,36 +1979,6 @@ namespace ComputeSharp [Pure] public static Float4 SmoothStep(Float4 min, Float4 max, Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(SmoothStep)}({nameof(Float4)},{nameof(Float4)},{nameof(Float4)})"); - /// - /// Returns a smooth Hermite interpolation between 0 and 1, if is in the range [, ] - /// - /// The minimum range of the parameter. - /// The maximum range of the parameter. - /// The specified value to be interpolated. - /// 0 if is less than , 1 if is greater than , otherwise a value between 0 and 1 if is in the range [, ] - [Pure] - public static Vector2 SmoothStep(Vector2 min, Vector2 max, Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(SmoothStep)}({nameof(Vector2)},{nameof(Vector2)},{nameof(Vector2)})"); - - /// - /// Returns a smooth Hermite interpolation between 0 and 1, if is in the range [, ] - /// - /// The minimum range of the parameter. - /// The maximum range of the parameter. - /// The specified value to be interpolated. - /// 0 if is less than , 1 if is greater than , otherwise a value between 0 and 1 if is in the range [, ] - [Pure] - public static Vector3 SmoothStep(Vector3 min, Vector3 max, Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(SmoothStep)}({nameof(Vector3)},{nameof(Vector3)},{nameof(Vector3)})"); - - /// - /// Returns a smooth Hermite interpolation between 0 and 1, if is in the range [, ] - /// - /// The minimum range of the parameter. - /// The maximum range of the parameter. - /// The specified value to be interpolated. - /// 0 if is less than , 1 if is greater than , otherwise a value between 0 and 1 if is in the range [, ] - [Pure] - public static Vector4 SmoothStep(Vector4 min, Vector4 max, Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(SmoothStep)}({nameof(Vector4)},{nameof(Vector4)},{nameof(Vector4)})"); - /// /// Returns the square root of the specified floating-point value. /// @@ -3125,30 +2011,6 @@ namespace ComputeSharp [Pure] public static Float4 Sqrt(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Sqrt)}({nameof(Float4)})"); - /// - /// Returns the square root of the specified floating-point value, per component. - /// - /// The specified value. - /// The square root of the parameter, per component. - [Pure] - public static Vector2 Sqrt(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Sqrt)}({nameof(Vector2)})"); - - /// - /// Returns the square root of the specified floating-point value, per component. - /// - /// The specified value. - /// The square root of the parameter, per component. - [Pure] - public static Vector3 Sqrt(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Sqrt)}({nameof(Vector3)})"); - - /// - /// Returns the square root of the specified floating-point value, per component. - /// - /// The specified value. - /// The square root of the parameter, per component. - [Pure] - public static Vector4 Sqrt(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Sqrt)}({nameof(Vector4)})"); - /// /// Compares two values, returning 0 or 1 based on which value is greater. /// @@ -3189,36 +2051,6 @@ namespace ComputeSharp [Pure] public static Float4 Step(Float4 x, Float4 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Step)}({nameof(Float4)},{nameof(Float4)})"); - /// - /// Compares two values, returning 0 or 1 based on which value is greater. - /// - /// The first specified value to compare. - /// The second specified value to compare. - /// 1 if the parameter is greater than or equal to the parameter, otherwise, 0. - /// This function uses the following formula: (x >= y) ? 1 : 0. - [Pure] - public static Vector2 Step(Vector2 x, Vector2 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Step)}({nameof(Vector2)},{nameof(Vector2)})"); - - /// - /// Compares two values, returning 0 or 1 based on which value is greater. - /// - /// The first specified value to compare. - /// The second specified value to compare. - /// 1 if the parameter is greater than or equal to the parameter, otherwise, 0. - /// This function uses the following formula: (x >= y) ? 1 : 0. - [Pure] - public static Vector3 Step(Vector3 x, Vector3 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Step)}({nameof(Vector3)},{nameof(Vector3)})"); - - /// - /// Compares two values, returning 0 or 1 based on which value is greater. - /// - /// The first specified value to compare. - /// The second specified value to compare. - /// 1 if the parameter is greater than or equal to the parameter, otherwise, 0. - /// This function uses the following formula: (x >= y) ? 1 : 0. - [Pure] - public static Vector4 Step(Vector4 x, Vector4 y) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Step)}({nameof(Vector4)},{nameof(Vector4)})"); - /// /// Returns the tangent of the specified value. /// @@ -3251,30 +2083,6 @@ namespace ComputeSharp [Pure] public static Float4 Tan(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Tan)}({nameof(Float4)})"); - /// - /// Returns the tangent of the specified value. - /// - /// The specified value, radians. - /// The tangent of the parameter. - [Pure] - public static Vector2 Tan(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Tan)}({nameof(Vector2)})"); - - /// - /// Returns the tangent of the specified value. - /// - /// The specified value, radians. - /// The tangent of the parameter. - [Pure] - public static Vector3 Tan(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Tan)}({nameof(Vector3)})"); - - /// - /// Returns the tangent of the specified value. - /// - /// The specified value, radians. - /// The tangent of the parameter. - [Pure] - public static Vector4 Tan(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Tan)}({nameof(Vector4)})"); - /// /// Returns the hyperbolic tangent of the specified value. /// @@ -3307,30 +2115,6 @@ namespace ComputeSharp [Pure] public static Float4 Tanh(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Tanh)}({nameof(Float4)})"); - /// - /// Returns the hyperbolic tangent of the specified value. - /// - /// The specified value, radians. - /// The hyperbolic tangent of the parameter. - [Pure] - public static Vector2 Tanh(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Tanh)}({nameof(Vector2)})"); - - /// - /// Returns the hyperbolic tangent of the specified value. - /// - /// The specified value, radians. - /// The hyperbolic tangent of the parameter. - [Pure] - public static Vector3 Tanh(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Tanh)}({nameof(Vector3)})"); - - /// - /// Returns the hyperbolic tangent of the specified value. - /// - /// The specified value, radians. - /// The hyperbolic tangent of the parameter. - [Pure] - public static Vector4 Tanh(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Tanh)}({nameof(Vector4)})"); - /// /// Truncates a floating-point value to the integer component. /// @@ -3362,29 +2146,5 @@ namespace ComputeSharp /// The parameter truncated to an integer component. [Pure] public static Float4 Trunc(Float4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Trunc)}({nameof(Float4)})"); - - /// - /// Truncates a floating-point value to the integer component. - /// - /// The specified value, radians. - /// The parameter truncated to an integer component. - [Pure] - public static Vector2 Trunc(Vector2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Trunc)}({nameof(Vector2)})"); - - /// - /// Truncates a floating-point value to the integer component. - /// - /// The specified value, radians. - /// The parameter truncated to an integer component. - [Pure] - public static Vector3 Trunc(Vector3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Trunc)}({nameof(Vector3)})"); - - /// - /// Truncates a floating-point value to the integer component. - /// - /// The specified value, radians. - /// The parameter truncated to an integer component. - [Pure] - public static Vector4 Trunc(Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Trunc)}({nameof(Vector4)})"); } } diff --git a/src/ComputeSharp.Core/Primitives/Float/Float2.cs b/src/ComputeSharp.Core/Primitives/Float/Float2.cs index 42067446..36168a1c 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float2.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float2.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.Numerics; using System.Runtime.InteropServices; using ComputeSharp.Exceptions; @@ -142,6 +143,18 @@ namespace ComputeSharp /// The value to use for the components of the new instance. public static implicit operator Float2(float x) => new(x, x); + /// + /// Casts a value to a one. + /// + /// The input value to cast. + public static unsafe implicit operator Vector2(Float2 xy) => *(Vector2*)&xy; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + public static unsafe implicit operator Float2(Vector2 xy) => *(Float2*)&xy; + /// /// Casts a value to a one. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float3.cs b/src/ComputeSharp.Core/Primitives/Float/Float3.cs index 30069e33..eeeea995 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float3.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float3.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.Numerics; using System.Runtime.InteropServices; using ComputeSharp.Exceptions; @@ -563,6 +564,18 @@ namespace ComputeSharp /// The value to use for the components of the new instance. public static implicit operator Float3(float x) => new(x, x, x); + /// + /// Casts a value to a one. + /// + /// The input value to cast. + public static unsafe implicit operator Vector3(Float3 xyz) => *(Vector3*)&xyz; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + public static unsafe implicit operator Float3(Vector3 xyz) => *(Float3*)&xyz; + /// /// Casts a value to a one. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float4.cs b/src/ComputeSharp.Core/Primitives/Float/Float4.cs index 944ec16e..5b7904a6 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float4.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float4.cs @@ -1,4 +1,5 @@ using System.Diagnostics; +using System.Numerics; using System.Runtime.InteropServices; using ComputeSharp.Exceptions; @@ -3968,6 +3969,18 @@ namespace ComputeSharp /// The value to use for the components of the new instance. public static implicit operator Float4(float x) => new(x, x, x, x); + /// + /// Casts a value to a one. + /// + /// The input value to cast. + public static unsafe implicit operator Vector4(Float4 xyzw) => *(Vector4*)&xyzw; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + public static unsafe implicit operator Float4(Vector4 xyzw) => *(Float4*)&xyzw; + /// /// Casts a value to a one. /// diff --git a/src/ComputeSharp.SourceGenerators/ComputeSharp.SourceGenerators.csproj b/src/ComputeSharp.SourceGenerators/ComputeSharp.SourceGenerators.csproj index 04f729f7..03fb352f 100644 --- a/src/ComputeSharp.SourceGenerators/ComputeSharp.SourceGenerators.csproj +++ b/src/ComputeSharp.SourceGenerators/ComputeSharp.SourceGenerators.csproj @@ -2,6 +2,7 @@ netstandard2.0 + true 9.0 @@ -12,7 +13,7 @@ + and to match members based on full name, so the types being in the generator assembly are not an issue.-->