[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [Public WebGL] ANGLE_instanced_arrays extension proposal
On Wed, Mar 7, 2012 at 12:27 AM, Won Chun <email@example.com> wrote:
Even if the driver didn't support it, I would guess that you could implement this extension using native pseudo-instancing, which could be substantially faster than JS/WebGL pseudo instancing on slower CPUs.
I do think this is a worthwhile idea to pursue. If the contents of the buffer that's bound to an attribute unit is known at the time of drawing, then the divisor on that attribute could be used to fill a bigger buffer with that attribute and substitute the binding with that one. One would have to:
- intercept buffer binds, just to get a reference for the currently bound buffer
- intercept buffer data calls and memcpy a buffer to a "shadow", this avoids having to readback, mark buffer as dirty
- intercept attrib pointer calls, just records the specification and location, mark buffer as dirty
- intercept divisor setting, just records the specification, mark buffer as dirty
- at the time of calling draw
if: buffers are clean, nothing to do, call draw
else: analyze settings, compute appropriate (replicated attributes) buffers, mark as clean, call draw.
I think this could even be shunted to software entirely in JS, and a bit more efficiently with native code.