[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Public WebGL] GLSL constructor rules



I was lately bitten by an issue I really thought was a bug : 
Initial version of code :
float f;
vec2 foo;
vec3 bar = vec3(f, foo);

Now I changed foo to type vec3 and it happily compiled (but did not work as I expected :-) )
It turns out that as long as at least one component of the last argument is used, this is a valid constructor _expression_.
(see GLSL ES Shading Language, 5.4 Constructors)

My personal opinion on this is that this is too flexible, I would like the compiler to fail the compilation.

What do other developers think of the GLS constructor rules ?
Do they need to be more strict ?


Tibor den Ouden


P.S. : The pragmatic path here is probably request implementers to detect the component count overflow and issue a warning :-)