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

Re: [Public WebGL] Should texSubImage2D accept null like texImage2D does?



On 2012-03-13 17:33, Glenn Maynard wrote:
On Tue, Mar 13, 2012 at 10:58 AM, Tim Johansson <timj@opera.com> wrote:
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.)

useProgram's parameter should be nullable, of course.

Yes, I agree on both of them, IMO everything that does not do anything useful with null values should not be nullable. I actually implemented it that way first, but I changed many of them to nullable temporarily to pass more conformance tests and forgot to change them back :(

For reference, the functions which required nullable values in the conformance test a few months ago were (the ones I think are wrong and should be changed are marked with a *):

attachShader (param *1,*2)
bindAttribLocation (param *1)
bindBuffer (param 2)
bindFramebuffer (param 2)
bindRenderbuffer (param 2)
bindTexture (param 2)
bufferSubData (param *3)
compileShader (param *1)
deleteBuffer (param *1)
deleteFramebuffer (param *1)
deleteProgram (param *1)
deleteRenderbuffer (param *1)
deleteShader (param *1)
deleteTexture (param *1)
detachShader (param *1,*2)
framebufferRenderbuffer (param 4)
framebufferTexture2D (param 4)
getActiveAttrib (param *1)
getActiveUniform (param *1)
getAttachedShaders (param *1)
getAttribLocation (param *1)
getProgramParameter (param *1)
getProgramInfoLog (param *1)
getShaderParameter (param *1)
getShaderInfoLog (param *1)
getShaderSource (param *1)
getUniform (param *1,2 - 2 should be nullable)
getUniformLocation (param *1)
linkProgram (param *1)
readPixels (param *7)
shaderSource (param *1)
texImage2D (Array buffer, param 9)
uniform[1-4]f (param 1)
uniform[1-4]fv (param 1 but not 2)
uniform[1-4]i (param 1)
uniform[1-4]iv (param 1 but not 2)
uniformMatrix[2-4]fv (param 1 but not 3)
useProgram (param 1)
validateProgram (param *1)

And functions which did not have to be nullable were:
isBuffer (param 1)
isFramebuffer (param 1)
isProgram (param 1)
isRenderbuffer (param 1)
isShader (param 1)
isTexture (param 1)
texSubImage2D (Array buffer, param 7)
uniform[1-4]fv (param 2 but not 1)
uniform[1-4]iv (param 2 but not 1)
uniformMatrix[2-4]fv (param 3 but not 1)
vertexAttrib[1-4]fv (param 2)

bufferData (we convert param 2 to number if not object)

//Tim