Tour of WGSL

Matrices

WGSL supports matrices between 2x2 and 4x4 f32 elements.

WGSL matrices are column-major.

Matrices are declared with the form matCxR<f32> , where C is the number of columns in the matrix, R is the number of rows in the matrix.

Example
mat2x3<f32>A matrix with two columns and three rows of f32.
mat4x2<f32>A matrix with four columns and two rows of f32.

matCxR<T> can be thought as C column vectors of vecR<T> .

WGSL also predeclares the alias matCxRf to matCxR<f32> .