On May 27, 2010, at 2:18 PM, Jonas Sicking wrote:
On Thu, May 27, 2010 at 12:05 PM, Brendan Eich <[email protected]>
wrote:
If structs are anything like value types, then I am interested in
participating. I'm particularly interested in working through the
details
of how arithmetic of integer like quantities would work.
The struct-array idea for WebGL avoids the typed array aliasing
design, and
consequent byte-order leakage. But we are not envisioning new
operator
overloading or literal syntax. At most a[i].x would be optimized to
a very
fast, packed member read or write, after scaling i and adding the
offset of
x. Any read would use ES's number type, I believe.
The other thing that Khronos really wanted to avoid was for a[i] in
the above expression not to create an object which is to be
initialized and GCed. Though maybe you're including that in the
scaling+offset algorithm.
Yes, I wrote a[i].x on purpose. Just a[i] with no .x or .y, etc. after
would reify a JS object.
With typed arrays, you have to make two views of the array I sketched,
one a uint32 array and the other a uint8 array, and use them both to
load and store the appropriate "members": x, y, and z are via the
uint32 view, r/g/b/a are via the uint8 view. But there is no "struct"
or ensemble of all 16 bytes that you can load and store efficiently
with typed arrays.
Same with the struct-schema idea.
/be
_______________________________________________
es-discuss mailing list
[email protected]
https://mail.mozilla.org/listinfo/es-discuss