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

Ilmari Heikkinen [email protected]
Fri Apr 27 01:30:48 PDT 2012


2012/4/27 Glenn Maynard <[email protected]>:
> On Thu, Apr 26, 2012 at 7:26 PM, Kenneth Russell <[email protected]> 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
nowadays.

--
Ilmari

-----------------------------------------------------------
You are currently subscribed to [email protected]
To unsubscribe, send an email to [email protected] with
the following command in the body of your email:
unsubscribe public_webgl
-----------------------------------------------------------





More information about the public_webgl mailing list