XMVectorPermute template

Permutes the components of two vectors to create a new vector.


template<uint32_t PermuteX, uint32_t PermuteY, uint32_t PermuteZ, uint32_t PermuteW> XMVECTOR XMVectorPermute(
  [in]  XMVECTOR V1,
  [in]  XMVECTOR V2



[in] First vector.


[in] Second vector.

Return Value

Returns the permuted vector that resulted from combining the source vectors.


If all 4 indices reference only a single vector (i.e. they are all in the range 0-3 or all in the range 4-7), use XMVectorSwizzle instead for better performance.

Note the library makes use of template specializations on some platforms to improve performance. Not every possible mirror case is implemented for these special cases, so prefer permutes where the X element of the resulting vector comes from the V1 parameter rather than the V2 parameter. For example, prefer using XMVectorPermute<0,1,4,5>(A,B); to XMVectorPermute(4,5,0,1)(B,A);.

This function is a template version of XMVectorPermute where the Permute* arguments are template values.

The XM_PERMUTE_ constants are provided to use as input values for PermuteX,PermuteY,PermuteZ, and PermuteW.

Note  The XMVectorPermute template is new for DirectXMath and is not available for XNAMath 2.x.

Namespace: Use DirectX

Platform Requirements

Microsoft Visual Studio 2010 or Microsoft Visual Studio 2012 with the Windows SDK for Windows 8. Supported for Win32 desktop apps, Windows Store apps, and Windows Phone 8 apps.




See also

DirectXMath Library Template Functions