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

Re: [Public WebGL] GLSL constructor rules

I like warnings.


----- Original Message -----
From: "Tibor Ouden, den" <tibordenouden@gmail.com>
To: "public webgl" <public_webgl@khronos.org>
Sent: Tuesday, January 14, 2014 1:36:18 PM
Subject: [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 :-)

You are currently subscribed to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email:
unsubscribe public_webgl