[Public WebGL] Typed Array spec updates: strawman proposals

Kenneth Russell [email protected]
Tue May 31 13:14:08 PDT 2011


On Tue, May 31, 2011 at 10:43 AM, Gregg Tavares (wrk) <[email protected]> wrote:
> So I was thinking this morning, what's the point of the readonly flag and
> how does it work?
> It seemed like the point was to make an XHR returned buffer readonly but
> then that adds a new problem. There are 2 use cases
> 1) I want to read the data in a readonly buffer. To do that I want to create
> a view and I want that view not to make a copy and therefore the view is
> readonly

You would just instantiate the view against the ArrayBuffer; this
operation never causes a copy. The indexed setter, if called, would
throw an exception. So far the consensus is that in all modern
JavaScript engines it will be possible to implement the read-only
check without a test per store, which was the primary concern.

> 2) I want a copy of the data in the buffer. How do I do this? Are there now
> 2 constructors for views? One to make a copy and one to make view?
> Does it work as is or does it need more?

The simplest way would be to call "buffer.slice(0)".

-Ken

> On Fri, Apr 22, 2011 at 6:20 PM, Kenneth Russell <[email protected]> wrote:
>>
>> The Typed Array editors' draft has been updated:
>>
>> http://www.khronos.org/registry/typedarray/specs/latest/
>>
>> with changes supporting the following functionality:
>>
>>  - Ability to copy sections of an ArrayBuffer
>>  - Read-only ArrayBuffers
>>  - Support for zero-copy data transfer via postMessage by defining the
>> behavior of ArrayBuffers and ArrayBufferViews under structured clone
>>
>> The changes are clearly highlighted in the spec with "Strawman proposal".
>>
>> The strawman proposal for the behavior of ArrayBuffers and views under
>> structured clone was discussed informally between Mozilla and Google,
>> and has undergone some iteration. (Earlier iterations involved making
>> an explicit API call to achieve transfer of ownership, and having the
>> default behavior perform a copy.) The current behavior was preferred
>> by members of the TC-39 committee, because it achieves unsurprising
>> performance characteristics.
>>
>> We believe that these changes will be efficiently implementable in
>> current JavaScript engines and web browsers.
>>
>> Your feedback on these changes would be greatly appreciated. Please
>> send them to the list.
>>
>> Thanks,
>>
>> -Ken
>> -----------------------------------------------------------
>> 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
>> -----------------------------------------------------------
>>
>
>

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