W3C home > Mailing lists > Public > public-script-coord@w3.org > January to March 2016

[Bug 28798] Make BufferSource more convenient to use

From: <bugzilla@jessica.w3.org>
Date: Thu, 11 Feb 2016 15:48:14 +0000
To: public-script-coord@w3.org
Message-ID: <bug-28798-3890-h6JEri3YWD@http.www.w3.org/Bugs/Public/>

--- Comment #16 from Boris Zbarsky <bzbarsky@mit.edu> ---
> Can you explain why this would be? 

Well, let's take an example WebGL API:

    void bufferData(GLenum target, ArrayBuffer? data, GLenum usage);

If we do the copying at argument conversion time, we MUST make a copy when we
process the "data" argument, because processing the "usage" argument can detach
the ArrayBuffer (e.g. if the thing passed for the third argument is { valueOf:
function() { /* detach stuff here*/ return something; } }).  Then we have to
hand over the buffer to the actual graphics driver, which involves another
buffer copy.

If we do the copying at entry-into-prose time (which I will be the first to
admit is much harder to specify and implement!) then the implementation could
make the handoff to the graphics driver be the only copy, as long as it's
careful to not enter script in any way between entry into the algorithm and the
call into the graphics driver.

If the array is big, having to do an extra copy can be pretty painful, both in
terms of memory usage and time....

You are receiving this mail because:
You are on the CC list for the bug.
Received on Thursday, 11 February 2016 15:48:37 UTC

This archive was generated by hypermail 2.4.0 : Friday, 17 January 2020 17:14:25 UTC