There are a number of ways to initialize a vectorized-constant for DirectXMath. XMVectorSet
is best when the parameters are float variables not literal values.
XMVECTOR c = XMVectorSet( 3.f, 3.f, 3.f, .3f );
In the case of a literal constant, you are better off using:
const XMVECTORF32 c = { 3.f, 3.f, 3.f, 3.f };
clang will want you to write it as: const XMVECTORF32 c = { { { 3.f, 3.f, 3.f, 3f.f } } };
if you have -Wmissing-braces
enabled.
Other options (again, not the best for literal values, but better for variables):
XMVECTOR c = XMVectorReplicate( 3.f );
float x = 3.f;
XMVECTOR c = XMVectorReplicatePtr(&x);
const XMVECTORF32 t = { 1.f, 2.f, 3.f, 4.f };
XMVECTOR c = XMVectorSplatZ(t);
The DirectXMath Programmer's Guide is a short read, and it covers a lot of use cases.
If you are new to DirectXMath, you should consider using the SimpleMath wrapper types for DirectXMath that is included in DirectX Tool Kit for DX11 / DX12.