Directx HLSL中matrix和float4x4的区别是什么

Directx HLSL中matrix和float4x4的区别是什么,directx,hlsl,Directx,Hlsl,当我在hlsl中定义cBuffer时,一些示例显示 cbuffer cbPerObject { matrix worldMatrix; matrix viewMatrix; matrix projectionMatrix; }; 其他节目呢 cbuffer cbPerObject { float4x4 worldMatrix; float4x4 viewMatrix; float4x4 projectionMatrix; }; 这是否意味着矩阵类型可以有无限个元素,但

当我在
hlsl
中定义
cBuffer
时,一些示例显示

cbuffer cbPerObject
{
  matrix worldMatrix;
  matrix viewMatrix;
  matrix projectionMatrix;
};
其他节目呢

cbuffer cbPerObject
{
  float4x4 worldMatrix;
  float4x4 viewMatrix;
  float4x4 projectionMatrix;
};
这是否意味着矩阵类型可以有无限个元素,但float4x4只能容纳前16个元素


您更喜欢HLSL中的哪一个?

要支持旧的DirectX 8时代的HLSL程序,
matrix
本身就是
matrix
的类型定义。顺便说一句,
float4x4
也是
矩阵的typedef