Vector Type

A vector contains between one and four scalar components; every component of a vector must be of the same type.

TypeNumber Name


TypeComponents Name




A single name that contains two parts. The first part is one of the scalar types. The second part is the number of components, which must be between 1 and 4 inclusive.


An ASCII string that uniquely identifies the variable name.



Here are some examples:

bool    bVector;   // scalar containing 1 Boolean
int1    iVector = 1;
float3  fVector = { 0.2f, 0.3f, 0.4f };

A vector can be declared using this syntax also:

vector <Type, Number> VariableName

Here are some examples:

vector <int,    1> iVector = 1;
vector <double, 4> dVector = { 0.2, 0.3, 0.4, 0.5 };

See also

Data Types (DirectX HLSL)