diff --git a/src/ComputeSharp.Core/Primitives/Bool/Bool2.cs b/src/ComputeSharp.Core/Primitives/Bool/Bool2.cs index b9305ab0..c450e9f8 100644 --- a/src/ComputeSharp.Core/Primitives/Bool/Bool2.cs +++ b/src/ComputeSharp.Core/Primitives/Bool/Bool2.cs @@ -7,16 +7,6 @@ namespace ComputeSharp; /// public partial struct Bool2 { - /// - /// Gets an value with all components set to . - /// - public static Bool2 False => false; - - /// - /// Gets an value with all components set to . - /// - public static Bool2 True => true; - /// /// Gets an value with the component set to , and the others to . /// diff --git a/src/ComputeSharp.Core/Primitives/Bool/Bool2.g.cs b/src/ComputeSharp.Core/Primitives/Bool/Bool2.g.cs index 75399fac..5eb8866a 100644 --- a/src/ComputeSharp.Core/Primitives/Bool/Bool2.g.cs +++ b/src/ComputeSharp.Core/Primitives/Bool/Bool2.g.cs @@ -32,6 +32,16 @@ public unsafe partial struct Bool2 /// 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 readonly ref bool this[int i] => ref *(bool*)UndefinedData; + /// + /// Gets a value with all components set to . + /// + public static Bool2 False => false; + + /// + /// Gets a value with all components set to . + /// + public static Bool2 True => true; + /// /// Gets a reference to the value representing the X component. /// diff --git a/src/ComputeSharp.Core/Primitives/Bool/Bool3.cs b/src/ComputeSharp.Core/Primitives/Bool/Bool3.cs index 34cdffc1..c70622e5 100644 --- a/src/ComputeSharp.Core/Primitives/Bool/Bool3.cs +++ b/src/ComputeSharp.Core/Primitives/Bool/Bool3.cs @@ -7,16 +7,6 @@ namespace ComputeSharp; /// public partial struct Bool3 { - /// - /// Gets an value with all components set to . - /// - public static Bool3 False => false; - - /// - /// Gets an value with all components set to . - /// - public static Bool3 True => true; - /// /// Gets an value with the component set to , and the others to . /// diff --git a/src/ComputeSharp.Core/Primitives/Bool/Bool3.g.cs b/src/ComputeSharp.Core/Primitives/Bool/Bool3.g.cs index 87322361..664ec6ce 100644 --- a/src/ComputeSharp.Core/Primitives/Bool/Bool3.g.cs +++ b/src/ComputeSharp.Core/Primitives/Bool/Bool3.g.cs @@ -35,6 +35,16 @@ public unsafe partial struct Bool3 /// 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 readonly ref bool this[int i] => ref *(bool*)UndefinedData; + /// + /// Gets a value with all components set to . + /// + public static Bool3 False => false; + + /// + /// Gets a value with all components set to . + /// + public static Bool3 True => true; + /// /// Gets a reference to the value representing the X component. /// diff --git a/src/ComputeSharp.Core/Primitives/Bool/Bool4.cs b/src/ComputeSharp.Core/Primitives/Bool/Bool4.cs index fcf9f11a..08ec4fdf 100644 --- a/src/ComputeSharp.Core/Primitives/Bool/Bool4.cs +++ b/src/ComputeSharp.Core/Primitives/Bool/Bool4.cs @@ -7,16 +7,6 @@ namespace ComputeSharp; /// public partial struct Bool4 { - /// - /// Gets an value with all components set to . - /// - public static Bool4 False => false; - - /// - /// Gets an value with all components set to . - /// - public static Bool4 True => true; - /// /// Gets an value with the component set to , and the others to . /// diff --git a/src/ComputeSharp.Core/Primitives/Bool/Bool4.g.cs b/src/ComputeSharp.Core/Primitives/Bool/Bool4.g.cs index c7728eb3..909ba0e6 100644 --- a/src/ComputeSharp.Core/Primitives/Bool/Bool4.g.cs +++ b/src/ComputeSharp.Core/Primitives/Bool/Bool4.g.cs @@ -38,6 +38,16 @@ public unsafe partial struct Bool4 /// 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 readonly ref bool this[int i] => ref *(bool*)UndefinedData; + /// + /// Gets a value with all components set to . + /// + public static Bool4 False => false; + + /// + /// Gets a value with all components set to . + /// + public static Bool4 True => true; + /// /// Gets a reference to the value representing the X component. /// diff --git a/src/ComputeSharp.Core/Primitives/Double/Double2.cs b/src/ComputeSharp.Core/Primitives/Double/Double2.cs index e43f3e40..24a3b6de 100644 --- a/src/ComputeSharp.Core/Primitives/Double/Double2.cs +++ b/src/ComputeSharp.Core/Primitives/Double/Double2.cs @@ -7,16 +7,6 @@ namespace ComputeSharp; /// public partial struct Double2 { - /// - /// Gets an value with all components set to 0. - /// - public static Double2 Zero => 0; - - /// - /// Gets an value with all components set to 1. - /// - public static Double2 One => 1; - /// /// Gets an value with the component set to 1, and the others to 0. /// diff --git a/src/ComputeSharp.Core/Primitives/Double/Double2.g.cs b/src/ComputeSharp.Core/Primitives/Double/Double2.g.cs index 0717e604..ff5577d8 100644 --- a/src/ComputeSharp.Core/Primitives/Double/Double2.g.cs +++ b/src/ComputeSharp.Core/Primitives/Double/Double2.g.cs @@ -37,6 +37,16 @@ public unsafe partial struct Double2 /// 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 readonly ref double this[int i] => ref *(double*)UndefinedData; + /// + /// Gets a value with all components set to 0. + /// + public static Double2 Zero => 0; + + /// + /// Gets a value with all components set to 1. + /// + public static Double2 One => 1; + /// /// Gets a reference to the value representing the X component. /// diff --git a/src/ComputeSharp.Core/Primitives/Double/Double3.cs b/src/ComputeSharp.Core/Primitives/Double/Double3.cs index 326a25f5..bdf8b4f6 100644 --- a/src/ComputeSharp.Core/Primitives/Double/Double3.cs +++ b/src/ComputeSharp.Core/Primitives/Double/Double3.cs @@ -7,16 +7,6 @@ namespace ComputeSharp; /// public partial struct Double3 { - /// - /// Gets an value with all components set to 0. - /// - public static Double3 Zero => 0; - - /// - /// Gets an value with all components set to 1. - /// - public static Double3 One => 1; - /// /// Gets an value with the component set to 1, and the others to 0. /// diff --git a/src/ComputeSharp.Core/Primitives/Double/Double3.g.cs b/src/ComputeSharp.Core/Primitives/Double/Double3.g.cs index 42662832..2d80bffd 100644 --- a/src/ComputeSharp.Core/Primitives/Double/Double3.g.cs +++ b/src/ComputeSharp.Core/Primitives/Double/Double3.g.cs @@ -40,6 +40,16 @@ public unsafe partial struct Double3 /// 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 readonly ref double this[int i] => ref *(double*)UndefinedData; + /// + /// Gets a value with all components set to 0. + /// + public static Double3 Zero => 0; + + /// + /// Gets a value with all components set to 1. + /// + public static Double3 One => 1; + /// /// Gets a reference to the value representing the X component. /// diff --git a/src/ComputeSharp.Core/Primitives/Double/Double4.cs b/src/ComputeSharp.Core/Primitives/Double/Double4.cs index 634dc47a..f0dc3e4f 100644 --- a/src/ComputeSharp.Core/Primitives/Double/Double4.cs +++ b/src/ComputeSharp.Core/Primitives/Double/Double4.cs @@ -7,16 +7,6 @@ namespace ComputeSharp; /// public partial struct Double4 { - /// - /// Gets an value with all components set to 0. - /// - public static Double4 Zero => 0; - - /// - /// Gets an value with all components set to 1. - /// - public static Double4 One => 1; - /// /// Gets an value with the component set to 1, and the others to 0. /// diff --git a/src/ComputeSharp.Core/Primitives/Double/Double4.g.cs b/src/ComputeSharp.Core/Primitives/Double/Double4.g.cs index edbb0676..36e83179 100644 --- a/src/ComputeSharp.Core/Primitives/Double/Double4.g.cs +++ b/src/ComputeSharp.Core/Primitives/Double/Double4.g.cs @@ -43,6 +43,16 @@ public unsafe partial struct Double4 /// 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 readonly ref double this[int i] => ref *(double*)UndefinedData; + /// + /// Gets a value with all components set to 0. + /// + public static Double4 Zero => 0; + + /// + /// Gets a value with all components set to 1. + /// + public static Double4 One => 1; + /// /// Gets a reference to the value representing the X component. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float2.cs b/src/ComputeSharp.Core/Primitives/Float/Float2.cs index b8e667cb..91cddeb4 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float2.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float2.cs @@ -9,16 +9,6 @@ namespace ComputeSharp; /// public partial struct Float2 { - /// - /// Gets an value with all components set to 0. - /// - public static Float2 Zero => 0; - - /// - /// Gets an value with all components set to 1. - /// - public static Float2 One => 1; - /// /// Gets an value with the component set to 1, and the others to 0. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float2.g.cs b/src/ComputeSharp.Core/Primitives/Float/Float2.g.cs index 9094132f..806a8f15 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float2.g.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float2.g.cs @@ -37,6 +37,16 @@ public unsafe partial struct Float2 /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public readonly ref float this[int i] => ref *(float*)UndefinedData; + /// + /// Gets a value with all components set to 0. + /// + public static Float2 Zero => 0; + + /// + /// Gets a value with all components set to 1. + /// + public static Float2 One => 1; + /// /// Gets a reference to the value representing the X component. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float3.cs b/src/ComputeSharp.Core/Primitives/Float/Float3.cs index 16693e7e..a40f2644 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float3.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float3.cs @@ -9,16 +9,6 @@ namespace ComputeSharp; /// public partial struct Float3 { - /// - /// Gets an value with all components set to 0. - /// - public static Float3 Zero => 0; - - /// - /// Gets an value with all components set to 1. - /// - public static Float3 One => 1; - /// /// Gets an value with the component set to 1, and the others to 0. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float3.g.cs b/src/ComputeSharp.Core/Primitives/Float/Float3.g.cs index 557b29b4..044e1461 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float3.g.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float3.g.cs @@ -40,6 +40,16 @@ public unsafe partial struct Float3 /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public readonly ref float this[int i] => ref *(float*)UndefinedData; + /// + /// Gets a value with all components set to 0. + /// + public static Float3 Zero => 0; + + /// + /// Gets a value with all components set to 1. + /// + public static Float3 One => 1; + /// /// Gets a reference to the value representing the X component. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float4.cs b/src/ComputeSharp.Core/Primitives/Float/Float4.cs index 18a16673..c9eeb82a 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float4.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float4.cs @@ -9,16 +9,6 @@ namespace ComputeSharp; /// public partial struct Float4 { - /// - /// Gets an value with all components set to 0. - /// - public static Float4 Zero => 0; - - /// - /// Gets an value with all components set to 1. - /// - public static Float4 One => 1; - /// /// Gets an value with the component set to 1, and the others to 0. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float4.g.cs b/src/ComputeSharp.Core/Primitives/Float/Float4.g.cs index e011344e..bc7cf39e 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float4.g.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float4.g.cs @@ -43,6 +43,16 @@ public unsafe partial struct Float4 /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. public readonly ref float this[int i] => ref *(float*)UndefinedData; + /// + /// Gets a value with all components set to 0. + /// + public static Float4 Zero => 0; + + /// + /// Gets a value with all components set to 1. + /// + public static Float4 One => 1; + /// /// Gets a reference to the value representing the X component. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int2.cs b/src/ComputeSharp.Core/Primitives/Int/Int2.cs index 2441d744..63779ad1 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int2.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int2.cs @@ -7,16 +7,6 @@ namespace ComputeSharp; /// public partial struct Int2 { - /// - /// Gets an value with all components set to 0. - /// - public static Int2 Zero => 0; - - /// - /// Gets an value with all components set to 1. - /// - public static Int2 One => 1; - /// /// Gets an value with the component set to 1, and the others to 0. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs b/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs index 27a71a8f..daee20be 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs @@ -37,6 +37,16 @@ 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 readonly ref int this[int i] => ref *(int*)UndefinedData; + /// + /// Gets a value with all components set to 0. + /// + public static Int2 Zero => 0; + + /// + /// Gets a value with all components set to 1. + /// + public static Int2 One => 1; + /// /// Gets a reference to the value representing the X component. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int3.cs b/src/ComputeSharp.Core/Primitives/Int/Int3.cs index 74f26765..f79f2076 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int3.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int3.cs @@ -7,16 +7,6 @@ namespace ComputeSharp; /// public partial struct Int3 { - /// - /// Gets an value with all components set to 0. - /// - public static Int3 Zero => 0; - - /// - /// Gets an value with all components set to 1. - /// - public static Int3 One => 1; - /// /// Gets an value with the component set to 1, and the others to 0. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs b/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs index a5d0d39b..3b6daff4 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs @@ -40,6 +40,16 @@ 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 readonly ref int this[int i] => ref *(int*)UndefinedData; + /// + /// Gets a value with all components set to 0. + /// + public static Int3 Zero => 0; + + /// + /// Gets a value with all components set to 1. + /// + public static Int3 One => 1; + /// /// Gets a reference to the value representing the X component. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int4.cs b/src/ComputeSharp.Core/Primitives/Int/Int4.cs index 744a6c7d..663cbd39 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int4.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int4.cs @@ -7,16 +7,6 @@ namespace ComputeSharp; /// public partial struct Int4 { - /// - /// Gets an value with all components set to 0. - /// - public static Int4 Zero => 0; - - /// - /// Gets an value with all components set to 1. - /// - public static Int4 One => 1; - /// /// Gets an value with the component set to 1, and the others to 0. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs b/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs index 408a4435..f2f80023 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs @@ -43,6 +43,16 @@ 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 readonly ref int this[int i] => ref *(int*)UndefinedData; + /// + /// Gets a value with all components set to 0. + /// + public static Int4 Zero => 0; + + /// + /// Gets a value with all components set to 1. + /// + public static Int4 One => 1; + /// /// Gets a reference to the value representing the X component. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt2.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt2.cs index 2cf71c34..d86c2177 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt2.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt2.cs @@ -7,16 +7,6 @@ namespace ComputeSharp; /// public partial struct UInt2 { - /// - /// Gets an value with all components set to 0. - /// - public static UInt2 Zero => 0; - - /// - /// Gets an value with all components set to 1. - /// - public static UInt2 One => 1; - /// /// Gets an value with the component set to 1, and the others to 0. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt2.g.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt2.g.cs index 454e74f3..5d5835ff 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt2.g.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt2.g.cs @@ -37,6 +37,16 @@ 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 readonly ref uint this[int i] => ref *(uint*)UndefinedData; + /// + /// Gets a value with all components set to 0. + /// + public static UInt2 Zero => 0; + + /// + /// Gets a value with all components set to 1. + /// + public static UInt2 One => 1; + /// /// Gets a reference to the value representing the X component. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt3.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt3.cs index 806a92ad..959d2a32 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt3.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt3.cs @@ -7,16 +7,6 @@ namespace ComputeSharp; /// public partial struct UInt3 { - /// - /// Gets an value with all components set to 0. - /// - public static UInt3 Zero => 0; - - /// - /// Gets an value with all components set to 1. - /// - public static UInt3 One => 1; - /// /// Gets an value with the component set to 1, and the others to 0. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt3.g.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt3.g.cs index d7e02e90..c393c643 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt3.g.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt3.g.cs @@ -40,6 +40,16 @@ 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 readonly ref uint this[int i] => ref *(uint*)UndefinedData; + /// + /// Gets a value with all components set to 0. + /// + public static UInt3 Zero => 0; + + /// + /// Gets a value with all components set to 1. + /// + public static UInt3 One => 1; + /// /// Gets a reference to the value representing the X component. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt4.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt4.cs index 2327cca4..1d5cd634 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt4.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt4.cs @@ -7,16 +7,6 @@ namespace ComputeSharp; /// public partial struct UInt4 { - /// - /// Gets an value with all components set to 0. - /// - public static UInt4 Zero => 0; - - /// - /// Gets an value with all components set to 1. - /// - public static UInt4 One => 1; - /// /// Gets an value with the component set to 1, and the others to 0. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt4.g.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt4.g.cs index d7475dda..fa9f91bb 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt4.g.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt4.g.cs @@ -43,6 +43,16 @@ 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 readonly ref uint this[int i] => ref *(uint*)UndefinedData; + /// + /// Gets a value with all components set to 0. + /// + public static UInt4 Zero => 0; + + /// + /// Gets a value with all components set to 1. + /// + public static UInt4 One => 1; + /// /// Gets a reference to the value representing the X component. /// diff --git a/src/ComputeSharp.Core/Primitives/VectorType.ttinclude b/src/ComputeSharp.Core/Primitives/VectorType.ttinclude index a0876551..9c4192b2 100644 --- a/src/ComputeSharp.Core/Primitives/VectorType.ttinclude +++ b/src/ComputeSharp.Core/Primitives/VectorType.ttinclude @@ -108,7 +108,38 @@ public unsafe partial struct <#=typeName#> /// The index of the component to access. /// 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 readonly ref <#=hlslElementTypeName#> this[int i] => ref *(<#=hlslElementTypeName#>*)UndefinedData; + <# + // Generate the true/false and zero/one properties + if (elementTypeName == "Bool") + { +#> + /// + /// Gets a value with all components set to . + /// + public static <#=typeName#> False => false; + + /// + /// Gets a value with all components set to . + /// + public static <#=typeName#> True => true; +<# + } + else + { +#> + /// + /// Gets a value with all components set to 0. + /// + public static <#=typeName#> Zero => 0; + + /// + /// Gets a value with all components set to 1. + /// + public static <#=typeName#> One => 1; +<# + } + PushIndent(" "); // Generate the combinatorial swizzling properties @@ -161,7 +192,6 @@ public unsafe partial struct <#=typeName#> #if !SOURCE_GENERATOR <# - if (elementTypeName == "Bool") { #> @@ -222,7 +252,6 @@ public unsafe partial struct <#=typeName#> #endif <# - // Generate the negation operator if (elementTypeName != "UInt") {