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

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



Cameron McCormack:
> > * What changes does WebGL need of Web IDL? Is it just the
> > introduction of byte and unsigned byte as types?

Vladimir Vukicevic:
> I believe that's the only piece.

Great.

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

OK.

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

Acknowledged.

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

OK.

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

I think that should already work.  If you had some interface

  [Constructor]
  interface Calculator {
    float sum(in sequence<float> numbers);
  };

then this should work:

  var a = new Float32Array(3);
  a[0] = 1.2;
  a[1] = 3.4;
  a[2] = 5.6;

  var sum = new Calculator().sum(a);

because sequences only need objects that have a length property and can
have their elements retrieved by array indexes:

  http://dev.w3.org/2006/webapi/WebIDL/#es-sequence


Typed arrays, without any fancy views, seem to be pretty similar to the
array type T[] in Web IDL, and how array host objects are defined.

  http://dev.w3.org/2006/webapi/WebIDL/#es-array

Do you have any opinion on whether the T[] type should be dropped from
Web IDL, and specifications recommended to use typed arrays instead?  Or
whether the specific mapping of T[] in the ECMAScript binding should be
typed array objects exactly, rather than the array host objects as
currently defined?

-- 
Cameron McCormack ≝ http://mcc.id.au/
-----------------------------------------------------------
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: