Function
mat_mul
(a: [[f32; 4]; 4], b: [[f32; 4]; 4])
Source from the content-addressed store, hash-verified
| 477 | } |
| 478 | |
| 479 | fn mat_mul(a: [[f32; 4]; 4], b: [[f32; 4]; 4]) -> [[f32; 4]; 4] { |
| 480 | // Column-major: result[col][row] = sum_k a[k][row] * b[col][k] |
| 481 | let mut out = [[0.0; 4]; 4]; |
| 482 | for col in 0..4 { |
| 483 | for row in 0..4 { |
| 484 | let mut s = 0.0; |
| 485 | for k in 0..4 { |
| 486 | s += a[k][row] * b[col][k]; |
| 487 | } |
| 488 | out[col][row] = s; |
| 489 | } |
| 490 | } |
| 491 | out |
| 492 | } |
| 493 | |
| 494 | // ──────────────────────────────────────────────────────────────────── |
| 495 | // WGSL: vertex stage shared, three fragment outputs (lambert / normal / |
Tested by
no test coverage detected