Matrix constructor ambiguity in GLSL spec

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?

Sounds right to me.

I think the guidelines in the text cover your case pretty clearly. I doubt the examples weren’t intended to illustrate all special cases.

Further, it looks like this same language exists in the GLSL 1.2 spec and the GLSL 4.6 spec. So if you declare any #version in that range, it sounds like this matrix constructor syntax should be treated as valid. GLSL 1.1 has similar language which might cover this too, but this was reworded for 1.2+

I 110% agree. However, the fact that the docs have so many examples, and not a single example of column-splitting, casts doubt in my mind. Also, the fact that the column boundaries are clearly delimited with comments on many examples seems to imply that they are treated specially, despite the fact that the text above doesn’t mention column breaks.

If this is valid, I would suggest that we could clear it up very easily by adding one extra example to the next version of the doc, but I don’t know where to submit a suggestion directly.