diff --git a/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs b/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs index 0720e4f4..82e8bddc 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs @@ -731,6 +731,42 @@ 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 xy, UInt2 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 xy, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 xy, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 xy, Int2 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 xy, UInt2 amount) => default; + /// /// Shifts left a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs b/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs index d3cb66be..54c96875 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs @@ -2071,6 +2071,42 @@ 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 xyz, UInt3 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 xyz, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 xyz, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 xyz, Int3 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 xyz, UInt3 amount) => default; + /// /// Shifts left a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs b/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs index ce557c50..49588ee4 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs @@ -5408,6 +5408,42 @@ 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 xyzw, UInt4 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 xyzw, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 xyzw, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 xyzw, Int4 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 xyzw, UInt4 amount) => default; + /// /// Shifts left a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/IntMxN.g.cs b/src/ComputeSharp.Core/Primitives/Int/IntMxN.g.cs index b76c3c3b..d5742dff 100644 --- a/src/ComputeSharp.Core/Primitives/Int/IntMxN.g.cs +++ b/src/ComputeSharp.Core/Primitives/Int/IntMxN.g.cs @@ -262,6 +262,42 @@ public unsafe partial struct Int1x1 /// 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 Int1x1 operator >>(Int1x1 matrix, UInt1x1 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int1x1 operator >>>(Int1x1 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int1x1 operator >>>(Int1x1 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int1x1 operator >>>(Int1x1 matrix, Int1x1 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int1x1 operator >>>(Int1x1 matrix, UInt1x1 amount) => default; + /// /// Shifts left a value. /// @@ -777,6 +813,42 @@ public unsafe partial struct Int1x2 /// 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 Int1x2 operator >>(Int1x2 matrix, UInt1x2 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int1x2 operator >>>(Int1x2 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int1x2 operator >>>(Int1x2 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int1x2 operator >>>(Int1x2 matrix, Int1x2 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int1x2 operator >>>(Int1x2 matrix, UInt1x2 amount) => default; + /// /// Shifts left a value. /// @@ -1310,6 +1382,42 @@ public unsafe partial struct Int1x3 /// 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 Int1x3 operator >>(Int1x3 matrix, UInt1x3 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int1x3 operator >>>(Int1x3 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int1x3 operator >>>(Int1x3 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int1x3 operator >>>(Int1x3 matrix, Int1x3 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int1x3 operator >>>(Int1x3 matrix, UInt1x3 amount) => default; + /// /// Shifts left a value. /// @@ -1855,6 +1963,42 @@ public unsafe partial struct Int1x4 /// 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 Int1x4 operator >>(Int1x4 matrix, UInt1x4 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int1x4 operator >>>(Int1x4 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int1x4 operator >>>(Int1x4 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int1x4 operator >>>(Int1x4 matrix, Int1x4 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int1x4 operator >>>(Int1x4 matrix, UInt1x4 amount) => default; + /// /// Shifts left a value. /// @@ -2362,6 +2506,42 @@ public unsafe partial struct Int2x1 /// 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 Int2x1 operator >>(Int2x1 matrix, UInt2x1 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int2x1 operator >>>(Int2x1 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int2x1 operator >>>(Int2x1 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int2x1 operator >>>(Int2x1 matrix, Int2x1 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int2x1 operator >>>(Int2x1 matrix, UInt2x1 amount) => default; + /// /// Shifts left a value. /// @@ -2836,6 +3016,42 @@ public unsafe partial struct Int2x2 /// 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 Int2x2 operator >>(Int2x2 matrix, UInt2x2 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int2x2 operator >>>(Int2x2 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int2x2 operator >>>(Int2x2 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int2x2 operator >>>(Int2x2 matrix, Int2x2 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int2x2 operator >>>(Int2x2 matrix, UInt2x2 amount) => default; + /// /// Shifts left a value. /// @@ -3414,6 +3630,42 @@ public unsafe partial struct Int2x3 /// 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 Int2x3 operator >>(Int2x3 matrix, UInt2x3 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int2x3 operator >>>(Int2x3 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int2x3 operator >>>(Int2x3 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int2x3 operator >>>(Int2x3 matrix, Int2x3 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int2x3 operator >>>(Int2x3 matrix, UInt2x3 amount) => default; + /// /// Shifts left a value. /// @@ -4018,6 +4270,42 @@ public unsafe partial struct Int2x4 /// 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 Int2x4 operator >>(Int2x4 matrix, UInt2x4 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int2x4 operator >>>(Int2x4 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int2x4 operator >>>(Int2x4 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int2x4 operator >>>(Int2x4 matrix, Int2x4 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int2x4 operator >>>(Int2x4 matrix, UInt2x4 amount) => default; + /// /// Shifts left a value. /// @@ -4531,6 +4819,42 @@ public unsafe partial struct Int3x1 /// 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 Int3x1 operator >>(Int3x1 matrix, UInt3x1 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int3x1 operator >>>(Int3x1 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int3x1 operator >>>(Int3x1 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int3x1 operator >>>(Int3x1 matrix, Int3x1 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int3x1 operator >>>(Int3x1 matrix, UInt3x1 amount) => default; + /// /// Shifts left a value. /// @@ -5116,6 +5440,42 @@ public unsafe partial struct Int3x2 /// 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 Int3x2 operator >>(Int3x2 matrix, UInt3x2 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int3x2 operator >>>(Int3x2 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int3x2 operator >>>(Int3x2 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int3x2 operator >>>(Int3x2 matrix, Int3x2 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int3x2 operator >>>(Int3x2 matrix, UInt3x2 amount) => default; + /// /// Shifts left a value. /// @@ -5650,6 +6010,42 @@ public unsafe partial struct Int3x3 /// 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 Int3x3 operator >>(Int3x3 matrix, UInt3x3 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int3x3 operator >>>(Int3x3 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int3x3 operator >>>(Int3x3 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int3x3 operator >>>(Int3x3 matrix, Int3x3 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int3x3 operator >>>(Int3x3 matrix, UInt3x3 amount) => default; + /// /// Shifts left a value. /// @@ -6307,6 +6703,42 @@ public unsafe partial struct Int3x4 /// 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 Int3x4 operator >>(Int3x4 matrix, UInt3x4 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int3x4 operator >>>(Int3x4 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int3x4 operator >>>(Int3x4 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int3x4 operator >>>(Int3x4 matrix, Int3x4 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int3x4 operator >>>(Int3x4 matrix, UInt3x4 amount) => default; + /// /// Shifts left a value. /// @@ -6832,6 +7264,42 @@ public unsafe partial struct Int4x1 /// 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 Int4x1 operator >>(Int4x1 matrix, UInt4x1 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int4x1 operator >>>(Int4x1 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int4x1 operator >>>(Int4x1 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int4x1 operator >>>(Int4x1 matrix, Int4x1 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int4x1 operator >>>(Int4x1 matrix, UInt4x1 amount) => default; + /// /// Shifts left a value. /// @@ -7444,6 +7912,42 @@ public unsafe partial struct Int4x2 /// 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 Int4x2 operator >>(Int4x2 matrix, UInt4x2 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int4x2 operator >>>(Int4x2 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int4x2 operator >>>(Int4x2 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int4x2 operator >>>(Int4x2 matrix, Int4x2 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int4x2 operator >>>(Int4x2 matrix, UInt4x2 amount) => default; + /// /// Shifts left a value. /// @@ -8102,6 +8606,42 @@ public unsafe partial struct Int4x3 /// 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 Int4x3 operator >>(Int4x3 matrix, UInt4x3 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int4x3 operator >>>(Int4x3 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int4x3 operator >>>(Int4x3 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int4x3 operator >>>(Int4x3 matrix, Int4x3 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int4x3 operator >>>(Int4x3 matrix, UInt4x3 amount) => default; + /// /// Shifts left a value. /// @@ -8728,6 +9268,42 @@ public unsafe partial struct Int4x4 /// 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 Int4x4 operator >>(Int4x4 matrix, UInt4x4 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int4x4 operator >>>(Int4x4 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int4x4 operator >>>(Int4x4 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int4x4 operator >>>(Int4x4 matrix, Int4x4 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 Int4x4 operator >>>(Int4x4 matrix, UInt4x4 amount) => default; + /// /// Shifts left a value. /// diff --git a/src/ComputeSharp.Core/Primitives/MatrixType.ttinclude b/src/ComputeSharp.Core/Primitives/MatrixType.ttinclude index fe7e0060..18182ecc 100644 --- a/src/ComputeSharp.Core/Primitives/MatrixType.ttinclude +++ b/src/ComputeSharp.Core/Primitives/MatrixType.ttinclude @@ -485,6 +485,42 @@ public unsafe partial struct <#=fullTypeName#> /// 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 <#=fullTypeName#> operator >>(<#=fullTypeName#> matrix, UInt<#=rows#>x<#=columns#> amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 <#=fullTypeName#> operator >>>(<#=fullTypeName#> matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 <#=fullTypeName#> operator >>>(<#=fullTypeName#> matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 <#=fullTypeName#> operator >>>(<#=fullTypeName#> matrix, Int<#=rows#>x<#=columns#> amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 <#=fullTypeName#> operator >>>(<#=fullTypeName#> matrix, UInt<#=rows#>x<#=columns#> amount) => default; + /// /// Shifts left a value. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt2.g.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt2.g.cs index 292e49db..9c4f7b62 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt2.g.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt2.g.cs @@ -634,6 +634,42 @@ public unsafe partial struct UInt2 /// 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 UInt2 operator >>(UInt2 xy, UInt2 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2 operator >>>(UInt2 xy, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2 operator >>>(UInt2 xy, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2 operator >>>(UInt2 xy, Int2 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2 operator >>>(UInt2 xy, UInt2 amount) => default; + /// /// Shifts left a value. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt3.g.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt3.g.cs index 356b166c..c3454cfa 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt3.g.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt3.g.cs @@ -1974,6 +1974,42 @@ public unsafe partial struct UInt3 /// 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 UInt3 operator >>(UInt3 xyz, UInt3 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3 operator >>>(UInt3 xyz, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3 operator >>>(UInt3 xyz, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3 operator >>>(UInt3 xyz, Int3 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3 operator >>>(UInt3 xyz, UInt3 amount) => default; + /// /// Shifts left a value. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt4.g.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt4.g.cs index eaf516f7..dfd5d023 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt4.g.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt4.g.cs @@ -5311,6 +5311,42 @@ public unsafe partial struct UInt4 /// 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 UInt4 operator >>(UInt4 xyzw, UInt4 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4 operator >>>(UInt4 xyzw, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4 operator >>>(UInt4 xyzw, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4 operator >>>(UInt4 xyzw, Int4 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4 operator >>>(UInt4 xyzw, UInt4 amount) => default; + /// /// Shifts left a value. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UIntMxN.g.cs b/src/ComputeSharp.Core/Primitives/UInt/UIntMxN.g.cs index a1c9a1e8..d9398edf 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UIntMxN.g.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UIntMxN.g.cs @@ -236,6 +236,42 @@ public unsafe partial struct UInt1x1 /// 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 UInt1x1 operator >>(UInt1x1 matrix, UInt1x1 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt1x1 operator >>>(UInt1x1 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt1x1 operator >>>(UInt1x1 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt1x1 operator >>>(UInt1x1 matrix, Int1x1 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt1x1 operator >>>(UInt1x1 matrix, UInt1x1 amount) => default; + /// /// Shifts left a value. /// @@ -642,6 +678,42 @@ public unsafe partial struct UInt1x2 /// 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 UInt1x2 operator >>(UInt1x2 matrix, UInt1x2 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt1x2 operator >>>(UInt1x2 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt1x2 operator >>>(UInt1x2 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt1x2 operator >>>(UInt1x2 matrix, Int1x2 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt1x2 operator >>>(UInt1x2 matrix, UInt1x2 amount) => default; + /// /// Shifts left a value. /// @@ -1066,6 +1138,42 @@ public unsafe partial struct UInt1x3 /// 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 UInt1x3 operator >>(UInt1x3 matrix, UInt1x3 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt1x3 operator >>>(UInt1x3 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt1x3 operator >>>(UInt1x3 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt1x3 operator >>>(UInt1x3 matrix, Int1x3 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt1x3 operator >>>(UInt1x3 matrix, UInt1x3 amount) => default; + /// /// Shifts left a value. /// @@ -1502,6 +1610,42 @@ public unsafe partial struct UInt1x4 /// 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 UInt1x4 operator >>(UInt1x4 matrix, UInt1x4 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt1x4 operator >>>(UInt1x4 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt1x4 operator >>>(UInt1x4 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt1x4 operator >>>(UInt1x4 matrix, Int1x4 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt1x4 operator >>>(UInt1x4 matrix, UInt1x4 amount) => default; + /// /// Shifts left a value. /// @@ -1914,6 +2058,42 @@ public unsafe partial struct UInt2x1 /// 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 UInt2x1 operator >>(UInt2x1 matrix, UInt2x1 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2x1 operator >>>(UInt2x1 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2x1 operator >>>(UInt2x1 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2x1 operator >>>(UInt2x1 matrix, Int2x1 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2x1 operator >>>(UInt2x1 matrix, UInt2x1 amount) => default; + /// /// Shifts left a value. /// @@ -2363,6 +2543,42 @@ public unsafe partial struct UInt2x2 /// 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 UInt2x2 operator >>(UInt2x2 matrix, UInt2x2 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2x2 operator >>>(UInt2x2 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2x2 operator >>>(UInt2x2 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2x2 operator >>>(UInt2x2 matrix, Int2x2 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2x2 operator >>>(UInt2x2 matrix, UInt2x2 amount) => default; + /// /// Shifts left a value. /// @@ -2832,6 +3048,42 @@ public unsafe partial struct UInt2x3 /// 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 UInt2x3 operator >>(UInt2x3 matrix, UInt2x3 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2x3 operator >>>(UInt2x3 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2x3 operator >>>(UInt2x3 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2x3 operator >>>(UInt2x3 matrix, Int2x3 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2x3 operator >>>(UInt2x3 matrix, UInt2x3 amount) => default; + /// /// Shifts left a value. /// @@ -3327,6 +3579,42 @@ public unsafe partial struct UInt2x4 /// 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 UInt2x4 operator >>(UInt2x4 matrix, UInt2x4 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2x4 operator >>>(UInt2x4 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2x4 operator >>>(UInt2x4 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2x4 operator >>>(UInt2x4 matrix, Int2x4 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt2x4 operator >>>(UInt2x4 matrix, UInt2x4 amount) => default; + /// /// Shifts left a value. /// @@ -3745,6 +4033,42 @@ public unsafe partial struct UInt3x1 /// 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 UInt3x1 operator >>(UInt3x1 matrix, UInt3x1 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3x1 operator >>>(UInt3x1 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3x1 operator >>>(UInt3x1 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3x1 operator >>>(UInt3x1 matrix, Int3x1 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3x1 operator >>>(UInt3x1 matrix, UInt3x1 amount) => default; + /// /// Shifts left a value. /// @@ -4221,6 +4545,42 @@ public unsafe partial struct UInt3x2 /// 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 UInt3x2 operator >>(UInt3x2 matrix, UInt3x2 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3x2 operator >>>(UInt3x2 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3x2 operator >>>(UInt3x2 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3x2 operator >>>(UInt3x2 matrix, Int3x2 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3x2 operator >>>(UInt3x2 matrix, UInt3x2 amount) => default; + /// /// Shifts left a value. /// @@ -4730,6 +5090,42 @@ public unsafe partial struct UInt3x3 /// 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 UInt3x3 operator >>(UInt3x3 matrix, UInt3x3 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3x3 operator >>>(UInt3x3 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3x3 operator >>>(UInt3x3 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3x3 operator >>>(UInt3x3 matrix, Int3x3 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3x3 operator >>>(UInt3x3 matrix, UInt3x3 amount) => default; + /// /// Shifts left a value. /// @@ -5278,6 +5674,42 @@ public unsafe partial struct UInt3x4 /// 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 UInt3x4 operator >>(UInt3x4 matrix, UInt3x4 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3x4 operator >>>(UInt3x4 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3x4 operator >>>(UInt3x4 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3x4 operator >>>(UInt3x4 matrix, Int3x4 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt3x4 operator >>>(UInt3x4 matrix, UInt3x4 amount) => default; + /// /// Shifts left a value. /// @@ -5708,6 +6140,42 @@ public unsafe partial struct UInt4x1 /// 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 UInt4x1 operator >>(UInt4x1 matrix, UInt4x1 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4x1 operator >>>(UInt4x1 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4x1 operator >>>(UInt4x1 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4x1 operator >>>(UInt4x1 matrix, Int4x1 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4x1 operator >>>(UInt4x1 matrix, UInt4x1 amount) => default; + /// /// Shifts left a value. /// @@ -6211,6 +6679,42 @@ public unsafe partial struct UInt4x2 /// 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 UInt4x2 operator >>(UInt4x2 matrix, UInt4x2 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4x2 operator >>>(UInt4x2 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4x2 operator >>>(UInt4x2 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4x2 operator >>>(UInt4x2 matrix, Int4x2 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4x2 operator >>>(UInt4x2 matrix, UInt4x2 amount) => default; + /// /// Shifts left a value. /// @@ -6760,6 +7264,42 @@ public unsafe partial struct UInt4x3 /// 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 UInt4x3 operator >>(UInt4x3 matrix, UInt4x3 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4x3 operator >>>(UInt4x3 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4x3 operator >>>(UInt4x3 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4x3 operator >>>(UInt4x3 matrix, Int4x3 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4x3 operator >>>(UInt4x3 matrix, UInt4x3 amount) => default; + /// /// Shifts left a value. /// @@ -7361,6 +7901,42 @@ public unsafe partial struct UInt4x4 /// 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 UInt4x4 operator >>(UInt4x4 matrix, UInt4x4 amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4x4 operator >>>(UInt4x4 matrix, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4x4 operator >>>(UInt4x4 matrix, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4x4 operator >>>(UInt4x4 matrix, Int4x4 amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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 UInt4x4 operator >>>(UInt4x4 matrix, UInt4x4 amount) => default; + /// /// Shifts left a value. /// diff --git a/src/ComputeSharp.Core/Primitives/VectorType.ttinclude b/src/ComputeSharp.Core/Primitives/VectorType.ttinclude index 88f9ac0b..a0bcea0e 100644 --- a/src/ComputeSharp.Core/Primitives/VectorType.ttinclude +++ b/src/ComputeSharp.Core/Primitives/VectorType.ttinclude @@ -516,6 +516,42 @@ public unsafe partial struct <#=typeName#> /// 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#> <#=argumentName#>, UInt<#=i#> amount) => default; + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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#> <#=argumentName#>, int amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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#> <#=argumentName#>, uint amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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#> <#=argumentName#>, Int<#=i#> amount) => default; + + /// + /// Shifts right a value without considering sign. + /// + /// The value to shift right. + /// The amount to shift each element right by. + /// The result of shifting right by . + /// 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#> <#=argumentName#>, UInt<#=i#> amount) => default; + /// /// Shifts left a value. /// diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/ComputeSharp.SourceGeneration.Hlsl.projitems b/src/ComputeSharp.SourceGeneration.Hlsl/ComputeSharp.SourceGeneration.Hlsl.projitems index 0124d463..253adccf 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/ComputeSharp.SourceGeneration.Hlsl.projitems +++ b/src/ComputeSharp.SourceGeneration.Hlsl/ComputeSharp.SourceGeneration.Hlsl.projitems @@ -32,6 +32,7 @@ + diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownOperators.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownOperators.cs index 3403bac6..b800f567 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownOperators.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownOperators.cs @@ -3,6 +3,8 @@ using System.Collections.Generic; using System.Linq; using System.Reflection; using ComputeSharp.Core.Intrinsics.Attributes; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.Operations; namespace ComputeSharp.SourceGeneration.Mappings; @@ -47,6 +49,16 @@ internal static partial class HlslKnownOperators return knownOperators; } + /// + /// Checks whether a given operator kind represents a candidate special intrinsic that can handle. + /// + /// The input operator kind to check. + /// Whether is a candidate operator for a special intrinsic to rewrite. + public static bool IsCandidateOperator(BinaryOperatorKind operatorKind) + { + return operatorKind is BinaryOperatorKind.Multiply or BinaryOperatorKind.UnsignedRightShift; + } + /// /// Tries to get the mapped HLSL-compatible method name for the input operator name. /// diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs index 4d62654f..0dad51aa 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/Mappings/HlslKnownTypes.cs @@ -237,6 +237,38 @@ internal static partial class HlslKnownTypes return false; } + /// + /// Checks whether a given type name represents a well known signed integer type. + /// + /// The type name to check. + /// Whether represents a well known signed integer type. + public static bool IsKnownSignedIntegerType(string typeName) + { + return typeName is + "System.Int32" or + "ComputeSharp.Int2" or "ComputeSharp.Int3" or "ComputeSharp.Int4" or + "ComputeSharp.Int1x1" or "ComputeSharp.Int1x2" or "ComputeSharp.Int1x3" or "ComputeSharp.Int1x4" or + "ComputeSharp.Int2x1" or "ComputeSharp.Int2x2" or "ComputeSharp.Int2x3" or "ComputeSharp.Int2x4" or + "ComputeSharp.Int3x1" or "ComputeSharp.Int3x2" or "ComputeSharp.Int3x3" or "ComputeSharp.Int3x4" or + "ComputeSharp.Int4x1" or "ComputeSharp.Int4x2" or "ComputeSharp.Int4x3" or "ComputeSharp.Int4x4"; + } + + /// + /// Checks whether a given type name represents a well known unsigned integer type. + /// + /// The type name to check. + /// Whether represents a well known known integer type. + public static bool IsKnownUnsignedIntegerType(string typeName) + { + return typeName is + "System.UInt32" or + "ComputeSharp.UInt2" or "ComputeSharp.UInt3" or "ComputeSharp.UInt4" or + "ComputeSharp.UInt1x1" or "ComputeSharp.UInt1x2" or "ComputeSharp.UInt1x3" or "ComputeSharp.UInt1x4" or + "ComputeSharp.UInt2x1" or "ComputeSharp.UInt2x2" or "ComputeSharp.UInt2x3" or "ComputeSharp.UInt2x4" or + "ComputeSharp.UInt3x1" or "ComputeSharp.UInt3x2" or "ComputeSharp.UInt3x3" or "ComputeSharp.UInt3x4" or + "ComputeSharp.UInt4x1" or "ComputeSharp.UInt4x2" or "ComputeSharp.UInt4x3" or "ComputeSharp.UInt4x4"; + } + /// /// Gets the mapped HLSL-compatible type name for the input type symbol. /// diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxProcessors/HlslOperatorsSyntaxProcessor.cs b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxProcessors/HlslOperatorsSyntaxProcessor.cs new file mode 100644 index 00000000..f1f77a51 --- /dev/null +++ b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxProcessors/HlslOperatorsSyntaxProcessor.cs @@ -0,0 +1,242 @@ +using System; +using System.Diagnostics.CodeAnalysis; +using System.Linq; +using System.Threading; +using ComputeSharp.SourceGeneration.Extensions; +using ComputeSharp.SourceGeneration.Mappings; +using Microsoft.CodeAnalysis; +using Microsoft.CodeAnalysis.CSharp; +using Microsoft.CodeAnalysis.CSharp.Syntax; +using Microsoft.CodeAnalysis.Operations; +using static Microsoft.CodeAnalysis.CSharp.SyntaxFactory; + +namespace ComputeSharp.SourceGeneration.SyntaxProcessors; + +/// +/// A processor responsible for processing special HLSL operators. +/// +internal static class HlslOperatorsSyntaxProcessor +{ + /// + /// Tries to process a custom operator from an input expression node. + /// + /// The original syntax node being processed. + /// The updated node to propagate and potentially rewrite. + /// The instance to use. + /// The cancellation token for the operation. + /// The rewritten node, if successfully produced. + /// Whether a rewritten node was produced. + public static bool TryProcessCustomOperator( + ExpressionSyntax originalNode, + ExpressionSyntax updatedNode, + SemanticModel semanticModel, + CancellationToken token, + [NotNullWhen(true)] out ExpressionSyntax? rewrittenNode) + { + // Make sure we can correctly retrieve an operation first + if (semanticModel.GetOperation(originalNode, token) is not IOperation operation) + { + rewrittenNode = null; + + return false; + } + + // Next, try to get the operation info + if (!TryGetBinaryOperationInfo( + operation, + out BinaryOperatorKind operationKind, + out IOperation? leftOperation, + out IOperation? rightOperation, + out IMethodSymbol? operatorMethod)) + { + rewrittenNode = null; + + return false; + } + + // Pre-filter candidates based on the operation type, to minimize allocations + if (!HlslKnownOperators.IsCandidateOperator(operationKind)) + { + rewrittenNode = null; + + return false; + } + + // Get the binary nodes, in case we need them for rewriting + GetBinaryNodes(updatedNode, out ExpressionSyntax leftNode, out ExpressionSyntax rightNode); + + // First, try to handle unsigned right shift operators, which are a special case. + // This is because they require explicit rewriting, and not just a change in method name. + // We need to do this after pre-filtering, as this is also supported on 'int' and 'uint'. + if (operationKind == BinaryOperatorKind.UnsignedRightShift) + { + string typeName = leftOperation.Type!.GetFullyQualifiedMetadataName(); + + // If the left operand is already unsigned, there's no rewriting to do other + // than just replacing '>>>' with '>>', since the former doesn't exist in HLSL. + if (HlslKnownTypes.IsKnownUnsignedIntegerType(typeName)) + { + rewrittenNode = BinaryExpression(SyntaxKind.RightShiftExpression, leftNode, rightNode); + + WrapRewrittenNodeIfNeeded(updatedNode, operation, ref rewrittenNode); + + return true; + } + + // Rewrite the syntax tree as follows: + // + // x >>> y => (TYPE_X)((UNSIGNED_TYPE_X)x >> y) + if (HlslKnownTypes.IsKnownSignedIntegerType(typeName)) + { + string typeNameOfLeftOperand = HlslKnownTypes.GetMappedName(typeName); + string unsignedTypeName = 'u' + typeNameOfLeftOperand; + + rewrittenNode = + CastExpression( + IdentifierName(typeNameOfLeftOperand), + ParenthesizedExpression( + BinaryExpression( + SyntaxKind.RightShiftExpression, + CastExpression(IdentifierName(unsignedTypeName), leftNode), + rightNode))); + + WrapRewrittenNodeIfNeeded(updatedNode, operation, ref rewrittenNode); + + return true; + } + + // All other cases are unsupported, so just return the original tree + rewrittenNode = null; + + return false; + } + + // Also pre-filter just operators that are defined in ComputeSharp primitives + if (operatorMethod is not { ContainingType.ContainingNamespace.Name: "ComputeSharp" }) + { + rewrittenNode = null; + + return false; + } + + // If the operator is indeed an HLSL overload, replace the expression with an invocation. + // That is, do the following transformation: + // + // x * y => (x, y) + if (HlslKnownOperators.TryGetMappedName( + operatorMethod.GetFullyQualifiedMetadataName(), + operatorMethod.Parameters.Select(static p => p.Type.Name), + out string? mapped)) + { + rewrittenNode = + InvocationExpression(IdentifierName(mapped!)) + .AddArgumentListArguments( + Argument(leftNode), + Argument(rightNode)); + + WrapRewrittenNodeIfNeeded(updatedNode, operation, ref rewrittenNode); + + return true; + } + + rewrittenNode = null; + + return false; + } + + /// + /// Tries to get the info for a given binary operation. + /// + /// The input operation to extract info from. + /// The resulting kind for . + /// The resulting left child operation, or the target. + /// The resulting right child operation. + /// The target method being invoked, if any. + /// Whether the input operation is supported and info could be retrieved. + private static bool TryGetBinaryOperationInfo( + IOperation operation, + out BinaryOperatorKind operationKind, + [NotNullWhen(true)] out IOperation? leftOrTargetOperation, + [NotNullWhen(true)] out IOperation? rightOperation, + out IMethodSymbol? targetMethod) + { + switch (operation) + { + case IBinaryOperation binaryOperation: + operationKind = binaryOperation.OperatorKind; + leftOrTargetOperation = binaryOperation.LeftOperand; + rightOperation = binaryOperation.RightOperand; + targetMethod = binaryOperation.OperatorMethod; + + return true; + case ICompoundAssignmentOperation assignmentOperation: + operationKind = assignmentOperation.OperatorKind; + leftOrTargetOperation = assignmentOperation.Target; + rightOperation = assignmentOperation.Value; + targetMethod = assignmentOperation.OperatorMethod; + + return true; + default: + operationKind = BinaryOperatorKind.None; + leftOrTargetOperation = null; + rightOperation = null; + targetMethod = null; + + return false; + } + } + + /// + /// Extracts the binary children from an expression node. + /// + /// The input expression node. + /// The resulting left child node. + /// The resulting right child node. + /// Thrown if is of an unsupported type. + private static void GetBinaryNodes( + ExpressionSyntax node, + out ExpressionSyntax left, + out ExpressionSyntax right) + { + switch (node) + { + case BinaryExpressionSyntax binaryExpression: + left = binaryExpression.Left; + right = binaryExpression.Right; + break; + case AssignmentExpressionSyntax assignmentExpression: + left = assignmentExpression.Left; + right = assignmentExpression.Right; + break; + default: + throw new NotSupportedException("Invalid input expression node."); + } + } + + /// + /// Wraps a rewritten node if needed, depending on the operation type. + /// + /// The updated node to propagate and potentially rewrite. + /// The input operation being processed. + /// The rewritten node, to wrap if needed. + /// Throw if the input operation isn't valid for the input expression node. + private static void WrapRewrittenNodeIfNeeded( + ExpressionSyntax updatedNode, + IOperation operation, + ref ExpressionSyntax rewrittenNode) + { + switch (operation) + { + case IBinaryOperation: + break; + case ICompoundAssignmentOperation when updatedNode is AssignmentExpressionSyntax assignmentNode: + rewrittenNode = AssignmentExpression( + SyntaxKind.SimpleAssignmentExpression, + assignmentNode.Left, + rewrittenNode); + break; + default: + throw new NotSupportedException("Invalid input operation type."); + } + } +} \ No newline at end of file diff --git a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/HlslSourceRewriter.cs b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/HlslSourceRewriter.cs index 84734904..98e79d17 100644 --- a/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/HlslSourceRewriter.cs +++ b/src/ComputeSharp.SourceGeneration.Hlsl/SyntaxRewriters/HlslSourceRewriter.cs @@ -1,12 +1,12 @@ using System; using System.Collections.Generic; using System.Globalization; -using System.Linq; using System.Threading; using ComputeSharp.SourceGeneration.Extensions; using ComputeSharp.SourceGeneration.Helpers; using ComputeSharp.SourceGeneration.Mappings; using ComputeSharp.SourceGeneration.Models; +using ComputeSharp.SourceGeneration.SyntaxProcessors; using Microsoft.CodeAnalysis; using Microsoft.CodeAnalysis.CSharp; using Microsoft.CodeAnalysis.CSharp.Syntax; @@ -347,23 +347,14 @@ internal abstract partial class HlslSourceRewriter( AssignmentExpressionSyntax updatedNode = (AssignmentExpressionSyntax)base.VisitAssignmentExpression(node)!; - if (SemanticModel.For(node).GetOperation(node, CancellationToken) is ICompoundAssignmentOperation { OperatorMethod: { ContainingType.ContainingNamespace.Name: "ComputeSharp" } method }) + if (HlslOperatorsSyntaxProcessor.TryProcessCustomOperator( + originalNode: node, + updatedNode: updatedNode, + semanticModel: SemanticModel.For(node), + token: CancellationToken, + rewrittenNode: out ExpressionSyntax? rewrittenNode)) { - // If the compound assignment is using an HLSL operator, replace the expression with an invocation and assignment. - // That is, do the following transformation: - // - // x *= y => x = (x, y) - if (HlslKnownOperators.TryGetMappedName(method.GetFullyQualifiedMetadataName(), method.Parameters.Select(static p => p.Type.Name), out string? mapped)) - { - return - AssignmentExpression( - SyntaxKind.SimpleAssignmentExpression, - updatedNode.Left, - InvocationExpression(IdentifierName(mapped!)) - .AddArgumentListArguments( - Argument(updatedNode.Left), - Argument(updatedNode.Right))); - } + return rewrittenNode; } return updatedNode; @@ -376,21 +367,14 @@ internal abstract partial class HlslSourceRewriter( BinaryExpressionSyntax updatedNode = (BinaryExpressionSyntax)base.VisitBinaryExpression(node)!; - // Process binary operations to see if the target operator method is an intrinsic - if (SemanticModel.For(node).GetOperation(node, CancellationToken) is IBinaryOperation { OperatorMethod: { ContainingType.ContainingNamespace.Name: "ComputeSharp" } method }) + if (HlslOperatorsSyntaxProcessor.TryProcessCustomOperator( + originalNode: node, + updatedNode: updatedNode, + semanticModel: SemanticModel.For(node), + token: CancellationToken, + rewrittenNode: out ExpressionSyntax? rewrittenNode)) { - // If the operator is indeed an HLSL overload, replace the expression with an invocation. - // That is, do the following transformation: - // - // x * y => (x, y) - if (HlslKnownOperators.TryGetMappedName(method.GetFullyQualifiedMetadataName(), method.Parameters.Select(static p => p.Type.Name), out string? mapped)) - { - return - InvocationExpression(IdentifierName(mapped!)) - .AddArgumentListArguments( - Argument(updatedNode.Left), - Argument(updatedNode.Right)); - } + return rewrittenNode; } return updatedNode; diff --git a/tests/ComputeSharp.Tests/ShaderRewriterTests.cs b/tests/ComputeSharp.Tests/ShaderRewriterTests.cs index 7f19cc08..b2c55d23 100644 --- a/tests/ComputeSharp.Tests/ShaderRewriterTests.cs +++ b/tests/ComputeSharp.Tests/ShaderRewriterTests.cs @@ -397,6 +397,163 @@ public partial class ShaderRewriterTests } } + [CombinatorialTestMethod] + [AllDevices] + public void UnsignedRightShiftOperators(Device device) + { + int[] data = new int[18]; + + new Random(42).NextBytes(data.AsSpan(0, 14).Cast()); + + using ReadWriteBuffer buffer = device.Get().AllocateReadWriteBuffer(data); + + device.Get().For(1, new UnsignedRightShiftOperatorsShader(buffer)); + + int[] results = buffer.ToArray(); + + int2 a = new(data[0], data[1]); + uint2 b = new((uint)data[2], (uint)data[3]); + int2 e = new(1, 2); + + int2 a_shift_int = new(a.X >>> 2, a.Y >>> 2); + + uint2 b_shift_int2 = new(b.X >>> e.X, b.Y >>> e.Y); + + Assert.AreEqual(results[14], a_shift_int.X); + Assert.AreEqual(results[15], a_shift_int.Y); + + Assert.AreEqual(results[16], (int)b_shift_int2.X); + Assert.AreEqual(results[17], (int)b_shift_int2.Y); + + ShaderInfo info = ReflectionServices.GetShaderInfo(); + + Assert.AreEqual( + """ + #define __GroupSize__get_X 64 + #define __GroupSize__get_Y 1 + #define __GroupSize__get_Z 1 + + cbuffer _ : register(b0) + { + uint __x; + uint __y; + uint __z; + } + + RWStructuredBuffer __reserved__buffer : register(u0); + + [NumThreads(__GroupSize__get_X, __GroupSize__get_Y, __GroupSize__get_Z)] + void Execute(uint3 ThreadIds : SV_DispatchThreadID) + { + if (ThreadIds.x < __x && ThreadIds.y < __y && ThreadIds.z < __z) + { + int2 a = int2(__reserved__buffer[0], __reserved__buffer[1]); + uint2 b = uint2((uint)__reserved__buffer[2], (uint)__reserved__buffer[3]); + int2x3 c = int2x3((int)__reserved__buffer[4], (int)__reserved__buffer[5], (int)__reserved__buffer[6], (int)__reserved__buffer[7], (int)__reserved__buffer[8], (int)__reserved__buffer[9]); + uint2x2 d = uint2x2((uint)(uint)__reserved__buffer[10], (uint)(uint)__reserved__buffer[11], (uint)(uint)__reserved__buffer[12], (uint)(uint)__reserved__buffer[13]); + int2 e = int2(1, 2); + uint2 f = uint2(2, 1); + int2x3 g = int2x3((int)1, (int)2, (int)3, (int)4, (int)5, (int)6); + uint2x2 h = uint2x2((uint)1, (uint)2, (uint)3, (uint)4); + int2 a_shift_int = (int2)((uint2)a >> 2); + int2 a_shift_uint = (int2)((uint2)a >> 2u); + int2 a_shift_int2 = (int2)((uint2)a >> e); + int2 a_shift_uint2 = (int2)((uint2)a >> f); + int2 a_copy = a; + a_copy = (int2)((uint2)a_copy >> 2); + a_copy = (int2)((uint2)a_copy >> 1u); + a_copy = (int2)((uint2)a_copy >> e); + a_copy = (int2)((uint2)a_copy >> f); + uint2 b_shift_int = b >> 2; + uint2 b_shift_uint = b >> 2u; + uint2 b_shift_int2 = b >> e; + uint2 b_shift_uint2 = b >> f; + uint2 b_copy = b; + b_copy = b_copy >> 2; + b_copy = b_copy >> 1u; + b_copy = b_copy >> e; + b_copy = b_copy >> f; + int2x3 c_shift_int = (int2x3)((uint2x3)c >> g); + int2x3 c_shift_uint = (int2x3)((uint2x3)c >> (uint2x3)g); + c = (int2x3)((uint2x3)c >> 2); + c = (int2x3)((uint2x3)c >> 1u); + uint2x2 d_shift_int = d >> (int2x2)h; + uint2x2 d_shift_uint = d >> h; + d = d >> 1; + d = d >> 2u; + __reserved__buffer[14] = a_shift_int.x; + __reserved__buffer[15] = a_shift_int.y; + __reserved__buffer[16] = (int)b_shift_int2.x; + __reserved__buffer[17] = (int)b_shift_int2.y; + } + } + """, + info.HlslSource); + } + +#pragma warning disable IDE0059 + [AutoConstructor] + [ThreadGroupSize(DefaultThreadGroupSizes.X)] + [GeneratedComputeShaderDescriptor] + internal readonly partial struct UnsignedRightShiftOperatorsShader : IComputeShader + { + public readonly ReadWriteBuffer buffer; + + public void Execute() + { + int2 a = new(buffer[0], buffer[1]); + uint2 b = new((uint)buffer[2], (uint)buffer[3]); + int2x3 c = new(buffer[4], buffer[5], buffer[6], buffer[7], buffer[8], buffer[9]); + uint2x2 d = new((uint)buffer[10], (uint)buffer[11], (uint)buffer[12], (uint)buffer[13]); + int2 e = new(1, 2); + uint2 f = new(2, 1); + int2x3 g = new(1, 2, 3, 4, 5, 6); + uint2x2 h = new(1, 2, 3, 4); + + int2 a_shift_int = a >>> 2; + int2 a_shift_uint = a >>> 2u; + int2 a_shift_int2 = a >>> e; + int2 a_shift_uint2 = a >>> f; + + int2 a_copy = a; + + a_copy >>>= 2; + a_copy >>>= 1u; + a_copy >>>= e; + a_copy >>>= f; + + uint2 b_shift_int = b >>> 2; + uint2 b_shift_uint = b >>> 2u; + uint2 b_shift_int2 = b >>> e; + uint2 b_shift_uint2 = b >>> f; + + uint2 b_copy = b; + + b_copy >>>= 2; + b_copy >>>= 1u; + b_copy >>>= e; + b_copy >>>= f; + + int2x3 c_shift_int = c >>> g; + int2x3 c_shift_uint = c >>> (uint2x3)g; + + c >>>= 2; + c >>>= 1u; + + uint2x2 d_shift_int = d >>> (int2x2)h; + uint2x2 d_shift_uint = d >>> h; + + d >>>= 1; + d >>>= 2u; + + buffer[14] = a_shift_int.X; + buffer[15] = a_shift_int.Y; + buffer[16] = (int)b_shift_int2.X; + buffer[17] = (int)b_shift_int2.Y; + } + } +#pragma warning restore IDE0059 + [CombinatorialTestMethod] [AllDevices] public void ToBooleanConversionHlslIntrinsics(Device device)