From f636eb590e596f5b334c50327f5f1881e998ff83 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 15 Mar 2021 22:06:37 +0100 Subject: [PATCH 1/3] Implemented ToString() formatting to HLSL vector types --- src/ComputeSharp/Core/Primitives/Bool/Bool.cs | 4 +- .../Core/Primitives/Bool/Bool2.cs | 5 +- .../Core/Primitives/Bool/Bool2.g.cs | 21 ++++- .../Core/Primitives/Bool/Bool3.cs | 5 +- .../Core/Primitives/Bool/Bool3.g.cs | 23 ++++- .../Core/Primitives/Bool/Bool4.cs | 5 +- .../Core/Primitives/Bool/Bool4.g.cs | 25 +++++- .../Core/Primitives/Double/Double2.cs | 5 +- .../Core/Primitives/Double/Double2.g.cs | 32 ++++++- .../Core/Primitives/Double/Double3.cs | 5 +- .../Core/Primitives/Double/Double3.g.cs | 35 +++++++- .../Core/Primitives/Double/Double4.cs | 5 +- .../Core/Primitives/Double/Double4.g.cs | 38 +++++++- .../Core/Primitives/Float/Float2.cs | 4 +- .../Core/Primitives/Float/Float2.g.cs | 32 ++++++- .../Core/Primitives/Float/Float3.cs | 4 +- .../Core/Primitives/Float/Float3.g.cs | 35 +++++++- .../Core/Primitives/Float/Float4.cs | 4 +- .../Core/Primitives/Float/Float4.g.cs | 38 +++++++- src/ComputeSharp/Core/Primitives/Int/Int2.cs | 5 +- .../Core/Primitives/Int/Int2.g.cs | 32 ++++++- src/ComputeSharp/Core/Primitives/Int/Int3.cs | 5 +- .../Core/Primitives/Int/Int3.g.cs | 35 +++++++- src/ComputeSharp/Core/Primitives/Int/Int4.cs | 5 +- .../Core/Primitives/Int/Int4.g.cs | 38 +++++++- .../Core/Primitives/UInt/UInt2.cs | 5 +- .../Core/Primitives/UInt/UInt2.g.cs | 32 ++++++- .../Core/Primitives/UInt/UInt3.cs | 5 +- .../Core/Primitives/UInt/UInt3.g.cs | 35 +++++++- .../Core/Primitives/UInt/UInt4.cs | 5 +- .../Core/Primitives/UInt/UInt4.g.cs | 38 +++++++- .../Core/Primitives/VectorType.ttinclude | 87 ++++++++++++++++++- 32 files changed, 564 insertions(+), 88 deletions(-) diff --git a/src/ComputeSharp/Core/Primitives/Bool/Bool.cs b/src/ComputeSharp/Core/Primitives/Bool/Bool.cs index 8af16442..58b539b4 100644 --- a/src/ComputeSharp/Core/Primitives/Bool/Bool.cs +++ b/src/ComputeSharp/Core/Primitives/Bool/Bool.cs @@ -1,12 +1,10 @@ -using System.Diagnostics; -using System.Runtime.InteropServices; +using System.Runtime.InteropServices; namespace ComputeSharp { /// /// A that can be used in place of the type in HLSL shaders. /// - [DebuggerDisplay("{Value}")] [StructLayout(LayoutKind.Explicit, Size = sizeof(int), Pack = 4)] public readonly struct Bool { diff --git a/src/ComputeSharp/Core/Primitives/Bool/Bool2.cs b/src/ComputeSharp/Core/Primitives/Bool/Bool2.cs index ad578a8a..95729603 100644 --- a/src/ComputeSharp/Core/Primitives/Bool/Bool2.cs +++ b/src/ComputeSharp/Core/Primitives/Bool/Bool2.cs @@ -1,11 +1,8 @@ -using System.Diagnostics; - -namespace ComputeSharp +namespace ComputeSharp { /// /// A that maps the HLSL type. /// - [DebuggerDisplay("({X}, {Y})")] public partial struct Bool2 { /// diff --git a/src/ComputeSharp/Core/Primitives/Bool/Bool2.g.cs b/src/ComputeSharp/Core/Primitives/Bool/Bool2.g.cs index be78cec9..c5935638 100644 --- a/src/ComputeSharp/Core/Primitives/Bool/Bool2.g.cs +++ b/src/ComputeSharp/Core/Primitives/Bool/Bool2.g.cs @@ -1,10 +1,15 @@ -using System.Runtime.CompilerServices; +using System; +using System.Globalization; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Text; #if !NET5_0 using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers; using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal; #endif +#nullable enable + namespace ComputeSharp { /// @@ -96,5 +101,19 @@ namespace ComputeSharp /// /// 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 readonly ref readonly Bool2 GG => ref *(Bool2*)UndefinedData; + + /// + public override readonly string ToString() + { + StringBuilder sb = new(); + + sb.Append('<'); + sb.Append(this.x); + sb.Append(", "); + sb.Append(this.y); + sb.Append('>'); + + return sb.ToString(); + } } } diff --git a/src/ComputeSharp/Core/Primitives/Bool/Bool3.cs b/src/ComputeSharp/Core/Primitives/Bool/Bool3.cs index c52d99d2..0cef513a 100644 --- a/src/ComputeSharp/Core/Primitives/Bool/Bool3.cs +++ b/src/ComputeSharp/Core/Primitives/Bool/Bool3.cs @@ -1,11 +1,8 @@ -using System.Diagnostics; - -namespace ComputeSharp +namespace ComputeSharp { /// /// A that maps the HLSL type. /// - [DebuggerDisplay("({X}, {Y}, {Z})")] public partial struct Bool3 { /// diff --git a/src/ComputeSharp/Core/Primitives/Bool/Bool3.g.cs b/src/ComputeSharp/Core/Primitives/Bool/Bool3.g.cs index f4c603be..42a59fa3 100644 --- a/src/ComputeSharp/Core/Primitives/Bool/Bool3.g.cs +++ b/src/ComputeSharp/Core/Primitives/Bool/Bool3.g.cs @@ -1,10 +1,15 @@ -using System.Runtime.CompilerServices; +using System; +using System.Globalization; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Text; #if !NET5_0 using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers; using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal; #endif +#nullable enable + namespace ComputeSharp { /// @@ -493,5 +498,21 @@ namespace ComputeSharp /// /// 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 readonly ref readonly Bool3 BBB => ref *(Bool3*)UndefinedData; + + /// + public override readonly string ToString() + { + StringBuilder sb = new(); + + sb.Append('<'); + sb.Append(this.x); + sb.Append(", "); + sb.Append(this.y); + sb.Append(", "); + sb.Append(this.z); + sb.Append('>'); + + return sb.ToString(); + } } } diff --git a/src/ComputeSharp/Core/Primitives/Bool/Bool4.cs b/src/ComputeSharp/Core/Primitives/Bool/Bool4.cs index 305cc760..7323ed77 100644 --- a/src/ComputeSharp/Core/Primitives/Bool/Bool4.cs +++ b/src/ComputeSharp/Core/Primitives/Bool/Bool4.cs @@ -1,11 +1,8 @@ -using System.Diagnostics; - -namespace ComputeSharp +namespace ComputeSharp { /// /// A that maps the HLSL type. /// - [DebuggerDisplay("({X}, {Y}, {Z}, {W})")] public partial struct Bool4 { /// diff --git a/src/ComputeSharp/Core/Primitives/Bool/Bool4.g.cs b/src/ComputeSharp/Core/Primitives/Bool/Bool4.g.cs index d93c7839..f54edec5 100644 --- a/src/ComputeSharp/Core/Primitives/Bool/Bool4.g.cs +++ b/src/ComputeSharp/Core/Primitives/Bool/Bool4.g.cs @@ -1,10 +1,15 @@ -using System.Runtime.CompilerServices; +using System; +using System.Globalization; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Text; #if !NET5_0 using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers; using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal; #endif +#nullable enable + namespace ComputeSharp { /// @@ -4106,5 +4111,23 @@ namespace ComputeSharp /// /// 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 readonly ref readonly Bool4 AAAA => ref *(Bool4*)UndefinedData; + + /// + public override readonly string ToString() + { + StringBuilder sb = new(); + + sb.Append('<'); + sb.Append(this.x); + sb.Append(", "); + sb.Append(this.y); + sb.Append(", "); + sb.Append(this.z); + sb.Append(", "); + sb.Append(this.w); + sb.Append('>'); + + return sb.ToString(); + } } } diff --git a/src/ComputeSharp/Core/Primitives/Double/Double2.cs b/src/ComputeSharp/Core/Primitives/Double/Double2.cs index 45b9cafc..d18591e1 100644 --- a/src/ComputeSharp/Core/Primitives/Double/Double2.cs +++ b/src/ComputeSharp/Core/Primitives/Double/Double2.cs @@ -1,11 +1,8 @@ -using System.Diagnostics; - -namespace ComputeSharp +namespace ComputeSharp { /// /// A that maps the HLSL type. /// - [DebuggerDisplay("({X}, {Y})")] public partial struct Double2 { /// diff --git a/src/ComputeSharp/Core/Primitives/Double/Double2.g.cs b/src/ComputeSharp/Core/Primitives/Double/Double2.g.cs index b1b6a5ae..739973c1 100644 --- a/src/ComputeSharp/Core/Primitives/Double/Double2.g.cs +++ b/src/ComputeSharp/Core/Primitives/Double/Double2.g.cs @@ -1,15 +1,20 @@ -using System.Runtime.CompilerServices; +using System; +using System.Globalization; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Text; #if !NET5_0 using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers; using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal; #endif +#nullable enable + namespace ComputeSharp { /// [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 8)] - public unsafe partial struct Double2 + public unsafe partial struct Double2 : IFormattable { /// /// A private buffer to which the undefined properties will point to. @@ -97,6 +102,29 @@ namespace ComputeSharp /// 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 readonly ref readonly Double2 GG => ref *(Double2*)UndefinedData; + /// + public override readonly string ToString() + { + return ToString("G", CultureInfo.CurrentCulture); + } + + /// + public readonly string ToString(string? format, IFormatProvider? formatProvider) + { + StringBuilder sb = new(); + + string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; + + sb.Append('<'); + sb.Append(this.x.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.y.ToString(format, formatProvider)); + sb.Append('>'); + + return sb.ToString(); + } + /// /// Negates a value. /// diff --git a/src/ComputeSharp/Core/Primitives/Double/Double3.cs b/src/ComputeSharp/Core/Primitives/Double/Double3.cs index 508e6c09..b5ef0088 100644 --- a/src/ComputeSharp/Core/Primitives/Double/Double3.cs +++ b/src/ComputeSharp/Core/Primitives/Double/Double3.cs @@ -1,11 +1,8 @@ -using System.Diagnostics; - -namespace ComputeSharp +namespace ComputeSharp { /// /// A that maps the HLSL type. /// - [DebuggerDisplay("({X}, {Y}, {Z})")] public partial struct Double3 { /// diff --git a/src/ComputeSharp/Core/Primitives/Double/Double3.g.cs b/src/ComputeSharp/Core/Primitives/Double/Double3.g.cs index 1637c7fa..00d65371 100644 --- a/src/ComputeSharp/Core/Primitives/Double/Double3.g.cs +++ b/src/ComputeSharp/Core/Primitives/Double/Double3.g.cs @@ -1,15 +1,20 @@ -using System.Runtime.CompilerServices; +using System; +using System.Globalization; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Text; #if !NET5_0 using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers; using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal; #endif +#nullable enable + namespace ComputeSharp { /// [StructLayout(LayoutKind.Explicit, Size = 24, Pack = 8)] - public unsafe partial struct Double3 + public unsafe partial struct Double3 : IFormattable { /// /// A private buffer to which the undefined properties will point to. @@ -494,6 +499,32 @@ namespace ComputeSharp /// 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 readonly ref readonly Double3 BBB => ref *(Double3*)UndefinedData; + /// + public override readonly string ToString() + { + return ToString("G", CultureInfo.CurrentCulture); + } + + /// + public readonly string ToString(string? format, IFormatProvider? formatProvider) + { + StringBuilder sb = new(); + + string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; + + sb.Append('<'); + sb.Append(this.x.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.y.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.z.ToString(format, formatProvider)); + sb.Append('>'); + + return sb.ToString(); + } + /// /// Negates a value. /// diff --git a/src/ComputeSharp/Core/Primitives/Double/Double4.cs b/src/ComputeSharp/Core/Primitives/Double/Double4.cs index c4e231bd..371f3ada 100644 --- a/src/ComputeSharp/Core/Primitives/Double/Double4.cs +++ b/src/ComputeSharp/Core/Primitives/Double/Double4.cs @@ -1,11 +1,8 @@ -using System.Diagnostics; - -namespace ComputeSharp +namespace ComputeSharp { /// /// A that maps the HLSL type. /// - [DebuggerDisplay("({X}, {Y}, {Z}, {W})")] public partial struct Double4 { /// diff --git a/src/ComputeSharp/Core/Primitives/Double/Double4.g.cs b/src/ComputeSharp/Core/Primitives/Double/Double4.g.cs index e5172ae9..02f44345 100644 --- a/src/ComputeSharp/Core/Primitives/Double/Double4.g.cs +++ b/src/ComputeSharp/Core/Primitives/Double/Double4.g.cs @@ -1,15 +1,20 @@ -using System.Runtime.CompilerServices; +using System; +using System.Globalization; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Text; #if !NET5_0 using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers; using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal; #endif +#nullable enable + namespace ComputeSharp { /// [StructLayout(LayoutKind.Explicit, Size = 32, Pack = 8)] - public unsafe partial struct Double4 + public unsafe partial struct Double4 : IFormattable { /// /// A private buffer to which the undefined properties will point to. @@ -4107,6 +4112,35 @@ namespace ComputeSharp /// 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 readonly ref readonly Double4 AAAA => ref *(Double4*)UndefinedData; + /// + public override readonly string ToString() + { + return ToString("G", CultureInfo.CurrentCulture); + } + + /// + public readonly string ToString(string? format, IFormatProvider? formatProvider) + { + StringBuilder sb = new(); + + string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; + + sb.Append('<'); + sb.Append(this.x.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.y.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.z.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.w.ToString(format, formatProvider)); + sb.Append('>'); + + return sb.ToString(); + } + /// /// Negates a value. /// diff --git a/src/ComputeSharp/Core/Primitives/Float/Float2.cs b/src/ComputeSharp/Core/Primitives/Float/Float2.cs index 50eaaa9d..5360d172 100644 --- a/src/ComputeSharp/Core/Primitives/Float/Float2.cs +++ b/src/ComputeSharp/Core/Primitives/Float/Float2.cs @@ -1,12 +1,10 @@ -using System.Diagnostics; -using System.Numerics; +using System.Numerics; namespace ComputeSharp { /// /// A that maps the HLSL type. /// - [DebuggerDisplay("({X}, {Y})")] public partial struct Float2 { /// diff --git a/src/ComputeSharp/Core/Primitives/Float/Float2.g.cs b/src/ComputeSharp/Core/Primitives/Float/Float2.g.cs index 408fc21f..7a7e7372 100644 --- a/src/ComputeSharp/Core/Primitives/Float/Float2.g.cs +++ b/src/ComputeSharp/Core/Primitives/Float/Float2.g.cs @@ -1,15 +1,20 @@ -using System.Runtime.CompilerServices; +using System; +using System.Globalization; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Text; #if !NET5_0 using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers; using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal; #endif +#nullable enable + namespace ComputeSharp { /// [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 4)] - public unsafe partial struct Float2 + public unsafe partial struct Float2 : IFormattable { /// /// A private buffer to which the undefined properties will point to. @@ -97,6 +102,29 @@ namespace ComputeSharp /// 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 readonly ref readonly Float2 GG => ref *(Float2*)UndefinedData; + /// + public override readonly string ToString() + { + return ToString("G", CultureInfo.CurrentCulture); + } + + /// + public readonly string ToString(string? format, IFormatProvider? formatProvider) + { + StringBuilder sb = new(); + + string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; + + sb.Append('<'); + sb.Append(this.x.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.y.ToString(format, formatProvider)); + sb.Append('>'); + + return sb.ToString(); + } + /// /// Negates a value. /// diff --git a/src/ComputeSharp/Core/Primitives/Float/Float3.cs b/src/ComputeSharp/Core/Primitives/Float/Float3.cs index 5ecfbf25..15af02b1 100644 --- a/src/ComputeSharp/Core/Primitives/Float/Float3.cs +++ b/src/ComputeSharp/Core/Primitives/Float/Float3.cs @@ -1,12 +1,10 @@ -using System.Diagnostics; -using System.Numerics; +using System.Numerics; namespace ComputeSharp { /// /// A that maps the HLSL type. /// - [DebuggerDisplay("({X}, {Y}, {Z})")] public partial struct Float3 { /// diff --git a/src/ComputeSharp/Core/Primitives/Float/Float3.g.cs b/src/ComputeSharp/Core/Primitives/Float/Float3.g.cs index 048a9f2c..d7fa7980 100644 --- a/src/ComputeSharp/Core/Primitives/Float/Float3.g.cs +++ b/src/ComputeSharp/Core/Primitives/Float/Float3.g.cs @@ -1,15 +1,20 @@ -using System.Runtime.CompilerServices; +using System; +using System.Globalization; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Text; #if !NET5_0 using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers; using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal; #endif +#nullable enable + namespace ComputeSharp { /// [StructLayout(LayoutKind.Explicit, Size = 12, Pack = 4)] - public unsafe partial struct Float3 + public unsafe partial struct Float3 : IFormattable { /// /// A private buffer to which the undefined properties will point to. @@ -494,6 +499,32 @@ namespace ComputeSharp /// 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 readonly ref readonly Float3 BBB => ref *(Float3*)UndefinedData; + /// + public override readonly string ToString() + { + return ToString("G", CultureInfo.CurrentCulture); + } + + /// + public readonly string ToString(string? format, IFormatProvider? formatProvider) + { + StringBuilder sb = new(); + + string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; + + sb.Append('<'); + sb.Append(this.x.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.y.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.z.ToString(format, formatProvider)); + sb.Append('>'); + + return sb.ToString(); + } + /// /// Negates a value. /// diff --git a/src/ComputeSharp/Core/Primitives/Float/Float4.cs b/src/ComputeSharp/Core/Primitives/Float/Float4.cs index 44916723..65476089 100644 --- a/src/ComputeSharp/Core/Primitives/Float/Float4.cs +++ b/src/ComputeSharp/Core/Primitives/Float/Float4.cs @@ -1,12 +1,10 @@ -using System.Diagnostics; -using System.Numerics; +using System.Numerics; namespace ComputeSharp { /// /// A that maps the HLSL type. /// - [DebuggerDisplay("({X}, {Y}, {Z}, {W})")] public partial struct Float4 { /// diff --git a/src/ComputeSharp/Core/Primitives/Float/Float4.g.cs b/src/ComputeSharp/Core/Primitives/Float/Float4.g.cs index c997359c..4055e29f 100644 --- a/src/ComputeSharp/Core/Primitives/Float/Float4.g.cs +++ b/src/ComputeSharp/Core/Primitives/Float/Float4.g.cs @@ -1,15 +1,20 @@ -using System.Runtime.CompilerServices; +using System; +using System.Globalization; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Text; #if !NET5_0 using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers; using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal; #endif +#nullable enable + namespace ComputeSharp { /// [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 4)] - public unsafe partial struct Float4 + public unsafe partial struct Float4 : IFormattable { /// /// A private buffer to which the undefined properties will point to. @@ -4107,6 +4112,35 @@ namespace ComputeSharp /// 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 readonly ref readonly Float4 AAAA => ref *(Float4*)UndefinedData; + /// + public override readonly string ToString() + { + return ToString("G", CultureInfo.CurrentCulture); + } + + /// + public readonly string ToString(string? format, IFormatProvider? formatProvider) + { + StringBuilder sb = new(); + + string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; + + sb.Append('<'); + sb.Append(this.x.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.y.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.z.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.w.ToString(format, formatProvider)); + sb.Append('>'); + + return sb.ToString(); + } + /// /// Negates a value. /// diff --git a/src/ComputeSharp/Core/Primitives/Int/Int2.cs b/src/ComputeSharp/Core/Primitives/Int/Int2.cs index ef13a36f..a65bd6d9 100644 --- a/src/ComputeSharp/Core/Primitives/Int/Int2.cs +++ b/src/ComputeSharp/Core/Primitives/Int/Int2.cs @@ -1,11 +1,8 @@ -using System.Diagnostics; - -namespace ComputeSharp +namespace ComputeSharp { /// /// A that maps the HLSL type. /// - [DebuggerDisplay("({X}, {Y})")] public partial struct Int2 { /// diff --git a/src/ComputeSharp/Core/Primitives/Int/Int2.g.cs b/src/ComputeSharp/Core/Primitives/Int/Int2.g.cs index e98ecaf1..b62a0ff5 100644 --- a/src/ComputeSharp/Core/Primitives/Int/Int2.g.cs +++ b/src/ComputeSharp/Core/Primitives/Int/Int2.g.cs @@ -1,15 +1,20 @@ -using System.Runtime.CompilerServices; +using System; +using System.Globalization; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Text; #if !NET5_0 using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers; using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal; #endif +#nullable enable + namespace ComputeSharp { /// [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 4)] - public unsafe partial struct Int2 + public unsafe partial struct Int2 : IFormattable { /// /// A private buffer to which the undefined properties will point to. @@ -97,6 +102,29 @@ namespace ComputeSharp /// 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 readonly ref readonly Int2 GG => ref *(Int2*)UndefinedData; + /// + public override readonly string ToString() + { + return ToString("G", CultureInfo.CurrentCulture); + } + + /// + public readonly string ToString(string? format, IFormatProvider? formatProvider) + { + StringBuilder sb = new(); + + string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; + + sb.Append('<'); + sb.Append(this.x.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.y.ToString(format, formatProvider)); + sb.Append('>'); + + return sb.ToString(); + } + /// /// Negates a value. /// diff --git a/src/ComputeSharp/Core/Primitives/Int/Int3.cs b/src/ComputeSharp/Core/Primitives/Int/Int3.cs index 8690c048..25839169 100644 --- a/src/ComputeSharp/Core/Primitives/Int/Int3.cs +++ b/src/ComputeSharp/Core/Primitives/Int/Int3.cs @@ -1,11 +1,8 @@ -using System.Diagnostics; - -namespace ComputeSharp +namespace ComputeSharp { /// /// A that maps the HLSL type. /// - [DebuggerDisplay("({X}, {Y}, {Z})")] public partial struct Int3 { /// diff --git a/src/ComputeSharp/Core/Primitives/Int/Int3.g.cs b/src/ComputeSharp/Core/Primitives/Int/Int3.g.cs index a30b25cb..dfcf3b7f 100644 --- a/src/ComputeSharp/Core/Primitives/Int/Int3.g.cs +++ b/src/ComputeSharp/Core/Primitives/Int/Int3.g.cs @@ -1,15 +1,20 @@ -using System.Runtime.CompilerServices; +using System; +using System.Globalization; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Text; #if !NET5_0 using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers; using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal; #endif +#nullable enable + namespace ComputeSharp { /// [StructLayout(LayoutKind.Explicit, Size = 12, Pack = 4)] - public unsafe partial struct Int3 + public unsafe partial struct Int3 : IFormattable { /// /// A private buffer to which the undefined properties will point to. @@ -494,6 +499,32 @@ namespace ComputeSharp /// 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 readonly ref readonly Int3 BBB => ref *(Int3*)UndefinedData; + /// + public override readonly string ToString() + { + return ToString("G", CultureInfo.CurrentCulture); + } + + /// + public readonly string ToString(string? format, IFormatProvider? formatProvider) + { + StringBuilder sb = new(); + + string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; + + sb.Append('<'); + sb.Append(this.x.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.y.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.z.ToString(format, formatProvider)); + sb.Append('>'); + + return sb.ToString(); + } + /// /// Negates a value. /// diff --git a/src/ComputeSharp/Core/Primitives/Int/Int4.cs b/src/ComputeSharp/Core/Primitives/Int/Int4.cs index 2b87778e..ad3712fd 100644 --- a/src/ComputeSharp/Core/Primitives/Int/Int4.cs +++ b/src/ComputeSharp/Core/Primitives/Int/Int4.cs @@ -1,11 +1,8 @@ -using System.Diagnostics; - -namespace ComputeSharp +namespace ComputeSharp { /// /// A that maps the HLSL type. /// - [DebuggerDisplay("({X}, {Y}, {Z}, {W})")] public partial struct Int4 { /// diff --git a/src/ComputeSharp/Core/Primitives/Int/Int4.g.cs b/src/ComputeSharp/Core/Primitives/Int/Int4.g.cs index 747fbcbf..2f898b7f 100644 --- a/src/ComputeSharp/Core/Primitives/Int/Int4.g.cs +++ b/src/ComputeSharp/Core/Primitives/Int/Int4.g.cs @@ -1,15 +1,20 @@ -using System.Runtime.CompilerServices; +using System; +using System.Globalization; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Text; #if !NET5_0 using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers; using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal; #endif +#nullable enable + namespace ComputeSharp { /// [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 4)] - public unsafe partial struct Int4 + public unsafe partial struct Int4 : IFormattable { /// /// A private buffer to which the undefined properties will point to. @@ -4107,6 +4112,35 @@ namespace ComputeSharp /// 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 readonly ref readonly Int4 AAAA => ref *(Int4*)UndefinedData; + /// + public override readonly string ToString() + { + return ToString("G", CultureInfo.CurrentCulture); + } + + /// + public readonly string ToString(string? format, IFormatProvider? formatProvider) + { + StringBuilder sb = new(); + + string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; + + sb.Append('<'); + sb.Append(this.x.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.y.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.z.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.w.ToString(format, formatProvider)); + sb.Append('>'); + + return sb.ToString(); + } + /// /// Negates a value. /// diff --git a/src/ComputeSharp/Core/Primitives/UInt/UInt2.cs b/src/ComputeSharp/Core/Primitives/UInt/UInt2.cs index 6db3e55f..b9aa527c 100644 --- a/src/ComputeSharp/Core/Primitives/UInt/UInt2.cs +++ b/src/ComputeSharp/Core/Primitives/UInt/UInt2.cs @@ -1,11 +1,8 @@ -using System.Diagnostics; - -namespace ComputeSharp +namespace ComputeSharp { /// /// A that maps the HLSL type. /// - [DebuggerDisplay("({X}, {Y})")] public partial struct UInt2 { /// diff --git a/src/ComputeSharp/Core/Primitives/UInt/UInt2.g.cs b/src/ComputeSharp/Core/Primitives/UInt/UInt2.g.cs index 04b0c531..a14245f5 100644 --- a/src/ComputeSharp/Core/Primitives/UInt/UInt2.g.cs +++ b/src/ComputeSharp/Core/Primitives/UInt/UInt2.g.cs @@ -1,15 +1,20 @@ -using System.Runtime.CompilerServices; +using System; +using System.Globalization; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Text; #if !NET5_0 using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers; using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal; #endif +#nullable enable + namespace ComputeSharp { /// [StructLayout(LayoutKind.Explicit, Size = 8, Pack = 4)] - public unsafe partial struct UInt2 + public unsafe partial struct UInt2 : IFormattable { /// /// A private buffer to which the undefined properties will point to. @@ -97,6 +102,29 @@ namespace ComputeSharp /// 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 readonly ref readonly UInt2 GG => ref *(UInt2*)UndefinedData; + /// + public override readonly string ToString() + { + return ToString("G", CultureInfo.CurrentCulture); + } + + /// + public readonly string ToString(string? format, IFormatProvider? formatProvider) + { + StringBuilder sb = new(); + + string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; + + sb.Append('<'); + sb.Append(this.x.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.y.ToString(format, formatProvider)); + sb.Append('>'); + + return sb.ToString(); + } + /// /// Sums two values. /// diff --git a/src/ComputeSharp/Core/Primitives/UInt/UInt3.cs b/src/ComputeSharp/Core/Primitives/UInt/UInt3.cs index 2b04f6ab..0fec29a5 100644 --- a/src/ComputeSharp/Core/Primitives/UInt/UInt3.cs +++ b/src/ComputeSharp/Core/Primitives/UInt/UInt3.cs @@ -1,11 +1,8 @@ -using System.Diagnostics; - -namespace ComputeSharp +namespace ComputeSharp { /// /// A that maps the HLSL type. /// - [DebuggerDisplay("({X}, {Y}, {Z})")] public partial struct UInt3 { /// diff --git a/src/ComputeSharp/Core/Primitives/UInt/UInt3.g.cs b/src/ComputeSharp/Core/Primitives/UInt/UInt3.g.cs index fa6414df..034a57f4 100644 --- a/src/ComputeSharp/Core/Primitives/UInt/UInt3.g.cs +++ b/src/ComputeSharp/Core/Primitives/UInt/UInt3.g.cs @@ -1,15 +1,20 @@ -using System.Runtime.CompilerServices; +using System; +using System.Globalization; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Text; #if !NET5_0 using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers; using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal; #endif +#nullable enable + namespace ComputeSharp { /// [StructLayout(LayoutKind.Explicit, Size = 12, Pack = 4)] - public unsafe partial struct UInt3 + public unsafe partial struct UInt3 : IFormattable { /// /// A private buffer to which the undefined properties will point to. @@ -494,6 +499,32 @@ namespace ComputeSharp /// 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 readonly ref readonly UInt3 BBB => ref *(UInt3*)UndefinedData; + /// + public override readonly string ToString() + { + return ToString("G", CultureInfo.CurrentCulture); + } + + /// + public readonly string ToString(string? format, IFormatProvider? formatProvider) + { + StringBuilder sb = new(); + + string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; + + sb.Append('<'); + sb.Append(this.x.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.y.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.z.ToString(format, formatProvider)); + sb.Append('>'); + + return sb.ToString(); + } + /// /// Sums two values. /// diff --git a/src/ComputeSharp/Core/Primitives/UInt/UInt4.cs b/src/ComputeSharp/Core/Primitives/UInt/UInt4.cs index a4ac74d8..6b76e874 100644 --- a/src/ComputeSharp/Core/Primitives/UInt/UInt4.cs +++ b/src/ComputeSharp/Core/Primitives/UInt/UInt4.cs @@ -1,11 +1,8 @@ -using System.Diagnostics; - -namespace ComputeSharp +namespace ComputeSharp { /// /// A that maps the HLSL type. /// - [DebuggerDisplay("({X}, {Y}, {Z}, {W})")] public partial struct UInt4 { /// diff --git a/src/ComputeSharp/Core/Primitives/UInt/UInt4.g.cs b/src/ComputeSharp/Core/Primitives/UInt/UInt4.g.cs index 8fddc481..6c7126dc 100644 --- a/src/ComputeSharp/Core/Primitives/UInt/UInt4.g.cs +++ b/src/ComputeSharp/Core/Primitives/UInt/UInt4.g.cs @@ -1,15 +1,20 @@ -using System.Runtime.CompilerServices; +using System; +using System.Globalization; +using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Text; #if !NET5_0 using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers; using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal; #endif +#nullable enable + namespace ComputeSharp { /// [StructLayout(LayoutKind.Explicit, Size = 16, Pack = 4)] - public unsafe partial struct UInt4 + public unsafe partial struct UInt4 : IFormattable { /// /// A private buffer to which the undefined properties will point to. @@ -4107,6 +4112,35 @@ namespace ComputeSharp /// 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 readonly ref readonly UInt4 AAAA => ref *(UInt4*)UndefinedData; + /// + public override readonly string ToString() + { + return ToString("G", CultureInfo.CurrentCulture); + } + + /// + public readonly string ToString(string? format, IFormatProvider? formatProvider) + { + StringBuilder sb = new(); + + string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; + + sb.Append('<'); + sb.Append(this.x.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.y.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.z.ToString(format, formatProvider)); + sb.Append(separator); + sb.Append(' '); + sb.Append(this.w.ToString(format, formatProvider)); + sb.Append('>'); + + return sb.ToString(); + } + /// /// Sums two values. /// diff --git a/src/ComputeSharp/Core/Primitives/VectorType.ttinclude b/src/ComputeSharp/Core/Primitives/VectorType.ttinclude index 42046416..c248b560 100644 --- a/src/ComputeSharp/Core/Primitives/VectorType.ttinclude +++ b/src/ComputeSharp/Core/Primitives/VectorType.ttinclude @@ -65,19 +65,25 @@ void GenerateVectorProperties(string typeName, int elementSize) string elementTypeName = Regex.Match(typeName, @"^[A-Za-z]+").Value; string hlslElementTypeName = elementTypeName.ToLower(); int i = int.Parse(Regex.Match(typeName, @"\d+$").Value); + string formattable = elementTypeName == "Bool" ? "" : " : IFormattable"; #> +using System; +using System.Globalization; using System.Runtime.CompilerServices; using System.Runtime.InteropServices; +using System.Text; #if !NET5_0 using RuntimeHelpers = ComputeSharp.SourceGenerators.Helpers.RuntimeHelpers; using MemoryMarshal = ComputeSharp.SourceGenerators.Helpers.MemoryMarshal; #endif +#nullable enable + namespace ComputeSharp { /// [StructLayout(LayoutKind.Explicit, Size = <#=(elementSize * i)#>, Pack = <#=elementSize#>)] - public unsafe partial struct <#=typeName#> + public unsafe partial struct <#=typeName#><#=formattable#> { /// /// A private buffer to which the undefined properties will point to. @@ -155,6 +161,85 @@ namespace ComputeSharp PopIndent(); PopIndent(); + WriteLine(""); + + if (elementTypeName == "Bool") + { +#> + /// + public override readonly string ToString() + { + StringBuilder sb = new(); + + sb.Append('<'); +<# + PushIndent(" "); + PushIndent(" "); + PushIndent(" "); + + for (int j = 0; j < i; j++) + { + WriteLine($"sb.Append(this.{"xyzw"[j]});"); + + if (j < i - 1) + { + WriteLine("sb.Append(\", \");"); + } + } + + PopIndent(); + PopIndent(); + PopIndent(); +#> + sb.Append('>'); + + return sb.ToString(); + } +<# + } + else + { +#> + /// + public override readonly string ToString() + { + return ToString("G", CultureInfo.CurrentCulture); + } + + /// + public readonly string ToString(string? format, IFormatProvider? formatProvider) + { + StringBuilder sb = new(); + + string separator = NumberFormatInfo.GetInstance(formatProvider).NumberGroupSeparator; + + sb.Append('<'); +<# + PushIndent(" "); + PushIndent(" "); + PushIndent(" "); + + for (int j = 0; j < i; j++) + { + WriteLine($"sb.Append(this.{"xyzw"[j]}.ToString(format, formatProvider));"); + + if (j < i - 1) + { + WriteLine("sb.Append(separator);"); + WriteLine("sb.Append(' ');"); + } + } + + PopIndent(); + PopIndent(); + PopIndent(); +#> + sb.Append('>'); + + return sb.ToString(); + } +<# + } // Generate the negation operator if (elementTypeName != "Bool" && elementTypeName != "UInt") From ac76fc326823cff83390b79d4e955c8909ab0d85 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 15 Mar 2021 22:14:01 +0100 Subject: [PATCH 2/3] Added bool negation operator to vector types --- src/ComputeSharp/Core/Primitives/Bool/Bool2.g.cs | 7 +++++++ src/ComputeSharp/Core/Primitives/Bool/Bool3.g.cs | 7 +++++++ src/ComputeSharp/Core/Primitives/Bool/Bool4.g.cs | 7 +++++++ src/ComputeSharp/Core/Primitives/VectorType.ttinclude | 5 +++-- 4 files changed, 24 insertions(+), 2 deletions(-) diff --git a/src/ComputeSharp/Core/Primitives/Bool/Bool2.g.cs b/src/ComputeSharp/Core/Primitives/Bool/Bool2.g.cs index c5935638..55dc22ab 100644 --- a/src/ComputeSharp/Core/Primitives/Bool/Bool2.g.cs +++ b/src/ComputeSharp/Core/Primitives/Bool/Bool2.g.cs @@ -115,5 +115,12 @@ namespace ComputeSharp return sb.ToString(); } + + /// + /// Negates a value. + /// + /// The value to negate. + /// 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 Bool2 operator !(Bool2 xy) => default; } } diff --git a/src/ComputeSharp/Core/Primitives/Bool/Bool3.g.cs b/src/ComputeSharp/Core/Primitives/Bool/Bool3.g.cs index 42a59fa3..1c4a4eb6 100644 --- a/src/ComputeSharp/Core/Primitives/Bool/Bool3.g.cs +++ b/src/ComputeSharp/Core/Primitives/Bool/Bool3.g.cs @@ -514,5 +514,12 @@ namespace ComputeSharp return sb.ToString(); } + + /// + /// Negates a value. + /// + /// The value to negate. + /// 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 Bool3 operator !(Bool3 xyz) => default; } } diff --git a/src/ComputeSharp/Core/Primitives/Bool/Bool4.g.cs b/src/ComputeSharp/Core/Primitives/Bool/Bool4.g.cs index f54edec5..208fd259 100644 --- a/src/ComputeSharp/Core/Primitives/Bool/Bool4.g.cs +++ b/src/ComputeSharp/Core/Primitives/Bool/Bool4.g.cs @@ -4129,5 +4129,12 @@ namespace ComputeSharp return sb.ToString(); } + + /// + /// Negates a value. + /// + /// The value to negate. + /// 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 Bool4 operator !(Bool4 xyzw) => default; } } diff --git a/src/ComputeSharp/Core/Primitives/VectorType.ttinclude b/src/ComputeSharp/Core/Primitives/VectorType.ttinclude index c248b560..6ed15886 100644 --- a/src/ComputeSharp/Core/Primitives/VectorType.ttinclude +++ b/src/ComputeSharp/Core/Primitives/VectorType.ttinclude @@ -242,18 +242,19 @@ namespace ComputeSharp } // Generate the negation operator - if (elementTypeName != "Bool" && elementTypeName != "UInt") + if (elementTypeName != "UInt") { WriteLine(""); string argumentName = "xyzw".Substring(0, i); + string operatorName = elementTypeName == "Bool" ? "!" : "-"; #> /// /// Negates a value. /// /// The value to negate. /// 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 <#=typeName#> operator -(<#=typeName#> <#=argumentName#>) => default; + public static <#=typeName#> operator <#=operatorName#>(<#=typeName#> <#=argumentName#>) => default; <# } From 6a144aad1f8601ad1a49b5e2e6f5d3e4d0909fad Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 15 Mar 2021 22:14:16 +0100 Subject: [PATCH 3/3] Added BoolNxM negation operator, fixed operators generation --- .../Core/Primitives/Bool/BoolMxN.g.cs | 544 +----------------- .../Core/Primitives/MatrixType.ttinclude | 8 +- .../Core/Primitives/UInt/UIntMxN.g.cs | 112 ---- 3 files changed, 21 insertions(+), 643 deletions(-) diff --git a/src/ComputeSharp/Core/Primitives/Bool/BoolMxN.g.cs b/src/ComputeSharp/Core/Primitives/Bool/BoolMxN.g.cs index 91d6293b..47bead26 100644 --- a/src/ComputeSharp/Core/Primitives/Bool/BoolMxN.g.cs +++ b/src/ComputeSharp/Core/Primitives/Bool/BoolMxN.g.cs @@ -85,39 +85,7 @@ namespace ComputeSharp /// /// The value to negate. /// 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 Bool1x1 operator -(Bool1x1 matrix) => default; - - /// - /// Sums two values. - /// - /// The first value to sum. - /// The second value to sum. - /// 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 Bool1x1 operator +(Bool1x1 left, Bool1x1 right) => default; - - /// - /// Divides two values (elementwise division). - /// - /// The first value to divide. - /// The second value to divide. - /// 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 Bool1x1 operator /(Bool1x1 left, Bool1x1 right) => default; - - /// - /// Multiplies two values (elementwise product). - /// - /// The first value to multiply. - /// The second value to multiply. - /// 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 Bool1x1 operator *(Bool1x1 left, Bool1x1 right) => default; - - /// - /// Subtracts two values. - /// - /// The first value to subtract. - /// The second value to subtract. - /// 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 Bool1x1 operator -(Bool1x1 left, Bool1x1 right) => default; + public static Bool1x1 operator !(Bool1x1 matrix) => default; } /// @@ -209,39 +177,7 @@ namespace ComputeSharp /// /// The value to negate. /// 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 Bool1x2 operator -(Bool1x2 matrix) => default; - - /// - /// Sums two values. - /// - /// The first value to sum. - /// The second value to sum. - /// 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 Bool1x2 operator +(Bool1x2 left, Bool1x2 right) => default; - - /// - /// Divides two values (elementwise division). - /// - /// The first value to divide. - /// The second value to divide. - /// 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 Bool1x2 operator /(Bool1x2 left, Bool1x2 right) => default; - - /// - /// Multiplies two values (elementwise product). - /// - /// The first value to multiply. - /// The second value to multiply. - /// 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 Bool1x2 operator *(Bool1x2 left, Bool1x2 right) => default; - - /// - /// Subtracts two values. - /// - /// The first value to subtract. - /// The second value to subtract. - /// 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 Bool1x2 operator -(Bool1x2 left, Bool1x2 right) => default; + public static Bool1x2 operator !(Bool1x2 matrix) => default; /// /// Casts a value to a one. @@ -350,39 +286,7 @@ namespace ComputeSharp /// /// The value to negate. /// 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 Bool1x3 operator -(Bool1x3 matrix) => default; - - /// - /// Sums two values. - /// - /// The first value to sum. - /// The second value to sum. - /// 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 Bool1x3 operator +(Bool1x3 left, Bool1x3 right) => default; - - /// - /// Divides two values (elementwise division). - /// - /// The first value to divide. - /// The second value to divide. - /// 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 Bool1x3 operator /(Bool1x3 left, Bool1x3 right) => default; - - /// - /// Multiplies two values (elementwise product). - /// - /// The first value to multiply. - /// The second value to multiply. - /// 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 Bool1x3 operator *(Bool1x3 left, Bool1x3 right) => default; - - /// - /// Subtracts two values. - /// - /// The first value to subtract. - /// The second value to subtract. - /// 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 Bool1x3 operator -(Bool1x3 left, Bool1x3 right) => default; + public static Bool1x3 operator !(Bool1x3 matrix) => default; /// /// Casts a value to a one. @@ -502,39 +406,7 @@ namespace ComputeSharp /// /// The value to negate. /// 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 Bool1x4 operator -(Bool1x4 matrix) => default; - - /// - /// Sums two values. - /// - /// The first value to sum. - /// The second value to sum. - /// 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 Bool1x4 operator +(Bool1x4 left, Bool1x4 right) => default; - - /// - /// Divides two values (elementwise division). - /// - /// The first value to divide. - /// The second value to divide. - /// 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 Bool1x4 operator /(Bool1x4 left, Bool1x4 right) => default; - - /// - /// Multiplies two values (elementwise product). - /// - /// The first value to multiply. - /// The second value to multiply. - /// 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 Bool1x4 operator *(Bool1x4 left, Bool1x4 right) => default; - - /// - /// Subtracts two values. - /// - /// The first value to subtract. - /// The second value to subtract. - /// 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 Bool1x4 operator -(Bool1x4 left, Bool1x4 right) => default; + public static Bool1x4 operator !(Bool1x4 matrix) => default; /// /// Casts a value to a one. @@ -632,39 +504,7 @@ namespace ComputeSharp /// /// The value to negate. /// 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 Bool2x1 operator -(Bool2x1 matrix) => default; - - /// - /// Sums two values. - /// - /// The first value to sum. - /// The second value to sum. - /// 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 Bool2x1 operator +(Bool2x1 left, Bool2x1 right) => default; - - /// - /// Divides two values (elementwise division). - /// - /// The first value to divide. - /// The second value to divide. - /// 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 Bool2x1 operator /(Bool2x1 left, Bool2x1 right) => default; - - /// - /// Multiplies two values (elementwise product). - /// - /// The first value to multiply. - /// The second value to multiply. - /// 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 Bool2x1 operator *(Bool2x1 left, Bool2x1 right) => default; - - /// - /// Subtracts two values. - /// - /// The first value to subtract. - /// The second value to subtract. - /// 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 Bool2x1 operator -(Bool2x1 left, Bool2x1 right) => default; + public static Bool2x1 operator !(Bool2x1 matrix) => default; /// /// Casts a value to a one. @@ -797,39 +637,7 @@ namespace ComputeSharp /// /// The value to negate. /// 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 Bool2x2 operator -(Bool2x2 matrix) => default; - - /// - /// Sums two values. - /// - /// The first value to sum. - /// The second value to sum. - /// 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 Bool2x2 operator +(Bool2x2 left, Bool2x2 right) => default; - - /// - /// Divides two values (elementwise division). - /// - /// The first value to divide. - /// The second value to divide. - /// 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 Bool2x2 operator /(Bool2x2 left, Bool2x2 right) => default; - - /// - /// Multiplies two values (elementwise product). - /// - /// The first value to multiply. - /// The second value to multiply. - /// 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 Bool2x2 operator *(Bool2x2 left, Bool2x2 right) => default; - - /// - /// Subtracts two values. - /// - /// The first value to subtract. - /// The second value to subtract. - /// 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 Bool2x2 operator -(Bool2x2 left, Bool2x2 right) => default; + public static Bool2x2 operator !(Bool2x2 matrix) => default; } /// @@ -980,39 +788,7 @@ namespace ComputeSharp /// /// The value to negate. /// 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 Bool2x3 operator -(Bool2x3 matrix) => default; - - /// - /// Sums two values. - /// - /// The first value to sum. - /// The second value to sum. - /// 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 Bool2x3 operator +(Bool2x3 left, Bool2x3 right) => default; - - /// - /// Divides two values (elementwise division). - /// - /// The first value to divide. - /// The second value to divide. - /// 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 Bool2x3 operator /(Bool2x3 left, Bool2x3 right) => default; - - /// - /// Multiplies two values (elementwise product). - /// - /// The first value to multiply. - /// The second value to multiply. - /// 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 Bool2x3 operator *(Bool2x3 left, Bool2x3 right) => default; - - /// - /// Subtracts two values. - /// - /// The first value to subtract. - /// The second value to subtract. - /// 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 Bool2x3 operator -(Bool2x3 left, Bool2x3 right) => default; + public static Bool2x3 operator !(Bool2x3 matrix) => default; } /// @@ -1187,39 +963,7 @@ namespace ComputeSharp /// /// The value to negate. /// 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 Bool2x4 operator -(Bool2x4 matrix) => default; - - /// - /// Sums two values. - /// - /// The first value to sum. - /// The second value to sum. - /// 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 Bool2x4 operator +(Bool2x4 left, Bool2x4 right) => default; - - /// - /// Divides two values (elementwise division). - /// - /// The first value to divide. - /// The second value to divide. - /// 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 Bool2x4 operator /(Bool2x4 left, Bool2x4 right) => default; - - /// - /// Multiplies two values (elementwise product). - /// - /// The first value to multiply. - /// The second value to multiply. - /// 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 Bool2x4 operator *(Bool2x4 left, Bool2x4 right) => default; - - /// - /// Subtracts two values. - /// - /// The first value to subtract. - /// The second value to subtract. - /// 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 Bool2x4 operator -(Bool2x4 left, Bool2x4 right) => default; + public static Bool2x4 operator !(Bool2x4 matrix) => default; } /// @@ -1322,39 +1066,7 @@ namespace ComputeSharp /// /// The value to negate. /// 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 Bool3x1 operator -(Bool3x1 matrix) => default; - - /// - /// Sums two values. - /// - /// The first value to sum. - /// The second value to sum. - /// 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 Bool3x1 operator +(Bool3x1 left, Bool3x1 right) => default; - - /// - /// Divides two values (elementwise division). - /// - /// The first value to divide. - /// The second value to divide. - /// 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 Bool3x1 operator /(Bool3x1 left, Bool3x1 right) => default; - - /// - /// Multiplies two values (elementwise product). - /// - /// The first value to multiply. - /// The second value to multiply. - /// 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 Bool3x1 operator *(Bool3x1 left, Bool3x1 right) => default; - - /// - /// Subtracts two values. - /// - /// The first value to subtract. - /// The second value to subtract. - /// 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 Bool3x1 operator -(Bool3x1 left, Bool3x1 right) => default; + public static Bool3x1 operator !(Bool3x1 matrix) => default; /// /// Casts a value to a one. @@ -1512,39 +1224,7 @@ namespace ComputeSharp /// /// The value to negate. /// 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 Bool3x2 operator -(Bool3x2 matrix) => default; - - /// - /// Sums two values. - /// - /// The first value to sum. - /// The second value to sum. - /// 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 Bool3x2 operator +(Bool3x2 left, Bool3x2 right) => default; - - /// - /// Divides two values (elementwise division). - /// - /// The first value to divide. - /// The second value to divide. - /// 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 Bool3x2 operator /(Bool3x2 left, Bool3x2 right) => default; - - /// - /// Multiplies two values (elementwise product). - /// - /// The first value to multiply. - /// The second value to multiply. - /// 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 Bool3x2 operator *(Bool3x2 left, Bool3x2 right) => default; - - /// - /// Subtracts two values. - /// - /// The first value to subtract. - /// The second value to subtract. - /// 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 Bool3x2 operator -(Bool3x2 left, Bool3x2 right) => default; + public static Bool3x2 operator !(Bool3x2 matrix) => default; } /// @@ -1732,39 +1412,7 @@ namespace ComputeSharp /// /// The value to negate. /// 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 Bool3x3 operator -(Bool3x3 matrix) => default; - - /// - /// Sums two values. - /// - /// The first value to sum. - /// The second value to sum. - /// 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 Bool3x3 operator +(Bool3x3 left, Bool3x3 right) => default; - - /// - /// Divides two values (elementwise division). - /// - /// The first value to divide. - /// The second value to divide. - /// 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 Bool3x3 operator /(Bool3x3 left, Bool3x3 right) => default; - - /// - /// Multiplies two values (elementwise product). - /// - /// The first value to multiply. - /// The second value to multiply. - /// 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 Bool3x3 operator *(Bool3x3 left, Bool3x3 right) => default; - - /// - /// Subtracts two values. - /// - /// The first value to subtract. - /// The second value to subtract. - /// 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 Bool3x3 operator -(Bool3x3 left, Bool3x3 right) => default; + public static Bool3x3 operator !(Bool3x3 matrix) => default; } /// @@ -1988,39 +1636,7 @@ namespace ComputeSharp /// /// The value to negate. /// 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 Bool3x4 operator -(Bool3x4 matrix) => default; - - /// - /// Sums two values. - /// - /// The first value to sum. - /// The second value to sum. - /// 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 Bool3x4 operator +(Bool3x4 left, Bool3x4 right) => default; - - /// - /// Divides two values (elementwise division). - /// - /// The first value to divide. - /// The second value to divide. - /// 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 Bool3x4 operator /(Bool3x4 left, Bool3x4 right) => default; - - /// - /// Multiplies two values (elementwise product). - /// - /// The first value to multiply. - /// The second value to multiply. - /// 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 Bool3x4 operator *(Bool3x4 left, Bool3x4 right) => default; - - /// - /// Subtracts two values. - /// - /// The first value to subtract. - /// The second value to subtract. - /// 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 Bool3x4 operator -(Bool3x4 left, Bool3x4 right) => default; + public static Bool3x4 operator !(Bool3x4 matrix) => default; } /// @@ -2134,39 +1750,7 @@ namespace ComputeSharp /// /// The value to negate. /// 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 Bool4x1 operator -(Bool4x1 matrix) => default; - - /// - /// Sums two values. - /// - /// The first value to sum. - /// The second value to sum. - /// 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 Bool4x1 operator +(Bool4x1 left, Bool4x1 right) => default; - - /// - /// Divides two values (elementwise division). - /// - /// The first value to divide. - /// The second value to divide. - /// 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 Bool4x1 operator /(Bool4x1 left, Bool4x1 right) => default; - - /// - /// Multiplies two values (elementwise product). - /// - /// The first value to multiply. - /// The second value to multiply. - /// 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 Bool4x1 operator *(Bool4x1 left, Bool4x1 right) => default; - - /// - /// Subtracts two values. - /// - /// The first value to subtract. - /// The second value to subtract. - /// 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 Bool4x1 operator -(Bool4x1 left, Bool4x1 right) => default; + public static Bool4x1 operator !(Bool4x1 matrix) => default; /// /// Casts a value to a one. @@ -2349,39 +1933,7 @@ namespace ComputeSharp /// /// The value to negate. /// 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 Bool4x2 operator -(Bool4x2 matrix) => default; - - /// - /// Sums two values. - /// - /// The first value to sum. - /// The second value to sum. - /// 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 Bool4x2 operator +(Bool4x2 left, Bool4x2 right) => default; - - /// - /// Divides two values (elementwise division). - /// - /// The first value to divide. - /// The second value to divide. - /// 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 Bool4x2 operator /(Bool4x2 left, Bool4x2 right) => default; - - /// - /// Multiplies two values (elementwise product). - /// - /// The first value to multiply. - /// The second value to multiply. - /// 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 Bool4x2 operator *(Bool4x2 left, Bool4x2 right) => default; - - /// - /// Subtracts two values. - /// - /// The first value to subtract. - /// The second value to subtract. - /// 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 Bool4x2 operator -(Bool4x2 left, Bool4x2 right) => default; + public static Bool4x2 operator !(Bool4x2 matrix) => default; } /// @@ -2606,39 +2158,7 @@ namespace ComputeSharp /// /// The value to negate. /// 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 Bool4x3 operator -(Bool4x3 matrix) => default; - - /// - /// Sums two values. - /// - /// The first value to sum. - /// The second value to sum. - /// 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 Bool4x3 operator +(Bool4x3 left, Bool4x3 right) => default; - - /// - /// Divides two values (elementwise division). - /// - /// The first value to divide. - /// The second value to divide. - /// 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 Bool4x3 operator /(Bool4x3 left, Bool4x3 right) => default; - - /// - /// Multiplies two values (elementwise product). - /// - /// The first value to multiply. - /// The second value to multiply. - /// 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 Bool4x3 operator *(Bool4x3 left, Bool4x3 right) => default; - - /// - /// Subtracts two values. - /// - /// The first value to subtract. - /// The second value to subtract. - /// 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 Bool4x3 operator -(Bool4x3 left, Bool4x3 right) => default; + public static Bool4x3 operator !(Bool4x3 matrix) => default; } /// @@ -2911,38 +2431,6 @@ namespace ComputeSharp /// /// The value to negate. /// 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 Bool4x4 operator -(Bool4x4 matrix) => default; - - /// - /// Sums two values. - /// - /// The first value to sum. - /// The second value to sum. - /// 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 Bool4x4 operator +(Bool4x4 left, Bool4x4 right) => default; - - /// - /// Divides two values (elementwise division). - /// - /// The first value to divide. - /// The second value to divide. - /// 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 Bool4x4 operator /(Bool4x4 left, Bool4x4 right) => default; - - /// - /// Multiplies two values (elementwise product). - /// - /// The first value to multiply. - /// The second value to multiply. - /// 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 Bool4x4 operator *(Bool4x4 left, Bool4x4 right) => default; - - /// - /// Subtracts two values. - /// - /// The first value to subtract. - /// The second value to subtract. - /// 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 Bool4x4 operator -(Bool4x4 left, Bool4x4 right) => default; + public static Bool4x4 operator !(Bool4x4 matrix) => default; } } diff --git a/src/ComputeSharp/Core/Primitives/MatrixType.ttinclude b/src/ComputeSharp/Core/Primitives/MatrixType.ttinclude index f9cfabb6..4ab82478 100644 --- a/src/ComputeSharp/Core/Primitives/MatrixType.ttinclude +++ b/src/ComputeSharp/Core/Primitives/MatrixType.ttinclude @@ -203,21 +203,23 @@ void GenerateMatrixProperties(string typeName, int rows, int columns, int elemen PopIndent(); // Generate the negation operator - if (elementTypeName != "Bool" && elementTypeName != "UInt") + if (typeName != "UInt") { WriteLine(""); + + string operatorName = typeName == "Bool" ? "!" : "-"; #> /// /// Negates a value. /// /// The value to negate. /// 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 <#=fullTypeName#> operator -(<#=fullTypeName#> matrix) => default; + public static <#=fullTypeName#> operator <#=operatorName#>(<#=fullTypeName#> matrix) => default; <# } // Generate the numerical operators - if (elementTypeName != "Bool") + if (typeName != "Bool") { WriteLine(""); #> diff --git a/src/ComputeSharp/Core/Primitives/UInt/UIntMxN.g.cs b/src/ComputeSharp/Core/Primitives/UInt/UIntMxN.g.cs index e43e9d7e..0dae3973 100644 --- a/src/ComputeSharp/Core/Primitives/UInt/UIntMxN.g.cs +++ b/src/ComputeSharp/Core/Primitives/UInt/UIntMxN.g.cs @@ -80,13 +80,6 @@ namespace ComputeSharp return matrix; } - /// - /// Negates a value. - /// - /// The value to negate. - /// 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 UInt1x1 operator -(UInt1x1 matrix) => default; - /// /// Sums two values. /// @@ -204,13 +197,6 @@ namespace ComputeSharp return matrix; } - /// - /// Negates a value. - /// - /// The value to negate. - /// 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 UInt1x2 operator -(UInt1x2 matrix) => default; - /// /// Sums two values. /// @@ -345,13 +331,6 @@ namespace ComputeSharp return matrix; } - /// - /// Negates a value. - /// - /// The value to negate. - /// 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 UInt1x3 operator -(UInt1x3 matrix) => default; - /// /// Sums two values. /// @@ -497,13 +476,6 @@ namespace ComputeSharp return matrix; } - /// - /// Negates a value. - /// - /// The value to negate. - /// 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 UInt1x4 operator -(UInt1x4 matrix) => default; - /// /// Sums two values. /// @@ -627,13 +599,6 @@ namespace ComputeSharp return matrix; } - /// - /// Negates a value. - /// - /// The value to negate. - /// 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 UInt2x1 operator -(UInt2x1 matrix) => default; - /// /// Sums two values. /// @@ -792,13 +757,6 @@ namespace ComputeSharp return matrix; } - /// - /// Negates a value. - /// - /// The value to negate. - /// 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 UInt2x2 operator -(UInt2x2 matrix) => default; - /// /// Sums two values. /// @@ -975,13 +933,6 @@ namespace ComputeSharp return matrix; } - /// - /// Negates a value. - /// - /// The value to negate. - /// 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 UInt2x3 operator -(UInt2x3 matrix) => default; - /// /// Sums two values. /// @@ -1182,13 +1133,6 @@ namespace ComputeSharp return matrix; } - /// - /// Negates a value. - /// - /// The value to negate. - /// 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 UInt2x4 operator -(UInt2x4 matrix) => default; - /// /// Sums two values. /// @@ -1317,13 +1261,6 @@ namespace ComputeSharp return matrix; } - /// - /// Negates a value. - /// - /// The value to negate. - /// 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 UInt3x1 operator -(UInt3x1 matrix) => default; - /// /// Sums two values. /// @@ -1507,13 +1444,6 @@ namespace ComputeSharp return matrix; } - /// - /// Negates a value. - /// - /// The value to negate. - /// 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 UInt3x2 operator -(UInt3x2 matrix) => default; - /// /// Sums two values. /// @@ -1727,13 +1657,6 @@ namespace ComputeSharp return matrix; } - /// - /// Negates a value. - /// - /// The value to negate. - /// 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 UInt3x3 operator -(UInt3x3 matrix) => default; - /// /// Sums two values. /// @@ -1983,13 +1906,6 @@ namespace ComputeSharp return matrix; } - /// - /// Negates a value. - /// - /// The value to negate. - /// 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 UInt3x4 operator -(UInt3x4 matrix) => default; - /// /// Sums two values. /// @@ -2129,13 +2045,6 @@ namespace ComputeSharp return matrix; } - /// - /// Negates a value. - /// - /// The value to negate. - /// 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 UInt4x1 operator -(UInt4x1 matrix) => default; - /// /// Sums two values. /// @@ -2344,13 +2253,6 @@ namespace ComputeSharp return matrix; } - /// - /// Negates a value. - /// - /// The value to negate. - /// 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 UInt4x2 operator -(UInt4x2 matrix) => default; - /// /// Sums two values. /// @@ -2601,13 +2503,6 @@ namespace ComputeSharp return matrix; } - /// - /// Negates a value. - /// - /// The value to negate. - /// 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 UInt4x3 operator -(UInt4x3 matrix) => default; - /// /// Sums two values. /// @@ -2906,13 +2801,6 @@ namespace ComputeSharp return matrix; } - /// - /// Negates a value. - /// - /// The value to negate. - /// 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 UInt4x4 operator -(UInt4x4 matrix) => default; - /// /// Sums two values. ///