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

Re: [Public WebGL] ANGLE_instanced_arrays extension proposal

I would love to see this, even if it is not supported on mobile.
I often find instancing good when performing a lot of dynamic buffer uploads, as you can dramatically reduce the size of your buffers (and the data you have to upload) - even if it's a wash (or maybe even slightly slower) on vertex throughput, the ability to /3 or /4 (or more) my data is a big win in a lot of cases. There's less JS code running to generate the data, less memory usage, and in browsers that require copies to background processes/etc it can save on command buffer space. One can't look at just # of vertices/second to see if it's useful.

With WebGL it should help with API overhead, too - reducing the number of uniform/draw pairings and transitions to native code. Whether that's worth trying to find fallback solutions in software for is debatable. I'd say that a good test would be needed to see, on platforms that don't support it natively, if it's worth doing the software expansion. Again, if it's within a reasonable amount of performance via the non-instanced case but a little slower, it can still be worth it for the memory/buffer savings client-side.

On Tue, Mar 6, 2012 at 1:48 PM, Benoit Jacob <bjacob@mozilla.com> wrote:
It does sound like a potentially worthwhile idea, but it would be great to see data about how large the performance increase can be.

I checked, Mesa supports it. (Open-source Linux drivers).


I've just added a proposal for adding ANGLE_instanced_arrays to WebGL to allow geometry instancing:

This extension is a stripped-down version of ARB_instanced_arrays that can be easily-implemented on top of Direct3D 9.

It can be used by setting a divisor, n, on certain vertex attribs. Then when drawing multiple instances of a certain piece of geometry, those vertex attributes will keep the same value for every vertex in an entire instance. After drawing n instances, it will move on to the next value for that attrib.

Desktop support:
 - All Direct3D 9 hardware with Shader Model 3.0 supports it
 - Supported through ANGLE on windows.
 - Supported on OS X Lion on all machines, and on Snow Leopard on most machines
 - Supported on NVIDIA's linux drivers, and probably ATI's

Mobile support:
This is more difficult, as no mobile device that I know of supports geometry instancing. This could be supported using pseudo-instancing, but that would require either keeping a shadow copy of every vertex buffer in case it's used as instanced data, or performing a complicated and expensive readback to get at that data.

Does this seem like a worthwhile extension to people?