|
153 | 153 | typename-specifier braced-init-list\br |
154 | 154 | postfix-expression \terminal{.} \opt{\terminal{template}} id-expression\br |
155 | 155 | postfix-expression \terminal{.} vector-swizzle-component-sequence\br |
| 156 | + postfix-expression \terminal{.} matrix-swizzle-component-sequence\br |
156 | 157 | postfix-expression \terminal{++}\br |
157 | 158 | postfix-expression \terminal{--} |
158 | 159 | \end{grammar} |
|
173 | 174 | elements in the vector, the program is ill-formed. If the value is outside the |
174 | 175 | range at runtime, the behavior is undefined. |
175 | 176 |
|
176 | | -\Sec{Vector Swizzle}{Expr.Post.VectorSwizzle} |
| 177 | +\Sec{Swizzle}{Expr.Post.Swizzle} |
| 178 | +\p A \textit{postfix-expression} followed by a dot (\texttt{.}) and a sequence |
| 179 | +of one or more \textit{swizzle-components} is a postfix expression. The |
| 180 | +postfix expression before the dot is evaluated and must be of vector or matrix type. |
| 181 | +If the postfix expression before the dot is an lvalue, the swizzle expression may |
| 182 | +produce either an lvalue or a prvalue; otherwise it produces a prvalue. |
| 183 | + |
| 184 | + |
| 185 | +\p If the postfix expression before the dot is |
| 186 | +an lvalue and the \textit{swizzle-component-sequence} contains no repeated |
| 187 | +components, the swizzle expression is an lvalue; otherwise it is a prvalue. |
| 188 | + |
| 189 | +\Sec{Vector Swizzle}{Expr.Post.Swizzle.Vector} |
177 | 190 |
|
178 | 191 | \begin{grammar} |
179 | 192 | \define{vector-swizzle-component-sequence}\br |
|
195 | 208 | \terminal{x y z w} |
196 | 209 | \end{grammar} |
197 | 210 |
|
198 | | -\p A \textit{postfix-expression} followed by a dot (\texttt{.}) and a sequence |
199 | | -of one or more \textit{swizzle-components} is a postfix expression. The |
200 | | -postfix expression before the dot is evaluated and must be of vector type. If |
201 | | -the postfix expression before the dot is an lvalue, the swizzle expression may |
202 | | -produce either an lvalue or a prvalue; otherwise it produces a prvalue. |
203 | | - |
204 | | -\p A \textit{swizzle-component-sequence} is a sequence of one or more swizzle |
| 211 | +\p A \textit{vector-swizzle-component-sequence} is a sequence of one or more swizzle |
205 | 212 | components of either the \textit{swizzle-component-rgba} or |
206 | 213 | \textit{swizzle-component-xyzw} forms; the two forms may not be mixed in the |
207 | | -same \textit{swizzle-component-sequence}. The type of a swizzle expression is a |
| 214 | +same \textit{vector-swizzle-component-sequence}. The type of a swizzle expression is a |
208 | 215 | vector of the same element type as the postfix expression before the dot, with a |
209 | | -number of elements equal to the number of components in the |
210 | | -\textit{swizzle-component-sequence}. If the postfix expression before the dot is |
211 | | -an lvalue and the \textit{swizzle-component-sequence} contains no repeated |
212 | | -components, the swizzle expression is an lvalue; otherwise it is a prvalue. |
| 216 | +number of elements equal to the number of components in the \textit{vector-swizzle-component-sequence}. |
213 | 217 |
|
214 | | -\p Swizzle components map to elements of the vector in the following way: |
| 218 | +\p Vector swizzle components map to elements of the vector in the following way: |
215 | 219 |
|
216 | 220 | \begin{center} |
217 | 221 | \begin{tabular}{|| c | c | c ||} |
|
230 | 234 | refers to an element index that is out of range of the vector type of the |
231 | 235 | postfix expression before the dot. |
232 | 236 |
|
| 237 | +\Sec{Matrix Swizzle}{Expr.Post.Swizzle.Matrix} |
| 238 | +\begin{grammar} |
| 239 | + \define{matrix-swizzle-component-sequence}\br |
| 240 | + matrix-zero-indexed-swizzle-sequence\br |
| 241 | + matrix-one-indexed-swizzle-sequence\br |
| 242 | + |
| 243 | + \define{matrix-zero-indexed-swizzle-sequence}\br |
| 244 | + matrix-zero-indexed-swizzle\br |
| 245 | + matrix-zero-indexed-swizzle-sequence matrix-zero-indexed-swizzle\br |
| 246 | + |
| 247 | + \define{matrix-zero-indexed-swizzle}\br |
| 248 | + \terminal{\_m} zero-index-value\br |
| 249 | + |
| 250 | + \define{zero-index-value} \textnormal{one of}\br |
| 251 | + \terminal{0 1 2 3 }\br |
| 252 | + |
| 253 | + \define{matrix-one-indexed-swizzle-sequence}\br |
| 254 | + matrix-one-indexed-swizzle\br |
| 255 | + matrix-one-indexed-swizzle-sequence matrix-one-indexed-swizzle\br |
| 256 | + |
| 257 | + \define{matrix-one-indexed-swizzle}\br |
| 258 | + \terminal{\_m} one-index-value\br |
| 259 | + |
| 260 | + \define{one-index-value} \textnormal{one of}\br |
| 261 | + \terminal{1 2 3 4 }\br |
| 262 | +\end{grammar} |
| 263 | +\begin{itemize} |
| 264 | +\item \textbf{.\_} (math-style): subsequent subscripts use \textbf{1-based} |
| 265 | + indexing for both row and column. |
| 266 | +\item \textbf{.\_m} (memory-style): subsequent subscripts use \textbf{0-based} |
| 267 | + indexing for both row and column. |
| 268 | +\end{itemize} |
| 269 | + |
| 270 | +\p A \textit{matrix-swizzle-component-sequence} is a sequence of one or more swizzle |
| 271 | +components of either the \textit{matrix-zero-indexed-swizzle} or |
| 272 | +\textit{matrix-one-indexed-swizzle} forms; the two forms may not be mixed in the |
| 273 | +same \textit{matrix-swizzle-component-sequence}. The type of a swizzle expression is a |
| 274 | +vector of the same element type as the postfix expression before the dot, with a |
| 275 | +number of elements equal to the number of components in the \textit{matrix-swizzle-component-sequence}. |
| 276 | + |
233 | 277 | \Sec{Function Calls}{Expr.Post.Call} |
234 | 278 |
|
235 | 279 | \p A function call may be an \textit{ordinary function}, or a \textit{member |
|
0 commit comments