[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 15:37, Glenn Maynard wrote:
On Tue, Mar 13, 2012 at 5:33 AM, Tim Johansson <timj@opera.com <mailto:timj@opera.com>> wrote:

    Yeah, if you leave the 6th parameter out it is tricky to tell if
    you tried to call the version taking 5 numbers and an object
    (HTMLImageElement) or the version taking 8 numbers and an object
    (TypedArray). In our implementation we would assume 0/null for the
    missing parameters and the call would match both versions. In that
    case we are highly likely to choose the one which does not cause
    an error.

    I think there has been quite a bit of work on this in WebIDL since
    we last looked at it, so it might actually be better specified
    now, but even if it is it would IMO mostly be a conformance test
    of WebIDL and not of WebGL.

I'm not an expert on WebIDL, but this all looks tightly specified now.

It's worth having a test for this in WebGL, since WebGL is exercising this part of WebIDL more than a lot of other current APIs.

Yeah, looks like it is well specified now. I don't have any strong objections in this specific case right now (haven't checked if it is implementable yet though) since IDL is a bit of a special case, but I think we should be careful about testing other specs in the WebGL conformance testsuite.

    (I am also not sure if I like INVALID_VALUE or an TypeError
    exception better in this case)

If you call deleteTexture(window), or linkProgram(document.createEvent("event")), or texImage2D(2D, 0, ifmt, fmt, type, document) WebIDL throws TypeError. The same should happen if null is passed; it's just another invalid parameter type.

INVALID_VALUE should only be used if the method is actually called by WebIDL, but the value of the parameters is invalid.

Yeah, I agree with that, but that is not what most of the other webgl functions does, which is why I am not sure what to do.

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).

Which functions accepts null and how it is dealt with is generally underspecified, which is something we should fix, first step is to agree on how null should be dealt with and mark the ones which does not throw TyperError as nullable.


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