diff --git a/src/ComputeSharp.Core/Primitives/Bool/BoolMxN.g.cs b/src/ComputeSharp.Core/Primitives/Bool/BoolMxN.g.cs index 2d09df21..b173a147 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref bool this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(bool) * row))); + public ref bool this[int row] => ref *(bool*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Bool2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool2) * row))); + public ref Bool2 this[int row] => ref *(Bool2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Bool3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool3) * row))); + public ref Bool3 this[int row] => ref *(Bool3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Bool4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool4) * row))); + public ref Bool4 this[int row] => ref *(Bool4*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref bool this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(bool) * row))); + public ref bool this[int row] => ref *(bool*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Bool2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool2) * row))); + public ref Bool2 this[int row] => ref *(Bool2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Bool3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool3) * row))); + public ref Bool3 this[int row] => ref *(Bool3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Bool4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool4) * row))); + public ref Bool4 this[int row] => ref *(Bool4*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref bool this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(bool) * row))); + public ref bool this[int row] => ref *(bool*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Bool2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool2) * row))); + public ref Bool2 this[int row] => ref *(Bool2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Bool3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool3) * row))); + public ref Bool3 this[int row] => ref *(Bool3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Bool4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool4) * row))); + public ref Bool4 this[int row] => ref *(Bool4*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref bool this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(bool) * row))); + public ref bool this[int row] => ref *(bool*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Bool2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool2) * row))); + public ref Bool2 this[int row] => ref *(Bool2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Bool3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool3) * row))); + public ref Bool3 this[int row] => ref *(Bool3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Bool4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Bool4) * row))); + public ref Bool4 this[int row] => ref *(Bool4*)UndefinedData; /// /// Gets a swizzled reference to a specific sequence of items in the current instance. diff --git a/src/ComputeSharp.Core/Primitives/Double/DoubleMxN.g.cs b/src/ComputeSharp.Core/Primitives/Double/DoubleMxN.g.cs index 5657f6e2..f946b9c5 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref double this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(double) * row))); + public ref double this[int row] => ref *(double*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Double2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double2) * row))); + public ref Double2 this[int row] => ref *(Double2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Double3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double3) * row))); + public ref Double3 this[int row] => ref *(Double3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Double4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double4) * row))); + public ref Double4 this[int row] => ref *(Double4*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref double this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(double) * row))); + public ref double this[int row] => ref *(double*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Double2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double2) * row))); + public ref Double2 this[int row] => ref *(Double2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Double3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double3) * row))); + public ref Double3 this[int row] => ref *(Double3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Double4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double4) * row))); + public ref Double4 this[int row] => ref *(Double4*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref double this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(double) * row))); + public ref double this[int row] => ref *(double*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Double2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double2) * row))); + public ref Double2 this[int row] => ref *(Double2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Double3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double3) * row))); + public ref Double3 this[int row] => ref *(Double3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Double4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double4) * row))); + public ref Double4 this[int row] => ref *(Double4*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref double this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(double) * row))); + public ref double this[int row] => ref *(double*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Double2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double2) * row))); + public ref Double2 this[int row] => ref *(Double2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Double3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double3) * row))); + public ref Double3 this[int row] => ref *(Double3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Double4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Double4) * row))); + public ref Double4 this[int row] => ref *(Double4*)UndefinedData; /// /// Gets a swizzled reference to a specific sequence of items in the current instance. diff --git a/src/ComputeSharp.Core/Primitives/Float/FloatMxN.g.cs b/src/ComputeSharp.Core/Primitives/Float/FloatMxN.g.cs index d0585c39..33554337 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref float this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(float) * row))); + public ref float this[int row] => ref *(float*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Float2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float2) * row))); + public ref Float2 this[int row] => ref *(Float2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Float3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float3) * row))); + public ref Float3 this[int row] => ref *(Float3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Float4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float4) * row))); + public ref Float4 this[int row] => ref *(Float4*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref float this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(float) * row))); + public ref float this[int row] => ref *(float*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Float2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float2) * row))); + public ref Float2 this[int row] => ref *(Float2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Float3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float3) * row))); + public ref Float3 this[int row] => ref *(Float3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Float4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float4) * row))); + public ref Float4 this[int row] => ref *(Float4*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref float this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(float) * row))); + public ref float this[int row] => ref *(float*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Float2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float2) * row))); + public ref Float2 this[int row] => ref *(Float2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Float3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float3) * row))); + public ref Float3 this[int row] => ref *(Float3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Float4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float4) * row))); + public ref Float4 this[int row] => ref *(Float4*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref float this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(float) * row))); + public ref float this[int row] => ref *(float*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Float2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float2) * row))); + public ref Float2 this[int row] => ref *(Float2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Float3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float3) * row))); + public ref Float3 this[int row] => ref *(Float3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Float4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Float4) * row))); + public ref Float4 this[int row] => ref *(Float4*)UndefinedData; /// /// Gets a swizzled reference to a specific sequence of items in the current instance. diff --git a/src/ComputeSharp.Core/Primitives/Int/IntMxN.g.cs b/src/ComputeSharp.Core/Primitives/Int/IntMxN.g.cs index 3a0bed1a..a092d2b5 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref int this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(int) * row))); + public ref int this[int row] => ref *(int*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Int2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int2) * row))); + public ref Int2 this[int row] => ref *(Int2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Int3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int3) * row))); + public ref Int3 this[int row] => ref *(Int3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Int4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int4) * row))); + public ref Int4 this[int row] => ref *(Int4*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref int this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(int) * row))); + public ref int this[int row] => ref *(int*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Int2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int2) * row))); + public ref Int2 this[int row] => ref *(Int2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Int3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int3) * row))); + public ref Int3 this[int row] => ref *(Int3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Int4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int4) * row))); + public ref Int4 this[int row] => ref *(Int4*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref int this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(int) * row))); + public ref int this[int row] => ref *(int*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Int2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int2) * row))); + public ref Int2 this[int row] => ref *(Int2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Int3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int3) * row))); + public ref Int3 this[int row] => ref *(Int3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Int4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int4) * row))); + public ref Int4 this[int row] => ref *(Int4*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref int this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(int) * row))); + public ref int this[int row] => ref *(int*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Int2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int2) * row))); + public ref Int2 this[int row] => ref *(Int2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Int3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int3) * row))); + public ref Int3 this[int row] => ref *(Int3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref Int4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(Int4) * row))); + public ref Int4 this[int row] => ref *(Int4*)UndefinedData; /// /// Gets a swizzled reference to a specific sequence of items in the current instance. diff --git a/src/ComputeSharp.Core/Primitives/MatrixType.ttinclude b/src/ComputeSharp.Core/Primitives/MatrixType.ttinclude index 9c5a9d0a..ab58fef3 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref <#=rowTypeName#> this[int row] => ref Unsafe.As<<#=fieldElementTypeName#>, <#=rowTypeName#>>(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(<#=rowTypeName#>) * row))); + public ref <#=rowTypeName#> this[int row] => ref *(<#=rowTypeName#>*)UndefinedData; /// /// 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 7f1a728c..14df1cf2 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref uint this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(uint) * row))); + public ref uint this[int row] => ref *(uint*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref UInt2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt2) * row))); + public ref UInt2 this[int row] => ref *(UInt2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref UInt3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt3) * row))); + public ref UInt3 this[int row] => ref *(UInt3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref UInt4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt4) * row))); + public ref UInt4 this[int row] => ref *(UInt4*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref uint this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(uint) * row))); + public ref uint this[int row] => ref *(uint*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref UInt2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt2) * row))); + public ref UInt2 this[int row] => ref *(UInt2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref UInt3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt3) * row))); + public ref UInt3 this[int row] => ref *(UInt3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref UInt4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt4) * row))); + public ref UInt4 this[int row] => ref *(UInt4*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref uint this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(uint) * row))); + public ref uint this[int row] => ref *(uint*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref UInt2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt2) * row))); + public ref UInt2 this[int row] => ref *(UInt2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref UInt3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt3) * row))); + public ref UInt3 this[int row] => ref *(UInt3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref UInt4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt4) * row))); + public ref UInt4 this[int row] => ref *(UInt4*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref uint this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(uint) * row))); + public ref uint this[int row] => ref *(uint*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref UInt2 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt2) * row))); + public ref UInt2 this[int row] => ref *(UInt2*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref UInt3 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt3) * row))); + public ref UInt3 this[int row] => ref *(UInt3*)UndefinedData; /// /// 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. - /// Invoking this method with an invalid row argument results in undefined behavior. + /// This method is an intrinsic and can only be used within a shader on the GPU. Using it on the CPU is undefined behavior. /// [UnscopedRef] - public ref UInt4 this[int row] => ref Unsafe.As(ref Unsafe.AddByteOffset(ref this.m11, (nint)(uint)(sizeof(UInt4) * row))); + public ref UInt4 this[int row] => ref *(UInt4*)UndefinedData; /// /// Gets a swizzled reference to a specific sequence of items in the current instance. diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateCreateFromConstantBufferMethod.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateCreateFromConstantBufferMethod.Syntax.cs index 66084b04..aa1be8d8 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateCreateFromConstantBufferMethod.Syntax.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateCreateFromConstantBufferMethod.Syntax.cs @@ -1,6 +1,7 @@ using ComputeSharp.D2D1.SourceGenerators.Models; using ComputeSharp.SourceGeneration.Extensions; using ComputeSharp.SourceGeneration.Helpers; +using ComputeSharp.SourceGeneration.Mappings; namespace ComputeSharp.D2D1.SourceGenerators; @@ -52,18 +53,20 @@ partial class ID2D1ShaderGenerator break; case FieldInfo.NonLinearMatrix matrix: + string primitiveTypeName = matrix.ElementName.ToLowerInvariant(); + string rowTypeName = HlslKnownTypes.GetMappedName($"ComputeSharp.{matrix.ElementName}{matrix.Columns}"); string fieldPath = string.Join(".", matrix.FieldPath); string fieldNamePrefix = string.Join("_", matrix.FieldPath); // Read all rows of a given matrix type: // - // (*&shader.)[0] = buffer.; - // (*&shader.)[1] = buffer.; + // Unsafe.As<, >(ref (*&shader.).M11) = buffer.; + // Unsafe.As<, >(ref (*&shader.).M21) = buffer.; // ... - // (*&shader.)[N] = buffer.; + // Unsafe.As<, >(ref (*&shader.).MN1) = buffer.; for (int j = 0; j < matrix.Rows; j++) { - writer.WriteLine($"(*&shader.{fieldPath})[{j}] = buffer.{fieldNamePrefix}_{j};"); + writer.WriteLine($"global::System.Runtime.CompilerServices.Unsafe.As<{primitiveTypeName}, {rowTypeName}>(ref (*&shader.{fieldPath}).M{j + 1}1) = buffer.{fieldNamePrefix}_{j};"); } break; diff --git a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadConstantBufferMethod.Syntax.cs b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadConstantBufferMethod.Syntax.cs index f5e58d3e..04fa769a 100644 --- a/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadConstantBufferMethod.Syntax.cs +++ b/src/ComputeSharp.D2D1.SourceGenerators/ID2D1ShaderGenerator.CreateLoadConstantBufferMethod.Syntax.cs @@ -45,22 +45,24 @@ partial class ID2D1ShaderGenerator case FieldInfo.Primitive primitive: // Assign a primitive value - writer.WriteLine($"buffer.{string.Join("_", primitive.FieldPath)} = this.{string.Join(".", primitive.FieldPath)};"); + writer.WriteLine($"buffer.{string.Join("_", primitive.FieldPath)} = shader.{string.Join(".", primitive.FieldPath)};"); break; case FieldInfo.NonLinearMatrix matrix: + string primitiveTypeName = matrix.ElementName.ToLowerInvariant(); + string rowTypeName = HlslKnownTypes.GetMappedName($"ComputeSharp.{matrix.ElementName}{matrix.Columns}"); string fieldPath = string.Join(".", matrix.FieldPath); string fieldNamePrefix = string.Join("_", matrix.FieldPath); // Assign all rows of a given matrix type: // - // buffer. = this.[0]; - // buffer. = this.[1]; + // buffer. = Unsafe.As<, >(ref Unsafe.AsRef(in shader.).M11); + // buffer. = Unsafe.As<, >(ref Unsafe.AsRef(in shader.).M21); // ... - // buffer. = this.[N]; + // buffer. = Unsafe.As<, >(ref Unsafe.AsRef(in shader.).MN1); for (int j = 0; j < matrix.Rows; j++) { - writer.WriteLine($"buffer.{fieldNamePrefix}_{j} = this.{fieldPath}[{j}];"); + writer.WriteLine($"buffer.{fieldNamePrefix}_{j} = global::System.Runtime.CompilerServices.Unsafe.As<{primitiveTypeName}, {rowTypeName}>(ref global::System.Runtime.CompilerServices.Unsafe.AsRef(in shader.{fieldPath}).M{j + 1}1);"); } break; diff --git a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs index 2122a91d..53e0b7a1 100644 --- a/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs +++ b/src/ComputeSharp.D2D1/Shaders/Interop/D2D1PixelShader.cs @@ -13,6 +13,123 @@ namespace ComputeSharp.D2D1.Interop; /// public static class D2D1PixelShader { + /// + /// Gets the size of the constant buffer for a D2D1 pixel shader of a specified type. + /// + /// The type of D2D1 pixel shader to retrieve info for. + /// The size of the constant buffer for a D2D1 pixel shader of type . + public static int GetConstantBufferSize() + where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor + { + Unsafe.SkipInit(out T shader); + + return shader.ConstantBufferSize; + } + + /// + /// Gets the number of inputs from an input D2D1 pixel shader. + /// + /// The type of D2D1 pixel shader to get the input count for. + /// The number of inputs for the D2D1 pixel shader of type . + public static int GetInputCount() + where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor + { + Unsafe.SkipInit(out T shader); + + return shader.InputCount; + } + + /// + /// Gets the number of resource textures for a D2D1 pixel shader. + /// + /// The type of D2D1 pixel shader to get the resource texture count for. + /// The number of resource texture for the D2D1 pixel shader of type . + public static int GetResourceTextureCount() + where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor + { + Unsafe.SkipInit(out T shader); + + return shader.ResourceTextureCount; + } + + /// + /// Gets the input types for a D2D1 pixel shader. + /// + /// The type of D2D1 pixel shader to get the input types for. + /// The input types of the target D2D1 pixel shader. + public static ReadOnlyMemory GetInputTypes() + where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor + { + Unsafe.SkipInit(out T shader); + + return shader.InputTypes; + } + + /// + /// Gets the available input descriptions for a D2D1 pixel shader. + /// + /// The type of D2D1 pixel shader to get the input descriptions for. + /// A with the available input descriptions for the shader. + public static ReadOnlyMemory GetInputDescriptions() + where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor + { + Unsafe.SkipInit(out T shader); + + return shader.InputDescriptions; + } + + /// + /// Gets the available resource texture descriptions for a D2D1 pixel shader. + /// + /// The type of D2D1 pixel shader to get the resource texture descriptions for. + /// A with the available resource texture descriptions for the shader. + public static ReadOnlyMemory GetResourceTextureDescriptions() + where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor + { + Unsafe.SkipInit(out T shader); + + return shader.ResourceTextureDescriptions; + } + + /// + /// Gets the pixel options from an input D2D1 pixel shader. + /// + /// The type of D2D1 pixel shader to get the pixel options for. + /// The pixel options for the D2D1 pixel shader of type . + public static D2D1PixelOptions GetPixelOptions() + where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor + { + Unsafe.SkipInit(out T shader); + + return shader.PixelOptions; + } + + /// + /// Gets the buffer precision for the output buffer of a D2D1 pixel shader. + /// + /// The type of D2D1 pixel shader to get the output buffer precision for. + /// The output buffer precision for the D2D1 pixel shader of type . + public static D2D1BufferPrecision GetOutputBufferPrecision() + where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor + { + Unsafe.SkipInit(out T shader); + + return shader.BufferPrecision; + } + + /// + /// Gets the channel depth for the output buffer of a D2D1 pixel shader. + /// + /// The type of D2D1 pixel shader to get the output buffer channel depth for. + /// The output buffer channel depth for the D2D1 pixel shader of type . + public static D2D1ChannelDepth GetOutputBufferChannelDepth() + where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor + { + Unsafe.SkipInit(out T shader); + + return shader.ChannelDepth; + } + /// /// Loads the bytecode from an input D2D1 pixel shader. /// @@ -268,110 +385,6 @@ public static class D2D1PixelShader return CompileBytecode(requestedShaderProfile, requestedCompileOptions, out effectiveShaderProfile, out effectiveCompileOptions); } - /// - /// Gets the pixel options from an input D2D1 pixel shader. - /// - /// The type of D2D1 pixel shader to get the pixel options for. - /// The pixel options for the D2D1 pixel shader of type . - public static D2D1PixelOptions GetPixelOptions() - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor - { - Unsafe.SkipInit(out T shader); - - return shader.PixelOptions; - } - - /// - /// Gets the number of inputs from an input D2D1 pixel shader. - /// - /// The type of D2D1 pixel shader to get the input count for. - /// The number of inputs for the D2D1 pixel shader of type . - public static int GetInputCount() - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor - { - Unsafe.SkipInit(out T shader); - - return shader.InputCount; - } - - /// - /// Gets the number of resource textures for a D2D1 pixel shader. - /// - /// The type of D2D1 pixel shader to get the resource texture count for. - /// The number of resource texture for the D2D1 pixel shader of type . - public static int GetResourceTextureCount() - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor - { - Unsafe.SkipInit(out T shader); - - return shader.ResourceTextureCount; - } - - /// - /// Gets the input types for a D2D1 pixel shader. - /// - /// The type of D2D1 pixel shader to get the input types for. - /// The input types of the target D2D1 pixel shader. - public static ReadOnlyMemory GetInputTypes() - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor - { - Unsafe.SkipInit(out T shader); - - return shader.InputTypes; - } - - /// - /// Gets the available input descriptions for a D2D1 pixel shader. - /// - /// The type of D2D1 pixel shader to get the input descriptions for. - /// A with the available input descriptions for the shader. - public static ReadOnlyMemory GetInputDescriptions() - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor - { - Unsafe.SkipInit(out T shader); - - return shader.InputDescriptions; - } - - /// - /// Gets the available resource texture descriptions for a D2D1 pixel shader. - /// - /// The type of D2D1 pixel shader to get the resource texture descriptions for. - /// A with the available resource texture descriptions for the shader. - public static ReadOnlyMemory GetResourceTextureDescriptions() - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor - { - Unsafe.SkipInit(out T shader); - - return shader.ResourceTextureDescriptions; - } - - /// - /// Gets the buffer precision for the output buffer of a D2D1 pixel shader. - /// - /// The type of D2D1 pixel shader to get the output buffer precision for. - /// The output buffer precision for the D2D1 pixel shader of type . - public static D2D1BufferPrecision GetOutputBufferPrecision() - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor - { - Unsafe.SkipInit(out T shader); - - return shader.BufferPrecision; - } - - /// - /// Gets the channel depth for the output buffer of a D2D1 pixel shader. - /// - /// The type of D2D1 pixel shader to get the output buffer channel depth for. - /// The output buffer channel depth for the D2D1 pixel shader of type . - public static D2D1ChannelDepth GetOutputBufferChannelDepth() - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor - { - Unsafe.SkipInit(out T shader); - - return shader.ChannelDepth; - } - /// /// Gets the constant buffer from an input D2D1 pixel shader. /// @@ -391,19 +404,6 @@ public static class D2D1PixelShader return dataLoader.GetResultingDispatchData(); } - /// - /// Gets the size of the constant buffer for a D2D1 pixel shader of a specified type. - /// - /// The type of D2D1 pixel shader to retrieve info for. - /// The size of the constant buffer for a D2D1 pixel shader of type . - public static int GetConstantBufferSize() - where T : unmanaged, ID2D1PixelShader, ID2D1PixelShaderDescriptor - { - Unsafe.SkipInit(out T shader); - - return shader.ConstantBufferSize; - } - /// /// Gets the constant buffer from an input D2D1 pixel shader. /// diff --git a/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs b/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs index 5dfd2639..3a985d2b 100644 --- a/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs +++ b/tests/ComputeSharp.D2D1.Tests/D2D1PixelShaderTests.cs @@ -731,4 +731,95 @@ public partial class D2D1PixelShaderTests { D2D1PixelShader.SetConstantBufferForD2D1DrawInfo(null, default); } + + [TestMethod] + public unsafe void GetConstantBufferSize_WithNestedStructs() + { + Assert.AreEqual(156, D2D1PixelShader.GetConstantBufferSize()); + + ReadOnlyMemory memory = D2D1PixelShader.GetConstantBuffer(new ShaderWithScalarVectorAndMatrixTypesInNestedStructs( + x: 111, + y: 222, + container2: new FieldsContainer2( + z: 333, + f2x3: new(55, 44, 888, 111, 222, 333), + a: 22, + container3: new FieldsContainer3( + i1x3: new(1, 2, 3), + d2: new(3.14, 6.28))), + c: 42, + container1: new FieldsContainer1( + i1x2: new(111, 222), + i2x2: new(11, 22, 33, 44), + d: 9999))); + + Assert.AreEqual(156, memory.Length); + + fixed (byte* buffer = memory.Span) + { + Assert.AreEqual(111, *(int*)&buffer[0]); + Assert.AreEqual(222, *(int*)&buffer[4]); + Assert.AreEqual(333, *(int*)&buffer[16]); + Assert.AreEqual(55, *(float*)&buffer[32]); + Assert.AreEqual(44, *(float*)&buffer[36]); + Assert.AreEqual(888, *(float*)&buffer[40]); + Assert.AreEqual(111, *(float*)&buffer[48]); + Assert.AreEqual(222, *(float*)&buffer[52]); + Assert.AreEqual(333, *(float*)&buffer[56]); + Assert.AreEqual(22, *(int*)&buffer[60]); + Assert.AreEqual(1, *(int*)&buffer[64]); + Assert.AreEqual(2, *(int*)&buffer[68]); + Assert.AreEqual(3, *(int*)&buffer[72]); + Assert.AreEqual(3.14, *(double*)&buffer[80]); + Assert.AreEqual(6.28, *(double*)&buffer[88]); + Assert.AreEqual(42, *(int*)&buffer[96]); + Assert.AreEqual(111, *(int*)&buffer[112]); + Assert.AreEqual(222, *(int*)&buffer[116]); + Assert.AreEqual(11, *(int*)&buffer[128]); + Assert.AreEqual(22, *(int*)&buffer[132]); + Assert.AreEqual(33, *(int*)&buffer[144]); + Assert.AreEqual(44, *(int*)&buffer[148]); + Assert.AreEqual(9999, *(int*)&buffer[152]); + } + } + + [AutoConstructor] + public readonly partial struct FieldsContainer1 + { + public readonly Int1x2 i1x2; + public readonly int2x2 i2x2; + public readonly int d; + } + + [AutoConstructor] + public readonly partial struct FieldsContainer2 + { + public readonly int z; + public readonly float2x3 f2x3; + public readonly int a; + public readonly FieldsContainer3 container3; + } + + [AutoConstructor] + public readonly partial struct FieldsContainer3 + { + public readonly Int1x3 i1x3; + public readonly double2 d2; + } + + [D2DInputCount(0)] + [AutoConstructor] + private readonly partial struct ShaderWithScalarVectorAndMatrixTypesInNestedStructs : ID2D1PixelShader + { + public readonly int x; + public readonly int y; + public readonly FieldsContainer2 container2; + public readonly int c; + public readonly FieldsContainer1 container1; + + public float4 Execute() + { + return 0; + } + } } \ No newline at end of file