Open greggman opened 1 year ago
However (ES3?) ShaderSource
says:
If length is NULL, all strings in the string argument are considered null- terminated.
So I ended up checking other API points that take strings.
getUniformLocation
getAttribLocation
bindAttribLocation
shaderSource
(see above)transformFeedbackVaryings
The WebGL 1.0 spec specifically calls out getUniformLocation
, getAttribLocation
and bindAttribLocation
as supposed to be returning INVALID_VALUE
if the string has invalid characters, of which \0
is one.
https://registry.khronos.org/webgl/specs/latest/1.0/#CHARACTERS_OUTSIDE_VALID_SET
transformFeedbackVaryings
should probably be added to the 2.0 spec in some way
For transformFeedbackVaryings
, Chrome and Safari they truncate the strings at \0
and so incorrect match things they shouldn't. Firefox appears take the strings as is and then generetes a link error that the specifed varying was not found.
Following the precedent of the 1.0 spec it would seem that transformFeedbackVaryings
should also generate INVALID_VALUE
All 3 browsers correctly generate INVALID_VALUE
for getUnifiormLocation
and getAttribLocation
.
For bindAttirbLocation
, Firefox and Safari generate INVALID_VALUE
. Chrome cuts the string at \0
and so incorrectly binds locations.
Example:
Runs in Firefox, fails in Safari and Chrome
https://jsgist.org/?src=c20a4b92a9116ac894553ade4b57c4a8