Long shader compilation time on ANGLE/D3D due to high uniform count
Reported by
steph...@sketchfab.com,
Apr 6 2018
|
|||||
Issue descriptionUserAgent: Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/65.0.3325.181 Safari/537.36 Steps to reproduce the problem: https://jsfiddle.net/ryu394ae/ What is the expected behavior? What went wrong? Shader compilation is too long Initially reproduced on https://sketchfab.com/models/22f791557fa24c63886a079fd6d16211. The model has many bones (big uniform array in vertex shader). If we reduce the number of bones used on each draw call (splitting geometries), the compilation is much faster : https://sketchfab.com/models/22f791557fa24c63886a079fd6d16211?max_vertex_uniforms=75 Did this work before? No Does this work in other browsers? No https://jsfiddle.net/ryu394ae/ ^ Fast on mac, very slow on ANGLE with big arrays ps: a bit related but I'm adding an option to time each shader compilation (cpu timer). So far it's working fine in firefox (long shaders are those with many bones and fast one those without, etc). But on chrome, the results are unexpected, even with gl.finish the timings are shifted (thread issue? finish ignored, etc?), is it normal? Chrome version: 65.0.3325.181 Channel: stable OS Version: 10.0 Flash Version:
,
Apr 6 2018
gl.finish() is actually a gl.flush() in WebGL in Chrome. Instead you can use readPixels() to force a finish.
,
Apr 6 2018
,
Apr 6 2018
Indeed it works, thx! (readPixels as finish)
,
Apr 6 2018
I can reproduce this on my Windows 10 bot with NVidia Quadro K2200 with Chrome Canary (67.0.3383.0). uBones[50]: 85.7 uBones[500]: 437.2 Firefox Nightly has similar results. But if I launch Chrome with --use-angle=gl, then time drops to uBones[50]: 17.5 uBones[500]: 22.8
,
Apr 6 2018
I am not sure what we can do here. Looks like some HSLS compiler perf issue, which has a long history. ANGLE folks: any inputs?
,
Apr 6 2018
If Chrome is behaving the same as Firefox it's probably not something Chrome is doing wrong. It is most likely very related to the slow performance of the D3DCompile OS function. We know the uniform count before we call D3DCompile, so if there's some combination of flags to this function that would produce a fast compile, we could do that. But the root cause is same old slow compiles on Windows.
,
Apr 9 2018
Yes I got the same results on chrome and firefox, but both are using Angle afaik, maybe I should have opened the bug report on the angleproject, didn't know it had its own tracker. On Edge it is faster (still slow though, but that excludes). Windows with nvidia on Edge: compile with uBones[50] : 30.899935210309905 compile with uBones[500] : 121.50004169633521 https://jsfiddle.net/ryu394ae/4/ (same as above, just changing "webgl" into "experimental-webgl")
,
Apr 9 2018
,
Apr 9 2018
|
|||||
►
Sign in to add a comment |
|||||
Comment 1 by steph...@sketchfab.com
, Apr 6 2018