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 deleted file mode 100644 index 04a89538..00000000 --- a/src/ComputeSharp.Core/Primitives/Double/Double2.cs +++ /dev/null @@ -1,36 +0,0 @@ -#pragma warning disable CS0660, CS0661, IDE0290 - -namespace ComputeSharp; - -/// -/// A that maps the HLSL type. -/// -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. - /// - /// The input value to cast. - /// This 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 explicit operator Int2(Double2 xy) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 explicit operator UInt2(Double2 xy) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 explicit operator Float2(Double2 xy) => default; -} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Double/Double2.g.cs b/src/ComputeSharp.Core/Primitives/Double/Double2.g.cs index b7a75844..99be71d5 100644 --- a/src/ComputeSharp.Core/Primitives/Double/Double2.g.cs +++ b/src/ComputeSharp.Core/Primitives/Double/Double2.g.cs @@ -482,6 +482,33 @@ 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); + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator Float2(Double2 xy) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator Int2(Double2 xy) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator UInt2(Double2 xy) => default; + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Double/Double3.cs b/src/ComputeSharp.Core/Primitives/Double/Double3.cs deleted file mode 100644 index 39c6c0c5..00000000 --- a/src/ComputeSharp.Core/Primitives/Double/Double3.cs +++ /dev/null @@ -1,36 +0,0 @@ -#pragma warning disable CS0660, CS0661 - -namespace ComputeSharp; - -/// -/// A that maps the HLSL type. -/// -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. - /// - /// The input value to cast. - /// This 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 explicit operator Int3(Double3 xyz) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 explicit operator UInt3(Double3 xyz) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 explicit operator Float3(Double3 xyz) => default; -} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Double/Double3.g.cs b/src/ComputeSharp.Core/Primitives/Double/Double3.g.cs index db9cd8a7..9f31fd41 100644 --- a/src/ComputeSharp.Core/Primitives/Double/Double3.g.cs +++ b/src/ComputeSharp.Core/Primitives/Double/Double3.g.cs @@ -1822,6 +1822,33 @@ 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); + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator Float3(Double3 xyz) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator Int3(Double3 xyz) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator UInt3(Double3 xyz) => default; + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Double/Double4.cs b/src/ComputeSharp.Core/Primitives/Double/Double4.cs deleted file mode 100644 index a1b2f813..00000000 --- a/src/ComputeSharp.Core/Primitives/Double/Double4.cs +++ /dev/null @@ -1,36 +0,0 @@ -#pragma warning disable CS0660, CS0661 - -namespace ComputeSharp; - -/// -/// A that maps the HLSL type. -/// -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. - /// - /// The input value to cast. - /// This 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 explicit operator Int4(Double4 xyzw) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 explicit operator UInt4(Double4 xyzw) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 explicit operator Float4(Double4 xyzw) => default; -} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Double/Double4.g.cs b/src/ComputeSharp.Core/Primitives/Double/Double4.g.cs index fc0ce97c..8bb64d99 100644 --- a/src/ComputeSharp.Core/Primitives/Double/Double4.g.cs +++ b/src/ComputeSharp.Core/Primitives/Double/Double4.g.cs @@ -5159,6 +5159,33 @@ 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); + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator Float4(Double4 xyzw) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator Int4(Double4 xyzw) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator UInt4(Double4 xyzw) => default; + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float2.cs b/src/ComputeSharp.Core/Primitives/Float/Float2.cs index 460efc2c..aa6fffdc 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. /// @@ -26,25 +20,4 @@ public partial struct Float2 /// /// The input value to cast. public static unsafe implicit operator Float2(Vector2 xy) => *(Float2*)&xy; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 implicit operator Double2(Float2 xy) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 explicit operator Int2(Float2 xy) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 explicit operator UInt2(Float2 xy) => default; } \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Float/Float2.g.cs b/src/ComputeSharp.Core/Primitives/Float/Float2.g.cs index 08380d2d..5795eb00 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float2.g.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float2.g.cs @@ -483,6 +483,33 @@ 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); + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 implicit operator Double2(Float2 xy) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator Int2(Float2 xy) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator UInt2(Float2 xy) => default; + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float3.cs b/src/ComputeSharp.Core/Primitives/Float/Float3.cs index 7d1e9f0a..a27b9285 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. /// @@ -26,25 +20,4 @@ public partial struct Float3 /// /// The input value to cast. public static unsafe implicit operator Float3(Vector3 xyz) => *(Float3*)&xyz; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 implicit operator Double3(Float3 xyz) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 explicit operator Int3(Float3 xyz) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 explicit operator UInt3(Float3 xyz) => default; } \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Float/Float3.g.cs b/src/ComputeSharp.Core/Primitives/Float/Float3.g.cs index 25b352ab..1a557d8a 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float3.g.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float3.g.cs @@ -1823,6 +1823,33 @@ 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); + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 implicit operator Double3(Float3 xyz) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator Int3(Float3 xyz) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator UInt3(Float3 xyz) => default; + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Float/Float4.cs b/src/ComputeSharp.Core/Primitives/Float/Float4.cs index 9e4215dc..0445ed76 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. /// @@ -26,25 +20,4 @@ public partial struct Float4 /// /// The input value to cast. public static unsafe implicit operator Float4(Vector4 xyzw) => *(Float4*)&xyzw; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 implicit operator Double4(Float4 xyzw) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 explicit operator Int4(Float4 xyzw) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 explicit operator UInt4(Float4 xyzw) => default; } \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Float/Float4.g.cs b/src/ComputeSharp.Core/Primitives/Float/Float4.g.cs index f13a02ca..c325b6d3 100644 --- a/src/ComputeSharp.Core/Primitives/Float/Float4.g.cs +++ b/src/ComputeSharp.Core/Primitives/Float/Float4.g.cs @@ -5160,6 +5160,33 @@ 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); + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 implicit operator Double4(Float4 xyzw) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator Int4(Float4 xyzw) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator UInt4(Float4 xyzw) => default; + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int2.cs b/src/ComputeSharp.Core/Primitives/Int/Int2.cs deleted file mode 100644 index f8f4bb0f..00000000 --- a/src/ComputeSharp.Core/Primitives/Int/Int2.cs +++ /dev/null @@ -1,36 +0,0 @@ -#pragma warning disable CS0660, CS0661, IDE0290 - -namespace ComputeSharp; - -/// -/// A that maps the HLSL type. -/// -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. - /// - /// The input value to cast. - /// This 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 explicit operator UInt2(Int2 xy) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 implicit operator Float2(Int2 xy) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 implicit operator Double2(Int2 xy) => default; -} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs b/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs index 16cece54..6074658f 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int2.g.cs @@ -483,6 +483,33 @@ 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); + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 implicit operator Float2(Int2 xy) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 implicit operator Double2(Int2 xy) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator UInt2(Int2 xy) => default; + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int3.cs b/src/ComputeSharp.Core/Primitives/Int/Int3.cs deleted file mode 100644 index 9e46b0a9..00000000 --- a/src/ComputeSharp.Core/Primitives/Int/Int3.cs +++ /dev/null @@ -1,36 +0,0 @@ -#pragma warning disable CS0660, CS0661 - -namespace ComputeSharp; - -/// -/// A that maps the HLSL type. -/// -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. - /// - /// The input value to cast. - /// This 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 explicit operator UInt3(Int3 xyz) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 implicit operator Float3(Int3 xyz) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 implicit operator Double3(Int3 xyz) => default; -} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs b/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs index 006349f4..cd7af4ec 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int3.g.cs @@ -1823,6 +1823,33 @@ 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); + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 implicit operator Float3(Int3 xyz) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 implicit operator Double3(Int3 xyz) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator UInt3(Int3 xyz) => default; + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/Int/Int4.cs b/src/ComputeSharp.Core/Primitives/Int/Int4.cs deleted file mode 100644 index a3113568..00000000 --- a/src/ComputeSharp.Core/Primitives/Int/Int4.cs +++ /dev/null @@ -1,36 +0,0 @@ -#pragma warning disable CS0660, CS0661 - -namespace ComputeSharp; - -/// -/// A that maps the HLSL type. -/// -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. - /// - /// The input value to cast. - /// This 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 explicit operator UInt4(Int4 xyzw) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 implicit operator Float4(Int4 xyzw) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 implicit operator Double4(Int4 xyzw) => default; -} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs b/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs index 495fda2e..9ce5baf6 100644 --- a/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs +++ b/src/ComputeSharp.Core/Primitives/Int/Int4.g.cs @@ -5160,6 +5160,33 @@ 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); + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 implicit operator Float4(Int4 xyzw) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 implicit operator Double4(Int4 xyzw) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator UInt4(Int4 xyzw) => default; + /// /// Negates a value. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt2.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt2.cs deleted file mode 100644 index 23bc47d5..00000000 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt2.cs +++ /dev/null @@ -1,36 +0,0 @@ -#pragma warning disable CS0660, CS0661, IDE0290 - -namespace ComputeSharp; - -/// -/// A that maps the HLSL type. -/// -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. - /// - /// The input value to cast. - /// This 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 explicit operator Int2(UInt2 xy) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 implicit operator Float2(UInt2 xy) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 implicit operator Double2(UInt2 xy) => default; -} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt2.g.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt2.g.cs index 1bfbd471..6551999b 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt2.g.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt2.g.cs @@ -482,6 +482,33 @@ 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); + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 implicit operator Float2(UInt2 xy) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 implicit operator Double2(UInt2 xy) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator Int2(UInt2 xy) => default; + /// /// Sums two values. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt3.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt3.cs deleted file mode 100644 index cf82e523..00000000 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt3.cs +++ /dev/null @@ -1,36 +0,0 @@ -#pragma warning disable CS0660, CS0661 - -namespace ComputeSharp; - -/// -/// A that maps the HLSL type. -/// -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. - /// - /// The input value to cast. - /// This 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 explicit operator Int3(UInt3 xyz) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 implicit operator Float3(UInt3 xyz) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 implicit operator Double3(UInt3 xyz) => default; -} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt3.g.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt3.g.cs index 7f14246a..476c29af 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt3.g.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt3.g.cs @@ -1822,6 +1822,33 @@ 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); + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 implicit operator Float3(UInt3 xyz) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 implicit operator Double3(UInt3 xyz) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator Int3(UInt3 xyz) => default; + /// /// Sums two values. /// diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt4.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt4.cs deleted file mode 100644 index 93c1eca1..00000000 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt4.cs +++ /dev/null @@ -1,36 +0,0 @@ -#pragma warning disable CS0660, CS0661 - -namespace ComputeSharp; - -/// -/// A that maps the HLSL type. -/// -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. - /// - /// The input value to cast. - /// This 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 explicit operator Int4(UInt4 xyzw) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 implicit operator Float4(UInt4 xyzw) => default; - - /// - /// Casts a value to a one. - /// - /// The input value to cast. - /// This 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 implicit operator Double4(UInt4 xyzw) => default; -} \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/UInt/UInt4.g.cs b/src/ComputeSharp.Core/Primitives/UInt/UInt4.g.cs index 7f2ac00b..ab95b605 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UInt4.g.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UInt4.g.cs @@ -5159,6 +5159,33 @@ 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); + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 implicit operator Float4(UInt4 xyzw) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 implicit operator Double4(UInt4 xyzw) => default; + + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 explicit operator Int4(UInt4 xyzw) => default; + /// /// Sums two values. /// diff --git a/src/ComputeSharp.Core/Primitives/VectorType.ttinclude b/src/ComputeSharp.Core/Primitives/VectorType.ttinclude index e131360e..7d964bf7 100644 --- a/src/ComputeSharp.Core/Primitives/VectorType.ttinclude +++ b/src/ComputeSharp.Core/Primitives/VectorType.ttinclude @@ -256,6 +256,39 @@ 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 cast operators, when applicable + foreach (string targetType in new[] { "Float", "Double", "Int", "UInt" }) + { + if (elementTypeName != "Bool" && elementTypeName != targetType) + { + WriteLine(""); + + string parameterName = new string("xyzw".Take(i).ToArray()); + bool isImplicit = + (elementTypeName == "Float" && targetType == "Double") || + (elementTypeName == "Int" && targetType == "Float") || + (elementTypeName == "Int" && targetType == "Double") || + (elementTypeName == "UInt" && targetType == "Float") || + (elementTypeName == "UInt" && targetType == "Double"); +#> + /// + /// Casts a value to a one. + /// + /// The input value to cast. + /// This 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 <#=isImplicit ? "implicit" : "explicit"#> operator <#=targetType#><#=i#>(<#=typeName#> <#=parameterName#>) => default; +<# + } + } + // 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..478f9a4e 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj +++ b/src/ComputeSharp.D2D1.SourceGenerators/ComputeSharp.D2D1.SourceGenerators.csproj @@ -27,38 +27,23 @@ - - - - - - - - - - - - - - - diff --git a/src/ComputeSharp.SourceGenerators/ComputeSharp.SourceGenerators.csproj b/src/ComputeSharp.SourceGenerators/ComputeSharp.SourceGenerators.csproj index 7569624c..487bf38a 100644 --- a/src/ComputeSharp.SourceGenerators/ComputeSharp.SourceGenerators.csproj +++ b/src/ComputeSharp.SourceGenerators/ComputeSharp.SourceGenerators.csproj @@ -21,38 +21,23 @@ - - - - - - - - - - - - - - -