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

Re: [Public WebGL] Geometry instancing support (ie. draw*Instanced)

On 3/11/10 10:57 AM, Cedric Vivier wrote:
On Fri, Mar 12, 2010 at 2:21 AM, Cedric Vivier<cedricv@neonux.com>  wrote:

The addition of the possible usage of gl_InstanceID in shaders would be a
paragraph in the "Differences between WebGL and OpenGL ES 2.0" section.

E.g / proposal :

IDL: void drawArraysInstanced(in GLenum mode, in GLint first, in GLsizei count, in GLsizei primcount) raises(DOMException); void drawElementsInstanced(in GLenum mode, in GLsizei count, in GLenum type, in GLsizeiptr offset, in GLsizei primcount) raises(DOMException);


drawArraysInstanced(mode, first, count, primcount) (EXT_draw_instanced man

drawElementsInstanced(mode, count, type, offset, primcount)
(EXT_draw_instanced man page)
Draw given primcount instances using the currently bound index array. The
given offset is in bytes, and must be a valid multiple of the size of the
given type or an INVALID_VALUE error will be raised. Shader variable
gl_InstanceID is incremented for each instance, from 0 inclusive to
primcount exclusive.

6.2 Geometry instancing

WebGL adds instanced draw calls drawArraysInstanced and
drawElementsInstanced, consequently gl_InstanceID is a valid vertex shader
input variable that holds the integer index of the current primitive in an
instanced draw call. If the current primitive does not come from an
instanced draw call, the value of gl_InstanceID is zero.

I'm in favor of adding these changes to WebGL 1.0.

On our conference call, we discussed whether or not this should be done via extension or directly as part of WebGL.

On the one hand, we're always hesitant to increase the delta between OpenGL ES 2.0 and WebGL. But on the other hand, I *really* like the performance gains by doing this. I think doing this as part of the specification makes sense. Such an inclusion isn't the norm, however. It *is* important to "feature freeze" especially as we approach 1.0. Here, however, I'm certainly prepared to make an exception and include this in the specification.

I'm ok with Cedric's text for inclusion in the spec. Does anyone strongly disagree?

-- A*
You are currently subscribe to public_webgl@khronos.org.
To unsubscribe, send an email to majordomo@khronos.org with
the following command in the body of your email: