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

Re: [Public WebGL] Should the non-typed-array overloads of uniform*v and vertextAttrib*v be IDL arrays or IDL sequences?

2012/4/27 Glenn Maynard <glenn@zewt.org>:
> On Thu, Apr 26, 2012 at 7:26 PM, Kenneth Russell <kbr@google.com> wrote:
>> Early drafts of the WebGL spec used sequences for these arguments.
>> When arrays were added to Web IDL, they were changed to arrays, to
>> potentially support more efficient calls from JavaScript to C++.
>> However, these entry points never mutate the incoming array.
> This seems like a premature optimization; the call overhead of WebGL calls
> seems very unlikely to ever be a bottleneck.  (This isn't OpenGL 1.0, with
> function calls per vertex.)  ArrayBuffer deals with the cases where avoiding
> copies matters, but worrying about making a copy of four floats just seems
> like a distraction.

FWIW, it used to be one of the biggest bottlenecks in WebGL. JS -> C++
wasn't cheap and converting JS objects to native types wasn't cheap
either (which was the reason for having Typed Arrays in the first
place, iterating and type converting a JS Array for use in bufferData
hobbled perf with large meshes.) And while you don't have function
call per vertex, you have half a dozen uniform calls per object plus
other state management and the draw call.

Granted, that was the situation a few years back. I don't know how
much better JS engines are dealing with C++ calls and type conversions


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