Move scalar promotion implicit operators to T4

このコミットが含まれているのは:
Sergio Pedri committed 2023-12-26 00:04:23 +01:00
1 親 0e2f83d336
コミット 0c2b2bca35
33ファイル変更
+98 -123

検索条件に一致するファイルはありません

-15
ファイルの表示
@@ -1,15 +0,0 @@
#pragma warning disable CS0660, CS0661, IDE0290
namespace ComputeSharp;
/// <summary>
/// A <see langword="struct"/> that maps the <see langword="bool2"/> HLSL type.
/// </summary>
public partial struct Bool2
{
/// <summary>
/// Creates a new <see cref="Bool2"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Bool2"/> instance.</param>
public static implicit operator Bool2(bool x) => new(x, x);
}
+6
ファイルの表示
@@ -478,6 +478,12 @@ public unsafe partial struct Bool2
return $"<{this.x != 0}, {this.y != 0}>";
}
/// <summary>
/// Creates a new <see cref="Bool2"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Bool2"/> instance.</param>
public static implicit operator Bool2(bool x) => new(x, x);
/// <summary>
/// Negates a <see cref="Bool2"/> value.
/// </summary>
-15
ファイルの表示
@@ -1,15 +0,0 @@
#pragma warning disable CS0660, CS0661
namespace ComputeSharp;
/// <summary>
/// A <see langword="struct"/> that maps the <see langword="bool3"/> HLSL type.
/// </summary>
public partial struct Bool3
{
/// <summary>
/// Creates a new <see cref="Bool3"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Bool3"/> instance.</param>
public static implicit operator Bool3(bool x) => new(x, x, x);
}
+6
ファイルの表示
@@ -1818,6 +1818,12 @@ public unsafe partial struct Bool3
return $"<{this.x != 0}, {this.y != 0}, {this.z != 0}>";
}
/// <summary>
/// Creates a new <see cref="Bool3"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Bool3"/> instance.</param>
public static implicit operator Bool3(bool x) => new(x, x, x);
/// <summary>
/// Negates a <see cref="Bool3"/> value.
/// </summary>
-15
ファイルの表示
@@ -1,15 +0,0 @@
#pragma warning disable CS0660, CS0661
namespace ComputeSharp;
/// <summary>
/// A <see langword="struct"/> that maps the <see langword="bool4"/> HLSL type.
/// </summary>
public partial struct Bool4
{
/// <summary>
/// Creates a new <see cref="Bool4"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Bool4"/> instance.</param>
public static implicit operator Bool4(bool x) => new(x, x, x, x);
}
+6
ファイルの表示
@@ -5155,6 +5155,12 @@ public unsafe partial struct Bool4
return $"<{this.x != 0}, {this.y != 0}, {this.z != 0}, {this.w != 0}>";
}
/// <summary>
/// Creates a new <see cref="Bool4"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Bool4"/> instance.</param>
public static implicit operator Bool4(bool x) => new(x, x, x, x);
/// <summary>
/// Negates a <see cref="Bool4"/> value.
/// </summary>
-6
ファイルの表示
@@ -7,12 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Double2
{
/// <summary>
/// Creates a new <see cref="Double2"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Double2"/> instance.</param>
public static implicit operator Double2(double x) => new(x, x);
/// <summary>
/// Casts a <see cref="Double2"/> value to a <see cref="Int2"/> one.
/// </summary>
+6
ファイルの表示
@@ -482,6 +482,12 @@ public unsafe partial struct Double2
return $"<{this.x}{separator} {this.y}>";
}
/// <summary>
/// Creates a new <see cref="Double2"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Double2"/> instance.</param>
public static implicit operator Double2(double x) => new(x, x);
/// <summary>
/// Negates a <see cref="Double2"/> value.
/// </summary>
-6
ファイルの表示
@@ -7,12 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Double3
{
/// <summary>
/// Creates a new <see cref="Double3"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Double3"/> instance.</param>
public static implicit operator Double3(double x) => new(x, x, x);
/// <summary>
/// Casts a <see cref="Double3"/> value to a <see cref="Int3"/> one.
/// </summary>
+6
ファイルの表示
@@ -1822,6 +1822,12 @@ public unsafe partial struct Double3
return $"<{this.x}{separator} {this.y}{separator} {this.z}>";
}
/// <summary>
/// Creates a new <see cref="Double3"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Double3"/> instance.</param>
public static implicit operator Double3(double x) => new(x, x, x);
/// <summary>
/// Negates a <see cref="Double3"/> value.
/// </summary>
-6
ファイルの表示
@@ -7,12 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Double4
{
/// <summary>
/// Creates a new <see cref="Double4"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Double4"/> instance.</param>
public static implicit operator Double4(double x) => new(x, x, x, x);
/// <summary>
/// Casts a <see cref="Double4"/> value to a <see cref="Int4"/> one.
/// </summary>
+6
ファイルの表示
@@ -5159,6 +5159,12 @@ public unsafe partial struct Double4
return $"<{this.x}{separator} {this.y}{separator} {this.z}{separator} {this.w}>";
}
/// <summary>
/// Creates a new <see cref="Double4"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Double4"/> instance.</param>
public static implicit operator Double4(double x) => new(x, x, x, x);
/// <summary>
/// Negates a <see cref="Double4"/> value.
/// </summary>
-6
ファイルの表示
@@ -9,12 +9,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Float2
{
/// <summary>
/// Creates a new <see cref="Float2"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Float2"/> instance.</param>
public static implicit operator Float2(float x) => new(x, x);
/// <summary>
/// Casts a <see cref="Float2"/> value to a <see cref="Vector2"/> one.
/// </summary>
+6
ファイルの表示
@@ -483,6 +483,12 @@ public unsafe partial struct Float2
return $"<{this.x}{separator} {this.y}>";
}
/// <summary>
/// Creates a new <see cref="Float2"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Float2"/> instance.</param>
public static implicit operator Float2(float x) => new(x, x);
/// <summary>
/// Negates a <see cref="Float2"/> value.
/// </summary>
-6
ファイルの表示
@@ -9,12 +9,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Float3
{
/// <summary>
/// Creates a new <see cref="Float3"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Float3"/> instance.</param>
public static implicit operator Float3(float x) => new(x, x, x);
/// <summary>
/// Casts a <see cref="Float3"/> value to a <see cref="Vector3"/> one.
/// </summary>
+6
ファイルの表示
@@ -1823,6 +1823,12 @@ public unsafe partial struct Float3
return $"<{this.x}{separator} {this.y}{separator} {this.z}>";
}
/// <summary>
/// Creates a new <see cref="Float3"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Float3"/> instance.</param>
public static implicit operator Float3(float x) => new(x, x, x);
/// <summary>
/// Negates a <see cref="Float3"/> value.
/// </summary>
-6
ファイルの表示
@@ -9,12 +9,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Float4
{
/// <summary>
/// Creates a new <see cref="Float4"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Float4"/> instance.</param>
public static implicit operator Float4(float x) => new(x, x, x, x);
/// <summary>
/// Casts a <see cref="Float4"/> value to a <see cref="Vector4"/> one.
/// </summary>
+6
ファイルの表示
@@ -5160,6 +5160,12 @@ public unsafe partial struct Float4
return $"<{this.x}{separator} {this.y}{separator} {this.z}{separator} {this.w}>";
}
/// <summary>
/// Creates a new <see cref="Float4"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Float4"/> instance.</param>
public static implicit operator Float4(float x) => new(x, x, x, x);
/// <summary>
/// Negates a <see cref="Float4"/> value.
/// </summary>
-6
ファイルの表示
@@ -7,12 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Int2
{
/// <summary>
/// Creates a new <see cref="Int2"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Int2"/> instance.</param>
public static implicit operator Int2(int x) => new(x, x);
/// <summary>
/// Casts a <see cref="Int2"/> value to a <see cref="UInt2"/> one.
/// </summary>
+6
ファイルの表示
@@ -483,6 +483,12 @@ public unsafe partial struct Int2
return $"<{this.x}{separator} {this.y}>";
}
/// <summary>
/// Creates a new <see cref="Int2"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Int2"/> instance.</param>
public static implicit operator Int2(int x) => new(x, x);
/// <summary>
/// Negates a <see cref="Int2"/> value.
/// </summary>
-6
ファイルの表示
@@ -7,12 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Int3
{
/// <summary>
/// Creates a new <see cref="Int3"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Int3"/> instance.</param>
public static implicit operator Int3(int x) => new(x, x, x);
/// <summary>
/// Casts a <see cref="Int3"/> value to a <see cref="UInt3"/> one.
/// </summary>
+6
ファイルの表示
@@ -1823,6 +1823,12 @@ public unsafe partial struct Int3
return $"<{this.x}{separator} {this.y}{separator} {this.z}>";
}
/// <summary>
/// Creates a new <see cref="Int3"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Int3"/> instance.</param>
public static implicit operator Int3(int x) => new(x, x, x);
/// <summary>
/// Negates a <see cref="Int3"/> value.
/// </summary>
-6
ファイルの表示
@@ -7,12 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct Int4
{
/// <summary>
/// Creates a new <see cref="Int4"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Int4"/> instance.</param>
public static implicit operator Int4(int x) => new(x, x, x, x);
/// <summary>
/// Casts a <see cref="Int4"/> value to a <see cref="UInt4"/> one.
/// </summary>
+6
ファイルの表示
@@ -5160,6 +5160,12 @@ public unsafe partial struct Int4
return $"<{this.x}{separator} {this.y}{separator} {this.z}{separator} {this.w}>";
}
/// <summary>
/// Creates a new <see cref="Int4"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="Int4"/> instance.</param>
public static implicit operator Int4(int x) => new(x, x, x, x);
/// <summary>
/// Negates a <see cref="Int4"/> value.
/// </summary>
-6
ファイルの表示
@@ -7,12 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct UInt2
{
/// <summary>
/// Creates a new <see cref="UInt2"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="UInt2"/> instance.</param>
public static implicit operator UInt2(uint x) => new(x, x);
/// <summary>
/// Casts a <see cref="UInt2"/> value to a <see cref="Int2"/> one.
/// </summary>
+6
ファイルの表示
@@ -482,6 +482,12 @@ public unsafe partial struct UInt2
return $"<{this.x}{separator} {this.y}>";
}
/// <summary>
/// Creates a new <see cref="UInt2"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="UInt2"/> instance.</param>
public static implicit operator UInt2(uint x) => new(x, x);
/// <summary>
/// Sums two <see cref="UInt2"/> values.
/// </summary>
-6
ファイルの表示
@@ -7,12 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct UInt3
{
/// <summary>
/// Creates a new <see cref="UInt3"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="UInt3"/> instance.</param>
public static implicit operator UInt3(uint x) => new(x, x, x);
/// <summary>
/// Casts a <see cref="UInt3"/> value to a <see cref="Int3"/> one.
/// </summary>
+6
ファイルの表示
@@ -1822,6 +1822,12 @@ public unsafe partial struct UInt3
return $"<{this.x}{separator} {this.y}{separator} {this.z}>";
}
/// <summary>
/// Creates a new <see cref="UInt3"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="UInt3"/> instance.</param>
public static implicit operator UInt3(uint x) => new(x, x, x);
/// <summary>
/// Sums two <see cref="UInt3"/> values.
/// </summary>
-6
ファイルの表示
@@ -7,12 +7,6 @@ namespace ComputeSharp;
/// </summary>
public partial struct UInt4
{
/// <summary>
/// Creates a new <see cref="UInt4"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="UInt4"/> instance.</param>
public static implicit operator UInt4(uint x) => new(x, x, x, x);
/// <summary>
/// Casts a <see cref="UInt4"/> value to a <see cref="Int4"/> one.
/// </summary>
+6
ファイルの表示
@@ -5159,6 +5159,12 @@ public unsafe partial struct UInt4
return $"<{this.x}{separator} {this.y}{separator} {this.z}{separator} {this.w}>";
}
/// <summary>
/// Creates a new <see cref="UInt4"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="UInt4"/> instance.</param>
public static implicit operator UInt4(uint x) => new(x, x, x, x);
/// <summary>
/// Sums two <see cref="UInt4"/> values.
/// </summary>
+8
ファイルの表示
@@ -256,6 +256,14 @@ public unsafe partial struct <#=typeName#>
<#
}
WriteLine("");
#>
/// <summary>
/// Creates a new <see cref="<#=typeName#>"/> value with the same value for all its components.
/// </summary>
/// <param name="x">The value to use for the components of the new <see cref="<#=typeName#>"/> instance.</param>
public static implicit operator <#=typeName#>(<#=hlslElementTypeName#> x) => new(<#=string.Join(", ", Enumerable.Range(0, i).Select(_ => "x"))#>);
<#
// Generate the negation operator
if (elementTypeName != "UInt")
{
-3
ファイルの表示
@@ -27,9 +27,6 @@
<Compile Include="..\ComputeSharp.Core\Intrinsics\Hlsl.g.cs" Link="ComputeSharp.Core\Intrinsics\Hlsl.g.cs" />
<Compile Include="..\ComputeSharp.Core\Intrinsics\Hlsl.Void.g.cs" Link="ComputeSharp.Core\Intrinsics\Hlsl.Void.g.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool.cs" Link="ComputeSharp.Core\Primitives\Bool\Bool.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool2.cs" Link="ComputeSharp.Core\Primitives\Bool\Bool2.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool3.cs" Link="ComputeSharp.Core\Primitives\Bool\Bool3.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool4.cs" Link="ComputeSharp.Core\Primitives\Bool\Bool4.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool2.g.cs" Link="ComputeSharp.Core\Primitives\Bool\Bool2.g.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool3.g.cs" Link="ComputeSharp.Core\Primitives\Bool\Bool3.g.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool4.g.cs" Link="ComputeSharp.Core\Primitives\Bool\Bool4.g.cs" />
-3
ファイルの表示
@@ -21,9 +21,6 @@
<Compile Include="..\ComputeSharp.Core\Intrinsics\Hlsl.g.cs" Link="ComputeSharp.Core\Intrinsics\Hlsl.g.cs" />
<Compile Include="..\ComputeSharp.Core\Intrinsics\Hlsl.Void.g.cs" Link="ComputeSharp.Core\Intrinsics\Hlsl.Void.g.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool.cs" Link="ComputeSharp.Core\Primitives\Bool\Bool.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool2.cs" Link="ComputeSharp.Core\Primitives\Bool\Bool2.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool3.cs" Link="ComputeSharp.Core\Primitives\Bool\Bool3.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool4.cs" Link="ComputeSharp.Core\Primitives\Bool\Bool4.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool2.g.cs" Link="ComputeSharp.Core\Primitives\Bool\Bool2.g.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool3.g.cs" Link="ComputeSharp.Core\Primitives\Bool\Bool3.g.cs" />
<Compile Include="..\ComputeSharp.Core\Primitives\Bool\Bool4.g.cs" Link="ComputeSharp.Core\Primitives\Bool\Bool4.g.cs" />