Vector Type Syntax

A vector is a special data type that contains between one and four components. Every component of a vector must be of the same type.

Syntax

Type Number VariableName

where:

Type The data type, which is one of the basic types.
Number A positive integer that specifies the number of components. A vector must have at least one component, and can have no more than of four components.
VariableName An ASCII string that uniquely identifies the variable name.

Remarks

Here are some examples:

bool    bVector;   // scalar containing 1 Boolean
half2   hVector;   // vector containing 2 halfs
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

HLSL Language Basics