Vector of 4 consecutive 32-bit float types
HLSL data type
The GPU is calculated using four-dimensional vectors as the basic unit. The FLOAT4 vector, which consists of 4 floating-point numbers, is the most basic type built into the GPU. Using the GPU to calculate the two float4 vectors is as simple as the CPU for two integers or two floating-point numbers, all with just one instruction to complete.
Hlsh's basic data types define non-vector types such as float, int, and bool, but they will actually be converted to float4 vectors by complier, and the FLOAT4 type can be used as a scalar as long as the 3 values of the FLOAT4 vector are ignored. When mapping coordinates are used, only two-dimensional vectors are required, and HLSL defines the FLOAT2 type as a two-dimensional vector. Shader often use matrices, HLSL has a built-in type, float4x4, which can be used to represent a 4*4 matrix. Float4x4 is not a built-in type of GPU, float4x4 is actually an array of 4 float4. Others are float3x3 and float2x2, which represent 3*3 matrices and 2*2 matrices. Shader can also declare an array, and the 4*4 matrix is actually an array of float4 m[4]. Note that all variables in the shader use registers, and no other memory space is available, so the larger the array will occupy the more registers, and even the limit of the number of registers will be exceeded. When using individual values in the FLOAT4 vector, you can use XYZW or RGBA to represent the values in the four-dimensional vector. But cannot mix them, for example cannot use XYBA, treats it as color to use RGBA, otherwise is uses the XYZW, cannot mix these two.
FLOAT4 Data types