[Public WebGL] Should the non-typed-array overloads of uniform*v and vertextAttrib*v be IDL arrays or IDL sequences?

Boris Zbarsky [email protected]
Thu Apr 26 19:09:25 PDT 2012

On 4/26/12 8:26 PM, Kenneth Russell wrote:
> Early drafts of the WebGL spec used sequences for these arguments.
> When arrays were added to Web IDL, they were changed to arrays, to
> potentially support more efficient calls from JavaScript to C++.

To realize this potential one would need to have platform array objects 
for those types, right?

> If they were changed to sequence<T>, then could a browser still pass
> them throughout its DOM bindings by reference

It depends.  If a JavaScript Array object is passed in, then it 
technically gets copied (per WebIDL) no matter whether the argument is 
float[] or sequence<float>.  Quoting from 
http://dev.w3.org/2006/webapi/WebIDL/#es-array :

   *  If V is a platform array object whose element type is T, then
      return the array that the platform array object represents.
   *  Let values be the result of converting V to a sequence with
      element type T.

So the only way for these overloads to do anything effective is if some 
_other_ specification defines a way to create platform array objects, right?

If such a beastie is ever created, I think browser DOM bindings could in 
fact special-case this situation to pass it by reference, but it would 
take some sort of GLContext-specific code.

On the other hand, right now implementing the binding as specced 
technically requires a browser to implement these platform array object 
things, which no browser actually has yet.  So they could just as easily 
special-case the fact that while it says "array" in the IDL in practice 
they should do the sequence conversion here.....


You are currently subscribed to [email protected]
To unsubscribe, send an email to [email protected] with
the following command in the body of your email:
unsubscribe public_webgl

More information about the public_webgl mailing list