I’m reading the GLSL spec (5.4.2. Vector and Matrix Constructors) and trying to determine what constitutes a valid matrix constructor. Specifically, I’m thinking of the case where the code passes in a bunch of vectors and scalars.
The explanation seems clear enough:
… Similarly for constructing a matrix from multiple scalars or vectors, or a mixture of these. Matrix components will be constructed and consumed in column major order. In these cases, there must be enough components provided in the arguments to provide an initializer for every component in the constructed value. It is a compile-time error to provide extra arguments beyond this last used argument.
But then there is a list of example matrix constructors. And they include a good variety of permutations, but in every example, the vectors end on a clean column break. There are no examples where a vector spills off of one column and onto the next.
In other words, consider the constructor:
mat3(myVec4, myVec4, 1) . We’ve provided nine scalars, but they’re not arranged neatly in 3-wide columns.
Pragmatically, glslang accepts this code, and almost all OpenGL implementations at my disposal accept this code. However, one GPU in our testing lab reports “cast not allowed”, then “internal error.” I assume this is a bug in the driver, but I can’t prove it since the docs aren’t entirely conclusive on this matter; there are no examples in the docs where a vector is split in this way.
Is this an accidental or intentional omission in the documented examples?