Monday, March 16, 2015

Firefox 37 adds support for WebGL rendering using D3D11 on Windows. Up till now we were using D3D9 which has very limited support for cross-device synchronization. Without proper synchronization we were forced to wait on the main thread for WebGL content to finish rendering before we could continue script execution. The result of this is that the total frame rendering time would be the sum of the script time and the remaining gpu time. D3D11 allows us to use a GPU-side read barrier between the main thread and compositing thread. This lets Firefox avoid waiting on the main thread giving improved responsiveness and more time for script execution.

Here's a test program that lets you adjust the GPU and CPU execution times to see how the browser responds. D3D11 WebGL let's you adjust the CPU time up to nearly 15ms without dropping below 60fps.

D3D11 support also lets us expose the WEBGL_draw_buffers extension which allows drawing to multiple output buffers at the same time, functionality that's very helpful for implementing deferred renderers.

Give D3D11 WebGL support a try in Firefox Beta today and let us know how it works.