Should I prefer to calculate matrices on the CPU or GPU?
Let's say I have the following matrices P * V * M
, should I calculate them on the CPU so that I can send the final matrix to the GPU (GLSL) or should I send those three matrices separately to the GPU so that GLSL can calculate the final matrix?
I mean in this case GLSL would have to calculate the MVP matrix for every vertex, so it is probably faster to precompute it on the CPU.
But let's say that GLSL only has to calculate he MVP matrix once, would the GPU calculate the final matrix faster than the CPU?
projection * view * model * vertex
Then there are actually nomatrix
multiplications. Onlymatrix * vector
multiplications since it is evaluated from right to left(projection * (view * (model * vertex)))
. This is much less burdensome on calculation. – Justin Meiners