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

Re: [Public WebGL] Requirements for bufferData don't make sense given the IDL

On 4/2/12 2:01 PM, Gregg Tavares (勤) wrote:
    But the IDL declarations for this method don't allow |data| to be
    null; an attempt to pass null will throw during the WebIDL overload
    resolution algorithm.  Was this requirement meant to be on
    bufferSubData (which does allow null to be passed)?  Or is
    bufferData supposed to have an overload that allows null?

bufferData should (and does) take null

Here's the relevant IDL at https://www.khronos.org/registry/webgl/specs/latest/#5.14 :

    void bufferData(GLenum target, GLsizeiptr size, GLenum usage);
    void bufferData(GLenum target, ArrayBufferView data, GLenum usage);
    void bufferData(GLenum target, ArrayBuffer data, GLenum usage);

If null is passed as tehe second argument, the second and third
overloads will not be invoked, because they don't allow null (there's no
'?' anywhere there).  GLsizeiptr is a typedef for long long, so we end
up at http://dev.w3.org/2006/webapi/WebIDL/#es-long-long , invoke
ToNumber(null), get +0, and invoke the first overload with 0 as the
second argument.  But the text about what should happen when null is
passed is only scoped to the second and third overload in the spec, so
it still doesn't make sense.

At least that's what the spec says now.  Maybe there was _supposed_ to
be a '?' on the second or third overload.  If so, it needs to be added

bufferSubData does not take null

Again, quoting the IDL in the spec right now:

    void bufferSubData(GLenum target, GLintptr offset, ArrayBufferView?
    void bufferSubData(GLenum target, GLintptr offset, ArrayBuffer? data);

Clearly the third argument accepts null.  Again, maybe it's not supposed
to; then the spec should be fixed accordingly, of course.


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