>>106316119
It's better for performance to calculate the matrix inversion on the CPU and then upload it to the GPU. If you must do it on the GPU there are people who have implemented this already, search for float4x4 inverse matrix implementation. I found one just casually googling but spam filter doesn't like it if I post it.