When I define the cBuffer
in hlsl
, some examples shows
cbuffer cbPerObject
{
matrix worldMatrix;
matrix viewMatrix;
matrix projectionMatrix;
};
And the other shows
cbuffer cbPerObject
{
float4x4 worldMatrix;
float4x4 viewMatrix;
float4x4 projectionMatrix;
};
Does it means that type of matrix can have unlimited elements but float4x4 can just hold the first 16 elements?
which one do you prefer in HLSL?
To support older DirectX 8 era HLSL programs, matrix
by itself is a typedef for matrix<float,4,4>
. BTW, float4x4
is also a typedef for matrix<float,4,4>
.
See HLSL, User-Defined Type
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With