On Tue, Mar 13, 2012 at 9:33 AM, Glenn Maynard <firstname.lastname@example.org>
On Tue, Mar 13, 2012 at 10:58 AM, Tim Johansson <email@example.com>
For example validateProgram and useProgram both take WebGLProgram but have to accept null to pass the conformance tests IIRC. In the case of validateProgram it should give you INVALID_VALUE and in the case of useProgram it should actually do something (unbind the current program).
The conformance test is incorrect; validateProgram(null) should throw TypeError. (Since the WebGL spec doesn't correctly use nullable parameters, it's not too surprising if the tests get them wrong, too.)
I think it comes down to emulating OpenGL or not. glValidateProgram excepts 0 will generate INVALID_VALUE therefore it's not unreasonable for WebGL to do the same. I don't expect any programs use validateProgram but the idea is that OpenGL programs should be portable to WebGL with as few changes as possible.
glTexSubImage2D if passed null will crash if all other parameters are valid. Therefore throwing an exception if passed null OpenGL seems more acceptable. On the the other hand, calling
GLint width = 0;
GLint height = 0;
glTexSubImage2D(GL_TEXTURE_2D, 0, 0, 0, width, height, GL_RGBA, GL_UNSIGNED_BYTE, NULL);
will likely not crash since no data will be referenced.
useProgram's parameter should be nullable, of course.