diff --git a/src/ComputeSharp.Shaders/Primitives/Int/Int2.cs b/src/ComputeSharp.Shaders/Primitives/Int/Int2.cs index ff77fd6b..3fb52e8d 100644 --- a/src/ComputeSharp.Shaders/Primitives/Int/Int2.cs +++ b/src/ComputeSharp.Shaders/Primitives/Int/Int2.cs @@ -113,5 +113,11 @@ namespace ComputeSharp.Shaders.Primitives.Int /// Gets an value with the value for all components /// public Int2 GG => throw new InvalidExecutionContextException($"{nameof(Int2)}.{nameof(GG)}"); + + /// + /// 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 Int2(x, x); } } diff --git a/src/ComputeSharp.Shaders/Primitives/Int/Int3.cs b/src/ComputeSharp.Shaders/Primitives/Int/Int3.cs index cdb62643..f4407028 100644 --- a/src/ComputeSharp.Shaders/Primitives/Int/Int3.cs +++ b/src/ComputeSharp.Shaders/Primitives/Int/Int3.cs @@ -529,5 +529,11 @@ namespace ComputeSharp.Shaders.Primitives.Int /// Gets an value with the value for all components /// public Int2 BBB => throw new InvalidExecutionContextException($"{nameof(Int3)}.{nameof(BBB)}"); + + /// + /// 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 Int3(x, x, x); } } diff --git a/src/ComputeSharp.Shaders/Primitives/Int/Int4.cs b/src/ComputeSharp.Shaders/Primitives/Int/Int4.cs index 9a8707d1..1a5a1888 100644 --- a/src/ComputeSharp.Shaders/Primitives/Int/Int4.cs +++ b/src/ComputeSharp.Shaders/Primitives/Int/Int4.cs @@ -3929,5 +3929,11 @@ namespace ComputeSharp.Shaders.Primitives.Int /// Gets an value with the value for all components /// public Int4 AAAA => throw new InvalidExecutionContextException($"{nameof(Int4)}.{nameof(AAAA)}"); + + /// + /// 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 Int4(x, x, x, x); } }