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

Re: [Public WebGL] WebGL API request: asynchronous texture uploads



On a 15" Retina Macbook Pro I commonly see upload times ranging from ~8-15ms for a single 1024x1024 uncompressed RGB texture with Chrome Canary. This, by the way, is a massive improvement over past measurements which sometimes reached 50ms for the same texture! And that's on a beefy laptop, it's likely to be much worse on a mobile device. As you are probably aware, if a single upload is taking anywhere near 16ms you are probably going to drop a frame when trying to maintain 60Hz rendering. This would probably meet most people's definition of "slow".

Compressed textures upload much faster, naturally, but come with their own set of compatibility challenges.

--Brandon


On Thu, Apr 25, 2013 at 9:49 AM, Kirill Prazdnikov <kirill.prazdnikov@jetbrains.com> wrote:
I will repeat my question in public:

What does "slow: mean ?
Have you measured in numbers ?
Which mobile devices do you imply ?
Is there a difference in speed for updating
 - form Canvas
 - from HTMLImageElement
 - form ImageData

Thanks
  -Kirill



On 4/25/2013 2:44 PM, Tom Payne wrote:
Texture uploads are slow on mobile devices [1], and have unpredictable performance, and it's hard to avoid jank. Applications that stream textures on demand, like map and virtual globe applications, are particularly sensitive to this.

Can the WebGL API be extended to allow asynchronous texture uploads?

Something like:

  var texture = gl.createTexture();
  gl.bindTexture(gl.TEXTURE_2D, texture);
  gl.texImage2DAsync(
    gl.TEXTURE_2D, 0, gl.RGBA, gl.RGBA, gl.UNSIGNED_BYTE, image,
    function() {
      // texture now uploaded, do something
    });
  // gl.texImage2DAsync also implicitly unbinds the texture

This might lead to the second advantage of eventually allowing the browser to JPEG/PNG decode the image in a separate, low-priority, thread.

Does this make sense?

Many thanks,
Tom





--
Camptocamp SA
Tom PAYNE
PSE A
CH-1015 Lausanne

+41 21 619 10 13 (direct)
+41 21 619 10 10 (centrale)
+41 21 619 10 00 (fax)