From 502e5e81facbf37331d02b2a482d24b8939a3d02 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Sat, 23 Sep 2023 23:33:25 +0200 Subject: [PATCH] Implement simple row accessors for matrix types --- .../Primitives/Bool/BoolMxN.g.cs | 64 +++++++++---------- .../Primitives/Bool/BoolMxN.tt | 2 +- .../Primitives/Double/DoubleMxN.g.cs | 64 +++++++++---------- .../Primitives/Double/DoubleMxN.tt | 2 +- .../Primitives/Float/FloatMxN.g.cs | 64 +++++++++---------- .../Primitives/Float/FloatMxN.tt | 2 +- .../Primitives/Int/IntMxN.g.cs | 64 +++++++++---------- .../Primitives/Int/IntMxN.tt | 2 +- .../Primitives/MatrixType.ttinclude | 4 +- .../Primitives/UInt/UIntMxN.g.cs | 64 +++++++++---------- .../Primitives/UInt/UIntMxN.tt | 2 +- 11 files changed, 167 insertions(+), 167 deletions(-) diff --git a/src/ComputeSharp.Core/Primitives/Bool/BoolMxN.g.cs b/src/ComputeSharp.Core/Primitives/Bool/BoolMxN.g.cs index b173a147..2d09df21 100644 --- a/src/ComputeSharp.Core/Primitives/Bool/BoolMxN.g.cs +++ b/src/ComputeSharp.Core/Primitives/Bool/BoolMxN.g.cs @@ -36,10 +36,10 @@ public unsafe partial struct Bool1x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref bool this[int row] => ref *(bool*)UndefinedData; + public ref bool this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(bool) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -184,10 +184,10 @@ public unsafe partial struct Bool1x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Bool2 this[int row] => ref *(Bool2*)UndefinedData; + public ref Bool2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -350,10 +350,10 @@ public unsafe partial struct Bool1x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Bool3 this[int row] => ref *(Bool3*)UndefinedData; + public ref Bool3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -528,10 +528,10 @@ public unsafe partial struct Bool1x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Bool4 this[int row] => ref *(Bool4*)UndefinedData; + public ref Bool4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -703,10 +703,10 @@ public unsafe partial struct Bool2x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref bool this[int row] => ref *(bool*)UndefinedData; + public ref bool this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(bool) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -887,10 +887,10 @@ public unsafe partial struct Bool2x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Bool2 this[int row] => ref *(Bool2*)UndefinedData; + public ref Bool2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -1091,10 +1091,10 @@ public unsafe partial struct Bool2x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Bool3 this[int row] => ref *(Bool3*)UndefinedData; + public ref Bool3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -1321,10 +1321,10 @@ public unsafe partial struct Bool2x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Bool4 this[int row] => ref *(Bool4*)UndefinedData; + public ref Bool4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -1523,10 +1523,10 @@ public unsafe partial struct Bool3x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref bool this[int row] => ref *(bool*)UndefinedData; + public ref bool this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(bool) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -1727,10 +1727,10 @@ public unsafe partial struct Bool3x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Bool2 this[int row] => ref *(Bool2*)UndefinedData; + public ref Bool2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -1964,10 +1964,10 @@ public unsafe partial struct Bool3x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Bool3 this[int row] => ref *(Bool3*)UndefinedData; + public ref Bool3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -2240,10 +2240,10 @@ public unsafe partial struct Bool3x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Bool4 this[int row] => ref *(Bool4*)UndefinedData; + public ref Bool4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -2475,10 +2475,10 @@ public unsafe partial struct Bool4x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref bool this[int row] => ref *(bool*)UndefinedData; + public ref bool this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(bool) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -2699,10 +2699,10 @@ public unsafe partial struct Bool4x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Bool2 this[int row] => ref *(Bool2*)UndefinedData; + public ref Bool2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -2969,10 +2969,10 @@ public unsafe partial struct Bool4x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Bool3 this[int row] => ref *(Bool3*)UndefinedData; + public ref Bool3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -3291,10 +3291,10 @@ public unsafe partial struct Bool4x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Bool4 this[int row] => ref *(Bool4*)UndefinedData; + public ref Bool4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. diff --git a/src/ComputeSharp.Core/Primitives/Bool/BoolMxN.tt b/src/ComputeSharp.Core/Primitives/Bool/BoolMxN.tt index 76a0d8bc..dca930d9 100644 --- a/src/ComputeSharp.Core/Primitives/Bool/BoolMxN.tt +++ b/src/ComputeSharp.Core/Primitives/Bool/BoolMxN.tt @@ -1,4 +1,4 @@ -<#@include file="..\MatrixType.ttinclude" #> +<#@include file="..\MatrixType.ttinclude" #> <# GenerateAllMatrixProperties("Bool", sizeof(int)); #> \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Double/DoubleMxN.g.cs b/src/ComputeSharp.Core/Primitives/Double/DoubleMxN.g.cs index f946b9c5..5657f6e2 100644 --- a/src/ComputeSharp.Core/Primitives/Double/DoubleMxN.g.cs +++ b/src/ComputeSharp.Core/Primitives/Double/DoubleMxN.g.cs @@ -36,10 +36,10 @@ public unsafe partial struct Double1x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref double this[int row] => ref *(double*)UndefinedData; + public ref double this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(double) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -238,10 +238,10 @@ public unsafe partial struct Double1x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Double2 this[int row] => ref *(Double2*)UndefinedData; + public ref Double2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -458,10 +458,10 @@ public unsafe partial struct Double1x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Double3 this[int row] => ref *(Double3*)UndefinedData; + public ref Double3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -690,10 +690,10 @@ public unsafe partial struct Double1x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Double4 this[int row] => ref *(Double4*)UndefinedData; + public ref Double4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -919,10 +919,10 @@ public unsafe partial struct Double2x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref double this[int row] => ref *(double*)UndefinedData; + public ref double this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(double) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -1157,10 +1157,10 @@ public unsafe partial struct Double2x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Double2 this[int row] => ref *(Double2*)UndefinedData; + public ref Double2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -1415,10 +1415,10 @@ public unsafe partial struct Double2x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Double3 this[int row] => ref *(Double3*)UndefinedData; + public ref Double3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -1699,10 +1699,10 @@ public unsafe partial struct Double2x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Double4 this[int row] => ref *(Double4*)UndefinedData; + public ref Double4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -1955,10 +1955,10 @@ public unsafe partial struct Double3x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref double this[int row] => ref *(double*)UndefinedData; + public ref double this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(double) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -2213,10 +2213,10 @@ public unsafe partial struct Double3x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Double2 this[int row] => ref *(Double2*)UndefinedData; + public ref Double2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -2504,10 +2504,10 @@ public unsafe partial struct Double3x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Double3 this[int row] => ref *(Double3*)UndefinedData; + public ref Double3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -2834,10 +2834,10 @@ public unsafe partial struct Double3x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Double4 this[int row] => ref *(Double4*)UndefinedData; + public ref Double4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -3123,10 +3123,10 @@ public unsafe partial struct Double4x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref double this[int row] => ref *(double*)UndefinedData; + public ref double this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(double) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -3401,10 +3401,10 @@ public unsafe partial struct Double4x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Double2 this[int row] => ref *(Double2*)UndefinedData; + public ref Double2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -3725,10 +3725,10 @@ public unsafe partial struct Double4x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Double3 this[int row] => ref *(Double3*)UndefinedData; + public ref Double3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -4101,10 +4101,10 @@ public unsafe partial struct Double4x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Double4 this[int row] => ref *(Double4*)UndefinedData; + public ref Double4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. diff --git a/src/ComputeSharp.Core/Primitives/Double/DoubleMxN.tt b/src/ComputeSharp.Core/Primitives/Double/DoubleMxN.tt index 6ecc4f82..93988f0d 100644 --- a/src/ComputeSharp.Core/Primitives/Double/DoubleMxN.tt +++ b/src/ComputeSharp.Core/Primitives/Double/DoubleMxN.tt @@ -1,4 +1,4 @@ -<#@include file="..\MatrixType.ttinclude" #> +<#@include file="..\MatrixType.ttinclude" #> <# GenerateAllMatrixProperties("Double", sizeof(double)); #> \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Float/FloatMxN.g.cs b/src/ComputeSharp.Core/Primitives/Float/FloatMxN.g.cs index 33554337..d0585c39 100644 --- a/src/ComputeSharp.Core/Primitives/Float/FloatMxN.g.cs +++ b/src/ComputeSharp.Core/Primitives/Float/FloatMxN.g.cs @@ -37,10 +37,10 @@ public unsafe partial struct Float1x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref float this[int row] => ref *(float*)UndefinedData; + public ref float this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(float) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -257,10 +257,10 @@ public unsafe partial struct Float1x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Float2 this[int row] => ref *(Float2*)UndefinedData; + public ref Float2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -579,10 +579,10 @@ public unsafe partial struct Float1x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Float3 this[int row] => ref *(Float3*)UndefinedData; + public ref Float3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -913,10 +913,10 @@ public unsafe partial struct Float1x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Float4 this[int row] => ref *(Float4*)UndefinedData; + public ref Float4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -1244,10 +1244,10 @@ public unsafe partial struct Float2x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref float this[int row] => ref *(float*)UndefinedData; + public ref float this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(float) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -1570,10 +1570,10 @@ public unsafe partial struct Float2x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Float2 this[int row] => ref *(Float2*)UndefinedData; + public ref Float2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -1846,10 +1846,10 @@ public unsafe partial struct Float2x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Float3 this[int row] => ref *(Float3*)UndefinedData; + public ref Float3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -2232,10 +2232,10 @@ public unsafe partial struct Float2x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Float4 this[int row] => ref *(Float4*)UndefinedData; + public ref Float4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -2590,10 +2590,10 @@ public unsafe partial struct Float3x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref float this[int row] => ref *(float*)UndefinedData; + public ref float this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(float) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -2936,10 +2936,10 @@ public unsafe partial struct Float3x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Float2 this[int row] => ref *(Float2*)UndefinedData; + public ref Float2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -3329,10 +3329,10 @@ public unsafe partial struct Float3x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Float3 this[int row] => ref *(Float3*)UndefinedData; + public ref Float3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -3677,10 +3677,10 @@ public unsafe partial struct Float3x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Float4 this[int row] => ref *(Float4*)UndefinedData; + public ref Float4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -4068,10 +4068,10 @@ public unsafe partial struct Float4x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref float this[int row] => ref *(float*)UndefinedData; + public ref float this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(float) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -4434,10 +4434,10 @@ public unsafe partial struct Float4x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Float2 this[int row] => ref *(Float2*)UndefinedData; + public ref Float2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -4860,10 +4860,10 @@ public unsafe partial struct Float4x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Float3 this[int row] => ref *(Float3*)UndefinedData; + public ref Float3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -5338,10 +5338,10 @@ public unsafe partial struct Float4x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Float4 this[int row] => ref *(Float4*)UndefinedData; + public ref Float4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. diff --git a/src/ComputeSharp.Core/Primitives/Float/FloatMxN.tt b/src/ComputeSharp.Core/Primitives/Float/FloatMxN.tt index 97755751..3d816407 100644 --- a/src/ComputeSharp.Core/Primitives/Float/FloatMxN.tt +++ b/src/ComputeSharp.Core/Primitives/Float/FloatMxN.tt @@ -1,4 +1,4 @@ -<#@include file="..\MatrixType.ttinclude" #> +<#@include file="..\MatrixType.ttinclude" #> <# GenerateAllMatrixProperties("Float", sizeof(float)); #> \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/Int/IntMxN.g.cs b/src/ComputeSharp.Core/Primitives/Int/IntMxN.g.cs index a092d2b5..3a0bed1a 100644 --- a/src/ComputeSharp.Core/Primitives/Int/IntMxN.g.cs +++ b/src/ComputeSharp.Core/Primitives/Int/IntMxN.g.cs @@ -37,10 +37,10 @@ public unsafe partial struct Int1x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref int this[int row] => ref *(int*)UndefinedData; + public ref int this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(int) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -355,10 +355,10 @@ public unsafe partial struct Int1x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Int2 this[int row] => ref *(Int2*)UndefinedData; + public ref Int2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -775,10 +775,10 @@ public unsafe partial struct Int1x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Int3 this[int row] => ref *(Int3*)UndefinedData; + public ref Int3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -1207,10 +1207,10 @@ public unsafe partial struct Int1x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Int4 this[int row] => ref *(Int4*)UndefinedData; + public ref Int4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -1636,10 +1636,10 @@ public unsafe partial struct Int2x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref int this[int row] => ref *(int*)UndefinedData; + public ref int this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(int) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -2060,10 +2060,10 @@ public unsafe partial struct Int2x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Int2 this[int row] => ref *(Int2*)UndefinedData; + public ref Int2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -2434,10 +2434,10 @@ public unsafe partial struct Int2x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Int3 this[int row] => ref *(Int3*)UndefinedData; + public ref Int3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -2918,10 +2918,10 @@ public unsafe partial struct Int2x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Int4 this[int row] => ref *(Int4*)UndefinedData; + public ref Int4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -3374,10 +3374,10 @@ public unsafe partial struct Int3x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref int this[int row] => ref *(int*)UndefinedData; + public ref int this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(int) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -3818,10 +3818,10 @@ public unsafe partial struct Int3x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Int2 this[int row] => ref *(Int2*)UndefinedData; + public ref Int2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -4309,10 +4309,10 @@ public unsafe partial struct Int3x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Int3 this[int row] => ref *(Int3*)UndefinedData; + public ref Int3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -4755,10 +4755,10 @@ public unsafe partial struct Int3x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Int4 this[int row] => ref *(Int4*)UndefinedData; + public ref Int4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -5244,10 +5244,10 @@ public unsafe partial struct Int4x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref int this[int row] => ref *(int*)UndefinedData; + public ref int this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(int) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -5708,10 +5708,10 @@ public unsafe partial struct Int4x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Int2 this[int row] => ref *(Int2*)UndefinedData; + public ref Int2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -6232,10 +6232,10 @@ public unsafe partial struct Int4x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Int3 this[int row] => ref *(Int3*)UndefinedData; + public ref Int3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -6808,10 +6808,10 @@ public unsafe partial struct Int4x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref Int4 this[int row] => ref *(Int4*)UndefinedData; + public ref Int4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. diff --git a/src/ComputeSharp.Core/Primitives/Int/IntMxN.tt b/src/ComputeSharp.Core/Primitives/Int/IntMxN.tt index bf70cf4d..71f5f0c2 100644 --- a/src/ComputeSharp.Core/Primitives/Int/IntMxN.tt +++ b/src/ComputeSharp.Core/Primitives/Int/IntMxN.tt @@ -1,4 +1,4 @@ -<#@include file="..\MatrixType.ttinclude" #> +<#@include file="..\MatrixType.ttinclude" #> <# GenerateAllMatrixProperties("Int", sizeof(int)); #> \ No newline at end of file diff --git a/src/ComputeSharp.Core/Primitives/MatrixType.ttinclude b/src/ComputeSharp.Core/Primitives/MatrixType.ttinclude index ab58fef3..9c5a9d0a 100644 --- a/src/ComputeSharp.Core/Primitives/MatrixType.ttinclude +++ b/src/ComputeSharp.Core/Primitives/MatrixType.ttinclude @@ -152,10 +152,10 @@ public unsafe partial struct <#=fullTypeName#> /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref <#=rowTypeName#> this[int row] => ref *(<#=rowTypeName#>*)UndefinedData; + public ref <#=rowTypeName#> this[int row] => ref Unsafe.As<<#=fieldElementTypeName#>, <#=rowTypeName#>>(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(<#=rowTypeName#>) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. diff --git a/src/ComputeSharp.Core/Primitives/UInt/UIntMxN.g.cs b/src/ComputeSharp.Core/Primitives/UInt/UIntMxN.g.cs index 14df1cf2..7f1a728c 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UIntMxN.g.cs +++ b/src/ComputeSharp.Core/Primitives/UInt/UIntMxN.g.cs @@ -36,10 +36,10 @@ public unsafe partial struct UInt1x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref uint this[int row] => ref *(uint*)UndefinedData; + public ref uint this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(uint) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -329,10 +329,10 @@ public unsafe partial struct UInt1x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref UInt2 this[int row] => ref *(UInt2*)UndefinedData; + public ref UInt2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -640,10 +640,10 @@ public unsafe partial struct UInt1x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref UInt3 this[int row] => ref *(UInt3*)UndefinedData; + public ref UInt3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -963,10 +963,10 @@ public unsafe partial struct UInt1x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref UInt4 this[int row] => ref *(UInt4*)UndefinedData; + public ref UInt4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -1283,10 +1283,10 @@ public unsafe partial struct UInt2x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref uint this[int row] => ref *(uint*)UndefinedData; + public ref uint this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(uint) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -1612,10 +1612,10 @@ public unsafe partial struct UInt2x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref UInt2 this[int row] => ref *(UInt2*)UndefinedData; + public ref UInt2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -1961,10 +1961,10 @@ public unsafe partial struct UInt2x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref UInt3 this[int row] => ref *(UInt3*)UndefinedData; + public ref UInt3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -2336,10 +2336,10 @@ public unsafe partial struct UInt2x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref UInt4 this[int row] => ref *(UInt4*)UndefinedData; + public ref UInt4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -2683,10 +2683,10 @@ public unsafe partial struct UInt3x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref uint this[int row] => ref *(uint*)UndefinedData; + public ref uint this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(uint) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -3032,10 +3032,10 @@ public unsafe partial struct UInt3x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref UInt2 this[int row] => ref *(UInt2*)UndefinedData; + public ref UInt2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -3414,10 +3414,10 @@ public unsafe partial struct UInt3x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref UInt3 this[int row] => ref *(UInt3*)UndefinedData; + public ref UInt3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -3835,10 +3835,10 @@ public unsafe partial struct UInt3x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref UInt4 this[int row] => ref *(UInt4*)UndefinedData; + public ref UInt4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -4215,10 +4215,10 @@ public unsafe partial struct UInt4x1 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref uint this[int row] => ref *(uint*)UndefinedData; + public ref uint this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(uint) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -4584,10 +4584,10 @@ public unsafe partial struct UInt4x2 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref UInt2 this[int row] => ref *(UInt2*)UndefinedData; + public ref UInt2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt2) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -4999,10 +4999,10 @@ public unsafe partial struct UInt4x3 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref UInt3 this[int row] => ref *(UInt3*)UndefinedData; + public ref UInt3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt3) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. @@ -5466,10 +5466,10 @@ public unsafe partial struct UInt4x4 /// The row to access. /// /// Unlike with vector types, these properties cannot validate in advance which combinations are writeable, so callers should ensure proper use. - /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. + /// Invoking this method with an invalid row argument results in undefined behavior. /// [UnscopedRef] - public ref UInt4 this[int row] => ref *(UInt4*)UndefinedData; + public ref UInt4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt4) * row))); /// /// Gets a swizzled reference to a specific sequence of items in the current instance. diff --git a/src/ComputeSharp.Core/Primitives/UInt/UIntMxN.tt b/src/ComputeSharp.Core/Primitives/UInt/UIntMxN.tt index 59d27cd9..2ea2fb43 100644 --- a/src/ComputeSharp.Core/Primitives/UInt/UIntMxN.tt +++ b/src/ComputeSharp.Core/Primitives/UInt/UIntMxN.tt @@ -1,4 +1,4 @@ -<#@include file="..\MatrixType.ttinclude" #> +<#@include file="..\MatrixType.ttinclude" #> <# GenerateAllMatrixProperties("UInt", sizeof(uint)); #> \ No newline at end of file