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

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

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.