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

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

On Tue, Mar 13, 2012 at 5:33 AM, Tim Johansson <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.

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

Glenn Maynard