Vector*MatrixΒΆ
The vector * matrix multiplication operation has quite a reasonable cost, despite the number of calculations that need to happen.
However, optimisations such as taking advantage of knowing that w
is 1, do not reduce the cost.
fragColor = t * m1; // 4x4 matrix, eight cycles
{mov}
{wdf}
{sop, sop, sopmov}
{sop, sop, sopmov}
{sop, sop}
{sop, sop, sopmov}
{sop, sop, sopmov}
{sop, sop}
fragColor.xyz = t.xyz * m2; // 3x3 matrix, four cycles
{sop, sop, sopmov}
{sop, sop}
{sop, sop, sopmov}
{sop, sop}
// Instructions on Volcanic
fragColor = t * m1; // 4x4 matrix
{mul}
{fma}
{mul}
{fma}
{mul}
{fma}
{mul}
{fma}
{fma}
{fma}
{mul}
{fma}
{fma}
{fma}
{mul}
{fma}
{fma}
{fma}
fragColor.xyz = t.xyz * m2; // 3x3 matrix
{mul}
{fma}
{mul}
{fma}
{mul}
{fma}
{fma}
{mul}
{fma}
{fma}