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

Re: [Public WebGL] Fwd: Shared Resources revisited



On 6/25/2013 11:18 AM, Chris Endicott wrote:

Here's some benchmarks of our shader compile times in the RuneScape engine. RuneScape uses a couple of hundred permutations of shader at run time to handle various combinations of effects/lighting/shadows and so on. It does this to remove control flow statements from the shader source itself, as far as possible.


Hm, it sounds like what you really want, for this in particular, is a way to cache compiled shaders.  We were thinking of doing this under the hood anyway as we can do it transparently by hashing source + compiler details (especially when using D3D via ANGLE, by caching the bytecode).  That should largely remove this bottleneck for you.

The thing with GL context share groups, as soon as you touch contexts in a share group from different threads, you flip on all sorts of locking/sync primitives in the GL drivers, which results in an overall perf hit.  I think you'd get this even if you were to only use the other context to compile shaders.  Of course, that might not be the case for a D3D-backed GL, but as mobile WebGL is increasingly becoming viable, straight GL implementations are going to become more common.

     - Vlad