From 9e16f9a7e2a6ce04771f0777137d309bfc81cf4e Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sun, 28 Aug 2022 15:18:20 +0200 Subject: [PATCH] Add mul() operators to Float/Int intrinsic types --- .../Primitives/Float/Float2.g.cs | 91 +++++++++++++++++++ .../Primitives/Float/Float3.g.cs | 91 +++++++++++++++++++ .../Primitives/Float/Float4.g.cs | 91 +++++++++++++++++++ .../Primitives/Int/Int2.g.cs | 91 +++++++++++++++++++ .../Primitives/Int/Int3.g.cs | 91 +++++++++++++++++++ .../Primitives/Int/Int4.g.cs | 91 +++++++++++++++++++ .../Primitives/VectorType.ttinclude | 25 +++++ 7 files changed, 571 insertions(+) diff --git a/src/ComputeSharp.Core/Primitives/Float/Float2.g.cs b/src/ComputeSharp.Core/Primitives/Float/Float2.g.cs index b6d8ddde..ee9a79e7 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float2.g.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float2.g.cs @@ -498,6 +498,97 @@ public unsafe partial struct Float2 /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static Float2 operator *(Float2 left, Float2 right) => default; + /// + /// Multiplies two values using matrix math. + /// + /// The first float input value. + /// The second Float2 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Float2 operator *(float x, Float2 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Float2 input value. + /// The second float input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Float2 operator *(Float2 x, float y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Float2 input value. + /// The second Float2x1 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static float operator *(Float2 x, Float2x1 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Float2 input value. + /// The second Float2x2 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Float2 operator *(Float2 x, Float2x2 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Float2 input value. + /// The second Float2x3 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Float3 operator *(Float2 x, Float2x3 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Float2 input value. + /// The second Float2x4 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Float4 operator *(Float2 x, Float2x4 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Float2x2 input value. + /// The second Float2 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Float2 operator *(Float2x2 x, Float2 y) => default; + /// /// Subtracts two values. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float3.g.cs b/src/ComputeSharp.Core/Primitives/Float/Float3.g.cs index 2ae26205..1935969c 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float3.g.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float3.g.cs @@ -1584,6 +1584,97 @@ public unsafe partial struct Float3 /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static Float3 operator *(Float3 left, Float3 right) => default; + /// + /// Multiplies two values using matrix math. + /// + /// The first float input value. + /// The second Float3 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Float3 operator *(float x, Float3 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Float3 input value. + /// The second float input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Float3 operator *(Float3 x, float y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Float3 input value. + /// The second Float3x1 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static float operator *(Float3 x, Float3x1 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Float3 input value. + /// The second Float3x2 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Float2 operator *(Float3 x, Float3x2 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Float3 input value. + /// The second Float3x3 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Float3 operator *(Float3 x, Float3x3 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Float3 input value. + /// The second Float3x4 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Float4 operator *(Float3 x, Float3x4 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Float3x3 input value. + /// The second Float3 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Float3 operator *(Float3x3 x, Float3 y) => default; + /// /// Subtracts two values. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float4.g.cs b/src/ComputeSharp.Core/Primitives/Float/Float4.g.cs index 4f079788..e25e45d6 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float4.g.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float4.g.cs @@ -4230,6 +4230,97 @@ public unsafe partial struct Float4 /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static Float4 operator *(Float4 left, Float4 right) => default; + /// + /// Multiplies two values using matrix math. + /// + /// The first float input value. + /// The second Float4 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Float4 operator *(float x, Float4 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Float4 input value. + /// The second float input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Float4 operator *(Float4 x, float y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Float4 input value. + /// The second Float4x1 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static float operator *(Float4 x, Float4x1 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Float4 input value. + /// The second Float4x2 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Float2 operator *(Float4 x, Float4x2 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Float4 input value. + /// The second Float4x3 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Float3 operator *(Float4 x, Float4x3 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Float4 input value. + /// The second Float4x4 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Float4 operator *(Float4 x, Float4x4 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Float4x4 input value. + /// The second Float4 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Float4 operator *(Float4x4 x, Float4 y) => default; + /// /// Subtracts two values. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs b/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs index 0fb6dc1b..a0447fd4 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs @@ -498,6 +498,97 @@ public unsafe partial struct Int2 /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static Int2 operator *(Int2 left, Int2 right) => default; + /// + /// Multiplies two values using matrix math. + /// + /// The first int input value. + /// The second Int2 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Int2 operator *(int x, Int2 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Int2 input value. + /// The second int input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Int2 operator *(Int2 x, int y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Int2 input value. + /// The second Int2x1 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static int operator *(Int2 x, Int2x1 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Int2 input value. + /// The second Int2x2 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Int2 operator *(Int2 x, Int2x2 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Int2 input value. + /// The second Int2x3 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Int3 operator *(Int2 x, Int2x3 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Int2 input value. + /// The second Int2x4 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Int4 operator *(Int2 x, Int2x4 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Int2x2 input value. + /// The second Int2 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Int2 operator *(Int2x2 x, Int2 y) => default; + /// /// Subtracts two values. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs b/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs index 086c6910..eacdeb6f 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs @@ -1584,6 +1584,97 @@ public unsafe partial struct Int3 /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static Int3 operator *(Int3 left, Int3 right) => default; + /// + /// Multiplies two values using matrix math. + /// + /// The first int input value. + /// The second Int3 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Int3 operator *(int x, Int3 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Int3 input value. + /// The second int input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Int3 operator *(Int3 x, int y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Int3 input value. + /// The second Int3x1 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static int operator *(Int3 x, Int3x1 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Int3 input value. + /// The second Int3x2 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Int2 operator *(Int3 x, Int3x2 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Int3 input value. + /// The second Int3x3 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Int3 operator *(Int3 x, Int3x3 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Int3 input value. + /// The second Int3x4 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Int4 operator *(Int3 x, Int3x4 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Int3x3 input value. + /// The second Int3 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Int3 operator *(Int3x3 x, Int3 y) => default; + /// /// Subtracts two values. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs b/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs index fbcf0214..488b05c6 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs @@ -4230,6 +4230,97 @@ public unsafe partial struct Int4 /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static Int4 operator *(Int4 left, Int4 right) => default; + /// + /// Multiplies two values using matrix math. + /// + /// The first int input value. + /// The second Int4 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Int4 operator *(int x, Int4 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Int4 input value. + /// The second int input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Int4 operator *(Int4 x, int y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Int4 input value. + /// The second Int4x1 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static int operator *(Int4 x, Int4x1 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Int4 input value. + /// The second Int4x2 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Int2 operator *(Int4 x, Int4x2 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Int4 input value. + /// The second Int4x3 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Int3 operator *(Int4 x, Int4x3 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Int4 input value. + /// The second Int4x4 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Int4 operator *(Int4 x, Int4x4 y) => default; + + /// + /// Multiplies two values using matrix math. + /// + /// The first Int4x4 input value. + /// The second Int4 input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static Int4 operator *(Int4x4 x, Int4 y) => default; + /// /// Subtracts two values. /// diff --git a/src/ComputeSharp.Core/Primitives/VectorType.ttinclude b/src/ComputeSharp.Core/Primitives/VectorType.ttinclude index 22a5c954..15eb8ba4 100644 --- a/src/ComputeSharp.Core/Primitives/VectorType.ttinclude +++ b/src/ComputeSharp.Core/Primitives/VectorType.ttinclude @@ -354,7 +354,32 @@ public unsafe partial struct <#=typeName#> /// The result of multiplying and . /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public static <#=typeName#> operator *(<#=typeName#> left, <#=typeName#> right) => default; +<# + // Process all operators for the mul() intrinsic + foreach (var mulOverload in MulOverloads.Where(overload => + !(overload.Params[0] == typeName && overload.Params[1] == typeName) && + (overload.Return == typeName && overload.Params.Contains(typeName) || + !overload.Params.Contains(overload.Return) && overload.Params[0] == typeName))) + { + WriteLine(""); +#> + /// + /// Multiplies two values using matrix math. + /// + /// The first <#=mulOverload.Params[0]#> input value. + /// The second <#=mulOverload.Params[1]#> input value. + /// The result of times . The result has the dimension -rows by -columns. + /// + /// This operator is equivalent to using with the same input arguments. + /// For more info, see . + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// + public static <#=mulOverload.Return#> operator *(<#=mulOverload.Params[0]#> x, <#=mulOverload.Params[1]#> y) => default; +<# + } + WriteLine(""); +#> /// /// Subtracts two values. ///