diff --git a/src/ComputeSharp.Core/Primitives/Bool/Bool2.cs b/src/ComputeSharp.Core/Primitives/Bool/Bool2.cs deleted file mode 100644 index 64ead583..00000000 --- a/src/ComputeSharp.Core/Primitives/Bool/Bool2.cs +++ /dev/null @@ -1,15 +0,0 @@ -#pragma warning disable CS0660, CS0661, IDE0290 - -namespace ComputeSharp; - -/// -/// A that maps the HLSL type. -/// -public partial struct Bool2 -{ - /// - /// Creates a new value with the same value for all its components. - /// - /// The value to use for the components of the new instance. - public static implicit operator Bool2(bool x) => new(x, x); -} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Bool/Bool2.g.cs b/src/ComputeSharp.Core/Primitives/Bool/Bool2.g.cs index 5124e94b..141c9732 100644 --- a/src/ComputeSharp.Core/Primitives/Bool/Bool2.g.cs +++ b/src/ComputeSharp.Core/Primitives/Bool/Bool2.g.cs @@ -478,6 +478,12 @@ public unsafe partial struct Bool2 return $"<{this.x != 0}, {this.y != 0}>"; } + /// + /// Creates a new value with the same value for all its components. + /// + /// The value to use for the components of the new instance. + public static implicit operator Bool2(bool x) => new(x, x); + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Bool/Bool3.cs b/src/ComputeSharp.Core/Primitives/Bool/Bool3.cs deleted file mode 100644 index 18c20ff9..00000000 --- a/src/ComputeSharp.Core/Primitives/Bool/Bool3.cs +++ /dev/null @@ -1,15 +0,0 @@ -#pragma warning disable CS0660, CS0661 - -namespace ComputeSharp; - -/// -/// A that maps the HLSL type. -/// -public partial struct Bool3 -{ - /// - /// Creates a new value with the same value for all its components. - /// - /// The value to use for the components of the new instance. - public static implicit operator Bool3(bool x) => new(x, x, x); -} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Bool/Bool3.g.cs b/src/ComputeSharp.Core/Primitives/Bool/Bool3.g.cs index 2c96a276..1aace8a0 100644 --- a/src/ComputeSharp.Core/Primitives/Bool/Bool3.g.cs +++ b/src/ComputeSharp.Core/Primitives/Bool/Bool3.g.cs @@ -1818,6 +1818,12 @@ public unsafe partial struct Bool3 return $"<{this.x != 0}, {this.y != 0}, {this.z != 0}>"; } + /// + /// Creates a new value with the same value for all its components. + /// + /// The value to use for the components of the new instance. + public static implicit operator Bool3(bool x) => new(x, x, x); + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Bool/Bool4.cs b/src/ComputeSharp.Core/Primitives/Bool/Bool4.cs deleted file mode 100644 index 32e7408a..00000000 --- a/src/ComputeSharp.Core/Primitives/Bool/Bool4.cs +++ /dev/null @@ -1,15 +0,0 @@ -#pragma warning disable CS0660, CS0661 - -namespace ComputeSharp; - -/// -/// A that maps the HLSL type. -/// -public partial struct Bool4 -{ - /// - /// Creates a new value with the same value for all its components. - /// - /// The value to use for the components of the new instance. - public static implicit operator Bool4(bool x) => new(x, x, x, x); -} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Bool/Bool4.g.cs b/src/ComputeSharp.Core/Primitives/Bool/Bool4.g.cs index b24da5de..5494de4c 100644 --- a/src/ComputeSharp.Core/Primitives/Bool/Bool4.g.cs +++ b/src/ComputeSharp.Core/Primitives/Bool/Bool4.g.cs @@ -5155,6 +5155,12 @@ public unsafe partial struct Bool4 return $"<{this.x != 0}, {this.y != 0}, {this.z != 0}, {this.w != 0}>"; } + /// + /// Creates a new value with the same value for all its components. + /// + /// The value to use for the components of the new instance. + public static implicit operator Bool4(bool x) => new(x, x, x, x); + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Double/Double2.cs b/src/ComputeSharp.Core/Primitives/Double/Double2.cs index 04a89538..6d1e2a17 100644 --- a/src/ComputeSharp.Core/Primitives/Double/Double2.cs +++ b/src/ComputeSharp.Core/Primitives/Double/Double2.cs @@ -7,12 +7,6 @@ namespace ComputeSharp; /// public partial struct Double2 { - /// - /// Creates a new value with the same value for all its components. - /// - /// The value to use for the components of the new instance. - public static implicit operator Double2(double x) => new(x, x); - /// /// Casts a value to a one. /// diff --git a/src/ComputeSharp.Core/Primitives/Double/Double2.g.cs b/src/ComputeSharp.Core/Primitives/Double/Double2.g.cs index b7a75844..401c18d2 100644 --- a/src/ComputeSharp.Core/Primitives/Double/Double2.g.cs +++ b/src/ComputeSharp.Core/Primitives/Double/Double2.g.cs @@ -482,6 +482,12 @@ public unsafe partial struct Double2 return $"<{this.x}{separator} {this.y}>"; } + /// + /// Creates a new value with the same value for all its components. + /// + /// The value to use for the components of the new instance. + public static implicit operator Double2(double x) => new(x, x); + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Double/Double3.cs b/src/ComputeSharp.Core/Primitives/Double/Double3.cs index 39c6c0c5..4f167c3f 100644 --- a/src/ComputeSharp.Core/Primitives/Double/Double3.cs +++ b/src/ComputeSharp.Core/Primitives/Double/Double3.cs @@ -7,12 +7,6 @@ namespace ComputeSharp; /// public partial struct Double3 { - /// - /// Creates a new value with the same value for all its components. - /// - /// The value to use for the components of the new instance. - public static implicit operator Double3(double x) => new(x, x, x); - /// /// Casts a value to a one. /// diff --git a/src/ComputeSharp.Core/Primitives/Double/Double3.g.cs b/src/ComputeSharp.Core/Primitives/Double/Double3.g.cs index db9cd8a7..5d6346d2 100644 --- a/src/ComputeSharp.Core/Primitives/Double/Double3.g.cs +++ b/src/ComputeSharp.Core/Primitives/Double/Double3.g.cs @@ -1822,6 +1822,12 @@ public unsafe partial struct Double3 return $"<{this.x}{separator} {this.y}{separator} {this.z}>"; } + /// + /// Creates a new value with the same value for all its components. + /// + /// The value to use for the components of the new instance. + public static implicit operator Double3(double x) => new(x, x, x); + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Double/Double4.cs b/src/ComputeSharp.Core/Primitives/Double/Double4.cs index a1b2f813..e28c6b8f 100644 --- a/src/ComputeSharp.Core/Primitives/Double/Double4.cs +++ b/src/ComputeSharp.Core/Primitives/Double/Double4.cs @@ -7,12 +7,6 @@ namespace ComputeSharp; /// public partial struct Double4 { - /// - /// Creates a new value with the same value for all its components. - /// - /// The value to use for the components of the new instance. - public static implicit operator Double4(double x) => new(x, x, x, x); - /// /// Casts a value to a one. /// diff --git a/src/ComputeSharp.Core/Primitives/Double/Double4.g.cs b/src/ComputeSharp.Core/Primitives/Double/Double4.g.cs index fc0ce97c..5fe0be55 100644 --- a/src/ComputeSharp.Core/Primitives/Double/Double4.g.cs +++ b/src/ComputeSharp.Core/Primitives/Double/Double4.g.cs @@ -5159,6 +5159,12 @@ public unsafe partial struct Double4 return $"<{this.x}{separator} {this.y}{separator} {this.z}{separator} {this.w}>"; } + /// + /// Creates a new value with the same value for all its components. + /// + /// The value to use for the components of the new instance. + public static implicit operator Double4(double x) => new(x, x, x, x); + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float2.cs b/src/ComputeSharp.Core/Primitives/Float/Float2.cs index 460efc2c..77c9e738 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float2.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float2.cs @@ -9,12 +9,6 @@ namespace ComputeSharp; /// public partial struct Float2 { - /// - /// Creates a new value with the same value for all its components. - /// - /// The value to use for the components of the new instance. - public static implicit operator Float2(float x) => new(x, x); - /// /// Casts a value to a one. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float2.g.cs b/src/ComputeSharp.Core/Primitives/Float/Float2.g.cs index 08380d2d..87895196 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float2.g.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float2.g.cs @@ -483,6 +483,12 @@ public unsafe partial struct Float2 return $"<{this.x}{separator} {this.y}>"; } + /// + /// Creates a new value with the same value for all its components. + /// + /// The value to use for the components of the new instance. + public static implicit operator Float2(float x) => new(x, x); + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float3.cs b/src/ComputeSharp.Core/Primitives/Float/Float3.cs index 7d1e9f0a..2ce9930b 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float3.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float3.cs @@ -9,12 +9,6 @@ namespace ComputeSharp; /// public partial struct Float3 { - /// - /// Creates a new value with the same value for all its components. - /// - /// The value to use for the components of the new instance. - public static implicit operator Float3(float x) => new(x, x, x); - /// /// Casts a value to a one. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float3.g.cs b/src/ComputeSharp.Core/Primitives/Float/Float3.g.cs index 25b352ab..ae820a92 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float3.g.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float3.g.cs @@ -1823,6 +1823,12 @@ public unsafe partial struct Float3 return $"<{this.x}{separator} {this.y}{separator} {this.z}>"; } + /// + /// Creates a new value with the same value for all its components. + /// + /// The value to use for the components of the new instance. + public static implicit operator Float3(float x) => new(x, x, x); + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float4.cs b/src/ComputeSharp.Core/Primitives/Float/Float4.cs index 9e4215dc..ab7f83fb 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float4.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float4.cs @@ -9,12 +9,6 @@ namespace ComputeSharp; /// public partial struct Float4 { - /// - /// Creates a new value with the same value for all its components. - /// - /// The value to use for the components of the new instance. - public static implicit operator Float4(float x) => new(x, x, x, x); - /// /// Casts a value to a one. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float4.g.cs b/src/ComputeSharp.Core/Primitives/Float/Float4.g.cs index f13a02ca..00594bcd 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float4.g.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float4.g.cs @@ -5160,6 +5160,12 @@ public unsafe partial struct Float4 return $"<{this.x}{separator} {this.y}{separator} {this.z}{separator} {this.w}>"; } + /// + /// Creates a new value with the same value for all its components. + /// + /// The value to use for the components of the new instance. + public static implicit operator Float4(float x) => new(x, x, x, x); + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int2.cs b/src/ComputeSharp.Core/Primitives/Int/Int2.cs index f8f4bb0f..5213554c 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int2.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int2.cs @@ -7,12 +7,6 @@ namespace ComputeSharp; /// public partial struct Int2 { - /// - /// Creates a new value with the same value for all its components. - /// - /// The value to use for the components of the new instance. - public static implicit operator Int2(int x) => new(x, x); - /// /// Casts a value to a one. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs b/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs index 16cece54..a740e4cf 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs @@ -483,6 +483,12 @@ public unsafe partial struct Int2 return $"<{this.x}{separator} {this.y}>"; } + /// + /// Creates a new value with the same value for all its components. + /// + /// The value to use for the components of the new instance. + public static implicit operator Int2(int x) => new(x, x); + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int3.cs b/src/ComputeSharp.Core/Primitives/Int/Int3.cs index 9e46b0a9..3817fd83 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int3.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int3.cs @@ -7,12 +7,6 @@ namespace ComputeSharp; /// public partial struct Int3 { - /// - /// Creates a new value with the same value for all its components. - /// - /// The value to use for the components of the new instance. - public static implicit operator Int3(int x) => new(x, x, x); - /// /// Casts a value to a one. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs b/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs index 006349f4..2339ccfc 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs @@ -1823,6 +1823,12 @@ public unsafe partial struct Int3 return $"<{this.x}{separator} {this.y}{separator} {this.z}>"; } + /// + /// Creates a new value with the same value for all its components. + /// + /// The value to use for the components of the new instance. + public static implicit operator Int3(int x) => new(x, x, x); + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int4.cs b/src/ComputeSharp.Core/Primitives/Int/Int4.cs index a3113568..e44860c5 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int4.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int4.cs @@ -7,12 +7,6 @@ namespace ComputeSharp; /// public partial struct Int4 { - /// - /// Creates a new value with the same value for all its components. - /// - /// The value to use for the components of the new instance. - public static implicit operator Int4(int x) => new(x, x, x, x); - /// /// Casts a value to a one. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs b/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs index 495fda2e..1c0a32f7 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs @@ -5160,6 +5160,12 @@ public unsafe partial struct Int4 return $"<{this.x}{separator} {this.y}{separator} {this.z}{separator} {this.w}>"; } + /// + /// Creates a new value with the same value for all its components. + /// + /// The value to use for the components of the new instance. + public static implicit operator Int4(int x) => new(x, x, x, x); + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt2.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt2.cs index 23bc47d5..7a7cbd75 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt2.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt2.cs @@ -7,12 +7,6 @@ namespace ComputeSharp; /// public partial struct UInt2 { - /// - /// Creates a new value with the same value for all its components. - /// - /// The value to use for the components of the new instance. - public static implicit operator UInt2(uint x) => new(x, x); - /// /// Casts a value to a one. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt2.g.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt2.g.cs index 1bfbd471..df85aa7d 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt2.g.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt2.g.cs @@ -482,6 +482,12 @@ public unsafe partial struct UInt2 return $"<{this.x}{separator} {this.y}>"; } + /// + /// Creates a new value with the same value for all its components. + /// + /// The value to use for the components of the new instance. + public static implicit operator UInt2(uint x) => new(x, x); + /// /// Sums two values. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt3.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt3.cs index cf82e523..0715b76c 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt3.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt3.cs @@ -7,12 +7,6 @@ namespace ComputeSharp; /// public partial struct UInt3 { - /// - /// Creates a new value with the same value for all its components. - /// - /// The value to use for the components of the new instance. - public static implicit operator UInt3(uint x) => new(x, x, x); - /// /// Casts a value to a one. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt3.g.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt3.g.cs index 7f14246a..46070b84 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt3.g.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt3.g.cs @@ -1822,6 +1822,12 @@ public unsafe partial struct UInt3 return $"<{this.x}{separator} {this.y}{separator} {this.z}>"; } + /// + /// Creates a new value with the same value for all its components. + /// + /// The value to use for the components of the new instance. + public static implicit operator UInt3(uint x) => new(x, x, x); + /// /// Sums two values. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt4.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt4.cs index 93c1eca1..04a04efb 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt4.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt4.cs @@ -7,12 +7,6 @@ namespace ComputeSharp; /// public partial struct UInt4 { - /// - /// Creates a new value with the same value for all its components. - /// - /// The value to use for the components of the new instance. - public static implicit operator UInt4(uint x) => new(x, x, x, x); - /// /// Casts a value to a one. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt4.g.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt4.g.cs index 7f2ac00b..e321163a 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt4.g.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt4.g.cs @@ -5159,6 +5159,12 @@ public unsafe partial struct UInt4 return $"<{this.x}{separator} {this.y}{separator} {this.z}{separator} {this.w}>"; } + /// + /// Creates a new value with the same value for all its components. + /// + /// The value to use for the components of the new instance. + public static implicit operator UInt4(uint x) => new(x, x, x, x); + /// /// Sums two values. /// diff --git a/src/ComputeSharp.Core/Primitives/VectorType.ttinclude b/src/ComputeSharp.Core/Primitives/VectorType.ttinclude index e131360e..4912a56b 100644 --- a/src/ComputeSharp.Core/Primitives/VectorType.ttinclude +++ b/src/ComputeSharp.Core/Primitives/VectorType.ttinclude @@ -256,6 +256,14 @@ public unsafe partial struct <#=typeName#> <# } + WriteLine(""); +#> + /// + /// Creates a new value with the same value for all its components. + /// + /// The value to use for the components of the new instance. + public static implicit operator <#=typeName#>(<#=hlslElementTypeName#> x) => new(<#=string.Join(", ", Enumerable.Range(0, i).Select(_ => "x"))#>); +<# // Generate the negation operator if (elementTypeName != "UInt") { diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj b/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj index 7abb2695..528de9b4 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj +++ b/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj @@ -27,9 +27,6 @@ - - - diff --git a/src/ComputeSharp.SourceGenerators/ComputeSharp.SourceGenerators.csproj b/src/ComputeSharp.SourceGenerators/ComputeSharp.SourceGenerators.csproj index 7569624c..ba134f09 100644 --- a/src/ComputeSharp.SourceGenerators/ComputeSharp.SourceGenerators.csproj +++ b/src/ComputeSharp.SourceGenerators/ComputeSharp.SourceGenerators.csproj @@ -21,9 +21,6 @@ - - -