diff --git a/src/ComputeSharp/Core/Primitives/Bool/BoolMxN.g.cs b/src/ComputeSharp/Core/Primitives/Bool/BoolMxN.g.cs index fc9cba80..9f72b9e2 100644 --- a/src/ComputeSharp/Core/Primitives/Bool/BoolMxN.g.cs +++ b/src/ComputeSharp/Core/Primitives/Bool/BoolMxN.g.cs @@ -49,6 +49,19 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Bool4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Bool1x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Bool1x1(bool x) + { + Bool1x1 matrix; + + matrix.m11 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -135,6 +148,20 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Bool4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Bool1x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Bool1x2(bool x) + { + Bool1x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -232,6 +259,21 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Bool4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Bool1x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Bool1x3(bool x) + { + Bool1x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -334,6 +376,22 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Bool4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Bool1x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Bool1x4(bool x) + { + Bool1x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -426,6 +484,20 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Bool4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Bool2x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Bool2x1(bool x) + { + Bool2x1 matrix; + + matrix.m11 = x; + matrix.m21 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -541,6 +613,22 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Bool4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Bool2x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Bool2x2(bool x) + { + Bool2x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m21 = x; + matrix.m22 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -662,6 +750,24 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Bool4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Bool2x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Bool2x3(bool x) + { + Bool2x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -795,6 +901,26 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Bool4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Bool2x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Bool2x4(bool x) + { + Bool2x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m24 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -886,6 +1012,21 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Bool4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Bool3x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Bool3x1(bool x) + { + Bool3x1 matrix; + + matrix.m11 = x; + matrix.m21 = x; + matrix.m31 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1014,6 +1155,24 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Bool4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Bool3x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Bool3x2(bool x) + { + Bool3x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m31 = x; + matrix.m32 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1154,6 +1313,27 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Bool4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Bool3x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Bool3x3(bool x) + { + Bool3x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1312,6 +1492,30 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Bool4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Bool3x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Bool3x4(bool x) + { + Bool3x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m24 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + matrix.m34 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1408,6 +1612,22 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Bool4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Bool4x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Bool4x1(bool x) + { + Bool4x1 matrix; + + matrix.m11 = x; + matrix.m21 = x; + matrix.m31 = x; + matrix.m41 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1549,6 +1769,26 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Bool4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Bool4x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Bool4x2(bool x) + { + Bool4x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m41 = x; + matrix.m42 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1708,6 +1948,30 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Bool4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Bool4x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Bool4x3(bool x) + { + Bool4x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + matrix.m41 = x; + matrix.m42 = x; + matrix.m43 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1891,6 +2155,34 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Bool4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Bool4x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Bool4x4(bool x) + { + Bool4x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m24 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + matrix.m34 = x; + matrix.m41 = x; + matrix.m42 = x; + matrix.m43 = x; + matrix.m44 = x; + + return matrix; + } + /// /// Negates a value. /// diff --git a/src/ComputeSharp/Core/Primitives/Double/DoubleMxN.g.cs b/src/ComputeSharp/Core/Primitives/Double/DoubleMxN.g.cs index 13c68d57..7fef5352 100644 --- a/src/ComputeSharp/Core/Primitives/Double/DoubleMxN.g.cs +++ b/src/ComputeSharp/Core/Primitives/Double/DoubleMxN.g.cs @@ -49,6 +49,19 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Double4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Double1x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Double1x1(double x) + { + Double1x1 matrix; + + matrix.m11 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -135,6 +148,20 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Double4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Double1x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Double1x2(double x) + { + Double1x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -232,6 +259,21 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Double4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Double1x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Double1x3(double x) + { + Double1x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -334,6 +376,22 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Double4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Double1x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Double1x4(double x) + { + Double1x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -426,6 +484,20 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Double4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Double2x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Double2x1(double x) + { + Double2x1 matrix; + + matrix.m11 = x; + matrix.m21 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -541,6 +613,22 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Double4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Double2x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Double2x2(double x) + { + Double2x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m21 = x; + matrix.m22 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -662,6 +750,24 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Double4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Double2x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Double2x3(double x) + { + Double2x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -795,6 +901,26 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Double4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Double2x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Double2x4(double x) + { + Double2x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m24 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -886,6 +1012,21 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Double4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Double3x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Double3x1(double x) + { + Double3x1 matrix; + + matrix.m11 = x; + matrix.m21 = x; + matrix.m31 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1014,6 +1155,24 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Double4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Double3x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Double3x2(double x) + { + Double3x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m31 = x; + matrix.m32 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1154,6 +1313,27 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Double4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Double3x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Double3x3(double x) + { + Double3x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1312,6 +1492,30 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Double4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Double3x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Double3x4(double x) + { + Double3x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m24 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + matrix.m34 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1408,6 +1612,22 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Double4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Double4x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Double4x1(double x) + { + Double4x1 matrix; + + matrix.m11 = x; + matrix.m21 = x; + matrix.m31 = x; + matrix.m41 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1549,6 +1769,26 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Double4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Double4x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Double4x2(double x) + { + Double4x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m41 = x; + matrix.m42 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1708,6 +1948,30 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Double4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Double4x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Double4x3(double x) + { + Double4x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + matrix.m41 = x; + matrix.m42 = x; + matrix.m43 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1891,6 +2155,34 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Double4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Double4x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Double4x4(double x) + { + Double4x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m24 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + matrix.m34 = x; + matrix.m41 = x; + matrix.m42 = x; + matrix.m43 = x; + matrix.m44 = x; + + return matrix; + } + /// /// Negates a value. /// diff --git a/src/ComputeSharp/Core/Primitives/Float/FloatMxN.g.cs b/src/ComputeSharp/Core/Primitives/Float/FloatMxN.g.cs index 9e78718c..2562d8f0 100644 --- a/src/ComputeSharp/Core/Primitives/Float/FloatMxN.g.cs +++ b/src/ComputeSharp/Core/Primitives/Float/FloatMxN.g.cs @@ -49,6 +49,19 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Float4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Float1x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Float1x1(float x) + { + Float1x1 matrix; + + matrix.m11 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -135,6 +148,20 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Float4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Float1x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Float1x2(float x) + { + Float1x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -232,6 +259,21 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Float4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Float1x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Float1x3(float x) + { + Float1x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -334,6 +376,22 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Float4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Float1x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Float1x4(float x) + { + Float1x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -426,6 +484,20 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Float4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Float2x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Float2x1(float x) + { + Float2x1 matrix; + + matrix.m11 = x; + matrix.m21 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -541,6 +613,22 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Float4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Float2x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Float2x2(float x) + { + Float2x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m21 = x; + matrix.m22 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -662,6 +750,24 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Float4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Float2x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Float2x3(float x) + { + Float2x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -795,6 +901,26 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Float4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Float2x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Float2x4(float x) + { + Float2x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m24 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -886,6 +1012,21 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Float4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Float3x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Float3x1(float x) + { + Float3x1 matrix; + + matrix.m11 = x; + matrix.m21 = x; + matrix.m31 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1014,6 +1155,24 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Float4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Float3x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Float3x2(float x) + { + Float3x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m31 = x; + matrix.m32 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1154,6 +1313,27 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Float4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Float3x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Float3x3(float x) + { + Float3x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1312,6 +1492,30 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Float4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Float3x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Float3x4(float x) + { + Float3x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m24 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + matrix.m34 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1408,6 +1612,22 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Float4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Float4x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Float4x1(float x) + { + Float4x1 matrix; + + matrix.m11 = x; + matrix.m21 = x; + matrix.m31 = x; + matrix.m41 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1549,6 +1769,26 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Float4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Float4x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Float4x2(float x) + { + Float4x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m41 = x; + matrix.m42 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1708,6 +1948,30 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Float4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Float4x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Float4x3(float x) + { + Float4x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + matrix.m41 = x; + matrix.m42 = x; + matrix.m43 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1891,6 +2155,34 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Float4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Float4x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Float4x4(float x) + { + Float4x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m24 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + matrix.m34 = x; + matrix.m41 = x; + matrix.m42 = x; + matrix.m43 = x; + matrix.m44 = x; + + return matrix; + } + /// /// Negates a value. /// diff --git a/src/ComputeSharp/Core/Primitives/Int/IntMxN.g.cs b/src/ComputeSharp/Core/Primitives/Int/IntMxN.g.cs index 3223022c..3e29b6e3 100644 --- a/src/ComputeSharp/Core/Primitives/Int/IntMxN.g.cs +++ b/src/ComputeSharp/Core/Primitives/Int/IntMxN.g.cs @@ -49,6 +49,19 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Int4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Int1x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Int1x1(int x) + { + Int1x1 matrix; + + matrix.m11 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -135,6 +148,20 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Int4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Int1x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Int1x2(int x) + { + Int1x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -232,6 +259,21 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Int4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Int1x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Int1x3(int x) + { + Int1x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -334,6 +376,22 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Int4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Int1x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Int1x4(int x) + { + Int1x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -426,6 +484,20 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Int4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Int2x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Int2x1(int x) + { + Int2x1 matrix; + + matrix.m11 = x; + matrix.m21 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -541,6 +613,22 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Int4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Int2x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Int2x2(int x) + { + Int2x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m21 = x; + matrix.m22 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -662,6 +750,24 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Int4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Int2x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Int2x3(int x) + { + Int2x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -795,6 +901,26 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Int4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Int2x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Int2x4(int x) + { + Int2x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m24 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -886,6 +1012,21 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Int4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Int3x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Int3x1(int x) + { + Int3x1 matrix; + + matrix.m11 = x; + matrix.m21 = x; + matrix.m31 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1014,6 +1155,24 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Int4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Int3x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Int3x2(int x) + { + Int3x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m31 = x; + matrix.m32 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1154,6 +1313,27 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Int4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Int3x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Int3x3(int x) + { + Int3x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1312,6 +1492,30 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Int4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Int3x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Int3x4(int x) + { + Int3x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m24 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + matrix.m34 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1408,6 +1612,22 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Int4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Int4x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Int4x1(int x) + { + Int4x1 matrix; + + matrix.m11 = x; + matrix.m21 = x; + matrix.m31 = x; + matrix.m41 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1549,6 +1769,26 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Int4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Int4x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Int4x2(int x) + { + Int4x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m41 = x; + matrix.m42 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1708,6 +1948,30 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Int4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Int4x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Int4x3(int x) + { + Int4x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + matrix.m41 = x; + matrix.m42 = x; + matrix.m43 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1891,6 +2155,34 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref Int4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(Int4x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 Int4x4(int x) + { + Int4x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m24 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + matrix.m34 = x; + matrix.m41 = x; + matrix.m42 = x; + matrix.m43 = x; + matrix.m44 = x; + + return matrix; + } + /// /// Negates a value. /// diff --git a/src/ComputeSharp/Core/Primitives/MatrixType.ttinclude b/src/ComputeSharp/Core/Primitives/MatrixType.ttinclude index 86ba042d..fd90a2a3 100644 --- a/src/ComputeSharp/Core/Primitives/MatrixType.ttinclude +++ b/src/ComputeSharp/Core/Primitives/MatrixType.ttinclude @@ -146,7 +146,35 @@ void GenerateMatrixProperties(string typeName, int rows, int columns, int elemen /// The identifier of the third item to index. /// The identifier of the fourth item to index. public ref <#=typeName#>4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(<#=fullTypeName#>)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + + /// + /// 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 <#=fullTypeName#>(<#=elementTypeName#> x) <# + // Complete the conversion operator above + PushIndent(" "); + PushIndent(" "); + WriteLine("{"); + PushIndent(" "); + WriteLine($"{fullTypeName} matrix;"); + WriteLine(""); + + for (int i = 1; i <= rows; i++) + for (int j = 1; j <= columns; j++) + { + WriteLine($"matrix.m{i}{j} = x;"); + } + + WriteLine(""); + WriteLine("return matrix;"); + + PopIndent(); + WriteLine("}"); + PopIndent(); + PopIndent(); + // Generate the negation operator if (elementTypeName != "Bool" && elementTypeName != "UInt") { diff --git a/src/ComputeSharp/Core/Primitives/UInt/UIntMxN.g.cs b/src/ComputeSharp/Core/Primitives/UInt/UIntMxN.g.cs index cbff1e0d..8a985fe7 100644 --- a/src/ComputeSharp/Core/Primitives/UInt/UIntMxN.g.cs +++ b/src/ComputeSharp/Core/Primitives/UInt/UIntMxN.g.cs @@ -49,6 +49,19 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref UInt4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(UInt1x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 UInt1x1(uint x) + { + UInt1x1 matrix; + + matrix.m11 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -135,6 +148,20 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref UInt4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(UInt1x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 UInt1x2(uint x) + { + UInt1x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -232,6 +259,21 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref UInt4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(UInt1x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 UInt1x3(uint x) + { + UInt1x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -334,6 +376,22 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref UInt4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(UInt1x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 UInt1x4(uint x) + { + UInt1x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -426,6 +484,20 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref UInt4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(UInt2x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 UInt2x1(uint x) + { + UInt2x1 matrix; + + matrix.m11 = x; + matrix.m21 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -541,6 +613,22 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref UInt4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(UInt2x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 UInt2x2(uint x) + { + UInt2x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m21 = x; + matrix.m22 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -662,6 +750,24 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref UInt4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(UInt2x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 UInt2x3(uint x) + { + UInt2x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -795,6 +901,26 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref UInt4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(UInt2x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 UInt2x4(uint x) + { + UInt2x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m24 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -886,6 +1012,21 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref UInt4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(UInt3x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 UInt3x1(uint x) + { + UInt3x1 matrix; + + matrix.m11 = x; + matrix.m21 = x; + matrix.m31 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1014,6 +1155,24 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref UInt4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(UInt3x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 UInt3x2(uint x) + { + UInt3x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m31 = x; + matrix.m32 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1154,6 +1313,27 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref UInt4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(UInt3x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 UInt3x3(uint x) + { + UInt3x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1312,6 +1492,30 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref UInt4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(UInt3x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 UInt3x4(uint x) + { + UInt3x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m24 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + matrix.m34 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1408,6 +1612,22 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref UInt4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(UInt4x1)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 UInt4x1(uint x) + { + UInt4x1 matrix; + + matrix.m11 = x; + matrix.m21 = x; + matrix.m31 = x; + matrix.m41 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1549,6 +1769,26 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref UInt4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(UInt4x2)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 UInt4x2(uint x) + { + UInt4x2 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m41 = x; + matrix.m42 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1708,6 +1948,30 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref UInt4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(UInt4x3)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 UInt4x3(uint x) + { + UInt4x3 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + matrix.m41 = x; + matrix.m42 = x; + matrix.m43 = x; + + return matrix; + } + /// /// Negates a value. /// @@ -1891,6 +2155,34 @@ namespace ComputeSharp /// The identifier of the fourth item to index. public ref UInt4 this[MatrixIndex xy0, MatrixIndex xy1, MatrixIndex xy2, MatrixIndex xy3] => throw new InvalidExecutionContextException($"{nameof(UInt4x4)}[{nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}, {nameof(MatrixIndex)}]"); + /// + /// 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 UInt4x4(uint x) + { + UInt4x4 matrix; + + matrix.m11 = x; + matrix.m12 = x; + matrix.m13 = x; + matrix.m14 = x; + matrix.m21 = x; + matrix.m22 = x; + matrix.m23 = x; + matrix.m24 = x; + matrix.m31 = x; + matrix.m32 = x; + matrix.m33 = x; + matrix.m34 = x; + matrix.m41 = x; + matrix.m42 = x; + matrix.m43 = x; + matrix.m44 = x; + + return matrix; + } + /// /// Negates a value. ///