Revision control
Copy as Markdown
Other Tools
fn _naga_inverse_3x3_f16(m: mat3x3<f16>) -> mat3x3<f16> {
var adj: mat3x3<f16>;
adj[0][0] = (m[1][1] * m[2][2] - m[2][1] * m[1][2]);
adj[1][0] = - (m[1][0] * m[2][2] - m[2][0] * m[1][2]);
adj[2][0] = (m[1][0] * m[2][1] - m[2][0] * m[1][1]);
adj[0][1] = - (m[0][1] * m[2][2] - m[2][1] * m[0][2]);
adj[1][1] = (m[0][0] * m[2][2] - m[2][0] * m[0][2]);
adj[2][1] = - (m[0][0] * m[2][1] - m[2][0] * m[0][1]);
adj[0][2] = (m[0][1] * m[1][2] - m[1][1] * m[0][2]);
adj[1][2] = - (m[0][0] * m[1][2] - m[1][0] * m[0][2]);
adj[2][2] = (m[0][0] * m[1][1] - m[1][0] * m[0][1]);
let det: f16 = (m[0][0] * (m[1][1] * m[2][2] - m[1][2] * m[2][1])
- m[0][1] * (m[1][0] * m[2][2] - m[1][2] * m[2][0])
+ m[0][2] * (m[1][0] * m[2][1] - m[1][1] * m[2][0]));
return adj * (1 / det);
}