From f30f9273edd6a4b1ee8bd3e34fe2e25759bf9ec4 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 26 Aug 2019 13:34:46 +0200 Subject: [PATCH] Added HLSL functions for Int2, Int3 and Int4 types --- src/ComputeSharp.Shaders/Intrinsics/Hlsl.cs | 105 ++++++++++++++++++++ 1 file changed, 105 insertions(+) diff --git a/src/ComputeSharp.Shaders/Intrinsics/Hlsl.cs b/src/ComputeSharp.Shaders/Intrinsics/Hlsl.cs index c74b10fb..75687207 100644 --- a/src/ComputeSharp.Shaders/Intrinsics/Hlsl.cs +++ b/src/ComputeSharp.Shaders/Intrinsics/Hlsl.cs @@ -17,6 +17,30 @@ namespace ComputeSharp [Pure] public static int Abs(in int x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Abs)}(int)"); + /// + /// Returns the absolute value of the specified value + /// + /// The specified value + /// The absolute value of the parameter + [Pure] + public static Int2 Abs(in Int2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Abs)}({nameof(Int2)})"); + + /// + /// Returns the absolute value of the specified value + /// + /// The specified value + /// The absolute value of the parameter + [Pure] + public static Int3 Abs(in Int3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Abs)}({nameof(Int3)})"); + + /// + /// Returns the absolute value of the specified value + /// + /// The specified value + /// The absolute value of the parameter + [Pure] + public static Int4 Abs(in Int4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Abs)}({nameof(Int4)})"); + /// /// Returns the absolute value of the specified value /// @@ -81,6 +105,30 @@ namespace ComputeSharp [Pure] public static Vector3 Acos(in Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Acos)}({nameof(Vector4)})"); + /// + /// 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(in Int2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(All)}({nameof(Int2)})"); + + /// + /// 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(in Int3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(All)}({nameof(Int3)})"); + + /// + /// 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(in Int4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(All)}({nameof(Int4)})"); + /// /// Determines if all components of the specified value are non-zero /// @@ -105,6 +153,30 @@ namespace ComputeSharp [Pure] public static bool All(in Vector4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(All)}({nameof(Vector4)})"); + /// + /// 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(in Int2 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Any)}({nameof(Int2)})"); + + /// + /// 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(in Int3 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Any)}({nameof(Int3)})"); + + /// + /// 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(in Int4 x) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Any)}({nameof(Int4)})"); + /// /// Determines if any components of the specified value are non-zero /// @@ -272,6 +344,39 @@ namespace ComputeSharp [Pure] public static int Clamp(in int x, in int min, in int max) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Clamp)}(int,int,int)"); + /// + /// 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 Int2 Clamp(in Int2 x, in Int2 min, in Int2 max) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Clamp)}({nameof(Int2)},{nameof(Int2)},{nameof(Int2)})"); + + /// + /// 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 Int3 Clamp(in Int3 x, in Int3 min, in Int3 max) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Clamp)}({nameof(Int3)},{nameof(Int3)},{nameof(Int3)})"); + + /// + /// 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 Int4 Clamp(in Int4 x, in Int4 min, in Int4 max) => throw new InvalidExecutionContextException($"{nameof(Hlsl)}.{nameof(Clamp)}({nameof(Int4)},{nameof(Int4)},{nameof(Int4)})"); + /// /// Clamps the specified value to the specified minimum and maximum range ///