Quick answer: GameMaker shader_set_uniform_f_array passing values with wrong stride? GM expects flat-packed floats; vec4 array needs 4 floats per element.
Pass 32 floats for an 8-element vec4 array. Shader reads them in wrong groups; first vec4 is correct, rest are garbage.
Pack flat
var arr = [];
for (var i = 0; i < 8; i++) {
array_push(arr, x[i], y[i], z[i], w[i]);
}
shader_set_uniform_f_array(loc, arr);Flat float array. Length = array_size * 4 for vec4.
Verify shader array size
Shader uniform vec4 arr[8] needs exactly 32 floats. Mismatch crashes silently.
Use a uniform buffer
For large arrays, vertex buffer + texture sampling beats uniform arrays for performance and reliability.
“Uniform arrays are flat-packed. The flatness is the contract.”
Wrap uniform array writes in a helper that takes a list-of-vectors. Internal flattening; cleaner call sites.