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

Re: [Public WebGL] WebGL, typed arrays, Web IDL, ECMAScript

On Tue, Oct 12, 2010 at 2:25 PM, Vladimir Vukicevic
<vladimir@mozilla.com> wrote:
> Hi Cameron,
> ----- Original Message -----
>> Hi. I just subscribed to the list.
>> Would someone be able to summarise for me the current state of play with
>> regard to the following:
>> * What changes does WebGL need of Web IDL? Is it just the
>> introduction of byte and unsigned byte as types?
> I believe that's the only piece.

Hi Cameron,

Strictly speaking, the Typed Array specification would only need
unsigned byte introduced since octet is already in the spec, but it
would be convenient if byte could be introduced as well for symmetry.
We found that all of the other concepts, like omittable getters and
setters, were already present in Web IDL.

For WebGL in general, one of the recent sticking points has been the
different handling of wrong numbers of arguments to function calls
between Web IDL and ECMAScript. In pure ECMAScript, if too few
arguments are passed to a function, "undefined" is passed for the
remaining arguments. In some browsers' scripting engines an exception
is thrown when a function on a host object is called with too few
arguments; in some, the ECMAScript behavior is taken. I think the Web
IDL spec is a little ambiguous on this topic, in particular for
non-overloaded functions; correct me if I'm wrong.

>> * Are typed arrays in use in implementations (how stable is the spec)?
> Yep -- there are implementations in Firefox, Chrome, and WebKit nightly builds.  They are largely interoperable for implemented functionality; notably, Firefox doesn't have DataView implemented yet.

Actually, neither do WebKit/Chromium, though I'm planning to fix this
soon: https://bugs.webkit.org/show_bug.cgi?id=46541 . Also, WebKit /
Chromium do not yet implement Float64Array.

Note also that we are thinking of adding support for read-only Typed
Array views to better handle the use case of XMLHttpRequest, which
will involve some refactoring of the type hierarchy but not change it
substantially. We have also been thinking about adding a couple of
methods and postMessage() semantics to help send data to web workers
and back.


>> * Are typed arrays likely to become part of ECMAScript, and if so how
>> soon?
> Unlikely at this point.  There is an alternate proposal in ES that has a bunch of nice features, but is impractical for implementation in the timeframe that WebGL needs.  However, in the future the hope is that both will work well with WebGL.
>> * What is the (current or desired) relationship between the array and
>> sequence types in Web IDL and typed arrays?
> Current relationship is none -- typed arrays are defined in terms of WebIDL, and then optimized internally by the JS engines.  Thus it's already possible to specify arguments as explicit typed arrays.  One desired relationship might be some syntax/spec language that allows for sequence<t> where t is some basic type to be passed in via typed arrays to various APIs, but that likely involves more extensive browser code modifications than handling them for a smaller explicit set of functions.
>    - Vlad
> -----------------------------------------------------------
> 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:

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: