Swizzle Operators for Vectors

The programming model implementation supports the following "swizzle" operators. These operators are used as suffixes to a variable name. They can be used on either side (left or right) of an assignment operator. When used on the left hand side of an assignment, each component must be uniquely identifiable.

Swizzle operators can be combined to access a subset of the subset of elements. The result of the combination must be well-defined. For example, after the following code runs, usvec4 contains (1, 2, 5, 4).

ushort4 usvec4 = (ushort4)(1, 2, 3, 4); usvec4.hi.even = 5;