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

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





On Wed, Jan 11, 2012 at 11:27 AM, Chananya Freiman <spectralcanine@gmail.com> wrote:
I realize that WebGL is supposed to be a compact user-friendly API which is why a lot of things are very limited, but why doesn't bufferSubData have a varitation that takes size?
The current variations shatter any hope for speed when you want to update small parts of a big buffer.

The following should be defined too:
  1. void bufferSubData (GLenum target, GLintptr offset, GLintptr size, ArrayBufferView data);
  2. void bufferSubData (GLenum target, GLintptr offset, GLintptr size, ArrayBuffer data);

Right now I need to copy a buffer size above 3 MB just to update 4 indices, and it ruins the FPS of my code completely.

   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.