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

Re: [Public WebGL] Support precompiled shaders as extensions

This is very cool, Jamie!

On 30 November 2016 at 22:27, Jamie Madill <jmadill@chromium.org> wrote:
Good news, initial prototype for internally parallel compiling shaders has landed for D3D/ANGLE. It should be available in tomorrow's Canary, and make it's way to stable in the next few months (assuming no reverts :). Benchmarking shows a 50% improvement in a loop that compiles a tiny shader and draws with it once.

Haven't had time to investigate exposing some version of the extension, but that is something for future work.

On Fri, Nov 25, 2016 at 7:35 AM, Mr F <arthur@playcanvas.com> wrote:
From D3D11 perspective (ANGLE) it is possible to compile shaders by simply launching a separate fxc.exe process and checking for it to end. Loading its output is quite fast, and ID3D11Device class (which performs the loading) supports multithreading. I guess browser can spawn a spare process dedicated to that (can be shared by all tabs), as well as call fxc.

On 25 November 2016 at 11:51, Florian Bösch <pyalot@gmail.com> wrote:
Interesting, but spawning a new GL context/process for each shader compilation "thread" isn't really a nice way to do things, particularly not on mobiles.

On Fri, Nov 25, 2016 at 5:09 AM, Mark Callow <khronos@callow.im> wrote:

On 2016 Nov 25, at 0:38, Florian Bösch <pyalot@gmail.com> wrote:

Sorry, I was confusing them with framebuffer objects which (at least in some implementations) you can't share. However it is usually the case that operations done on resources in one context need to be completely finished before any of their state can be shared with another context (i.e. you have to invoke a blocking call such as getting the compile status, or calling glFinish), I'm sure similar restrictions apply to D3D.

In OpenGL {ES} I think you can call glFenceSync after the compile/link commands and in the thread on the other context you can check for completion with glClientWaitSync with a timeout of 0. WebGL 2 has sync objects too.