From 4c87dded01d4fd16b89ac76ff9c88b1533975af1 Mon Sep 17 00:00:00 2001 From: Sergio Pedri Date: Mon, 1 Mar 2021 18:19:08 +0100 Subject: [PATCH] Added MatrixIndexAsBase 0 and 1 types --- .../Core/Primitives/MatrixIndexAsBase0.cs | 97 +++++++++++++++++++ .../Core/Primitives/MatrixIndexAsBase1.cs | 97 +++++++++++++++++++ 2 files changed, 194 insertions(+) create mode 100644 src/ComputeSharp/Core/Primitives/MatrixIndexAsBase0.cs create mode 100644 src/ComputeSharp/Core/Primitives/MatrixIndexAsBase1.cs diff --git a/src/ComputeSharp/Core/Primitives/MatrixIndexAsBase0.cs b/src/ComputeSharp/Core/Primitives/MatrixIndexAsBase0.cs new file mode 100644 index 00000000..33c97996 --- /dev/null +++ b/src/ComputeSharp/Core/Primitives/MatrixIndexAsBase0.cs @@ -0,0 +1,97 @@ +namespace ComputeSharp +{ + /// + /// A type indicating a base-0 index into a matrix type. This can be used to extract references to swizzled vectors within a given matrix value. + /// For more info, see . + /// This type is meant to be used within a directive to simplify the code: + /// + /// + /// using static ComputeSharp.MatrixIndexAsBase0; + /// Float2x2 matrix = 0; + /// Float2 row = matrix[M11, M01]; + /// + /// + /// + public enum MatrixIndexAsBase0 + { + /// + /// The first item in the first row. + /// + M00, + + /// + /// The second item in the first row. + /// + M01, + + /// + /// The third item in the first row. + /// + M02, + + /// + /// The fourth item in the first row. + /// + M03, + + /// + /// The first item in the second row. + /// + M10, + + /// + /// The second item in the second row. + /// + M11, + + /// + /// The third item in the second row. + /// + M12, + + /// + /// The fourth item in the second row. + /// + M13, + + /// + /// The first item in the third row. + /// + M20, + + /// + /// The second item in the third row. + /// + M21, + + /// + /// The third item in the third row. + /// + M22, + + /// + /// The fourth item in the third row. + /// + M23, + + /// + /// The first item in the fourth row. + /// + M30, + + /// + /// The second item in the fourth row. + /// + M31, + + /// + /// The third item in the fourth row. + /// + M32, + + /// + /// The fourth item in the fourth row. + /// + M33 + } +} diff --git a/src/ComputeSharp/Core/Primitives/MatrixIndexAsBase1.cs b/src/ComputeSharp/Core/Primitives/MatrixIndexAsBase1.cs new file mode 100644 index 00000000..6db0cde9 --- /dev/null +++ b/src/ComputeSharp/Core/Primitives/MatrixIndexAsBase1.cs @@ -0,0 +1,97 @@ +namespace ComputeSharp +{ + /// + /// A type indicating a base-1 index into a matrix type. This can be used to extract references to swizzled vectors within a given matrix value. + /// For more info, see . + /// This type is meant to be used within a directive to simplify the code: + /// + /// + /// using static ComputeSharp.MatrixIndexAsBase1; + /// Float2x2 matrix = 0; + /// Float2 row = matrix[_11, _22]; + /// + /// + /// + public enum MatrixIndexAsBase1 + { + /// + /// The first item in the first row. + /// + _11, + + /// + /// The second item in the first row. + /// + _12, + + /// + /// The third item in the first row. + /// + _13, + + /// + /// The fourth item in the first row. + /// + _14, + + /// + /// The first item in the second row. + /// + _21, + + /// + /// The second item in the second row. + /// + _22, + + /// + /// The third item in the second row. + /// + _23, + + /// + /// The fourth item in the second row. + /// + _24, + + /// + /// The first item in the third row. + /// + _31, + + /// + /// The second item in the third row. + /// + _32, + + /// + /// The third item in the third row. + /// + _33, + + /// + /// The fourth item in the third row. + /// + _34, + + /// + /// The first item in the fourth row. + /// + _41, + + /// + /// The second item in the fourth row. + /// + _42, + + /// + /// The third item in the fourth row. + /// + _43, + + /// + /// The fourth item in the fourth row. + /// + _44 + } +}