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

Re: [Public WebGL] WebGL bufferSubData lacks "size" parameter



The extra garbage that's created probably isn't a problem for a generational garbage collector, but as far as I know only V8 has one of those.

On Wed, Jan 11, 2012 at 6:32 PM, Mark Callow <callow_mark@hicorp.co.jp> wrote:
On 12/01/2012 05:00, Gregg Tavares (wrk) wrote:
   buf = new Uint8Array(1000);
   gl.bufferSubData(..., someOffset, new Uint8Array(buf, 123, 456));

Uploads 456 bytes of 'buf' starting at byte 123 to someOffset. As others have pointed out there is no copy. The second Uint8Array is just a view into buf.
It might not copy the data but it still generates garbage that has to be collected.

One of the design tenets from applications for previous 3D APIs I've worked with was avoid generating objects, that must be garbage collected, during the application's draw loop. With WebGL's avoidance of length parameters such avoidance is next to impossible. The reason it is bad is because eventually GC will run and the application will hiccup.

I too would like to see variations of the functions that take a source length parameter.

Regards

    -Mark