New issue
Advanced search Search tips
Note: Color blocks (like or ) mean that a user may not be available. Tooltip shows the reason.

Issue 829912 link

Starred by 3 users

Issue metadata

Status: Available
Owner: ----
Cc:
Components:
EstimatedDays: ----
NextAction: ----
OS: Windows
Pri: 2
Type: Bug

Blocking:
issue angleproject:1155



Sign in to add a comment

Long shader compilation time on ANGLE/D3D due to high uniform count

Reported by steph...@sketchfab.com, Apr 6 2018

Issue description

UserAgent: 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:
 
Heres's some stats on different devices :

Mac:
compile with uBones[50] : 11.200000000826549
compile with uBones[500] : 12.09999999991851

Windows with nvidia:
compile with uBones[50] : 55.79999997280538
compile with uBones[500] : 301.9999999087304

Windows with intel:
compile with uBones[50] : 72.9999999894062
compile with uBones[500] : 418.90000000421423

Note: If you use the "UN-OPTIMIZED VERSION (WITH IF)" skinning verson in the vertex shader, it's a bit faster

Comment 2 by zmo@chromium.org, Apr 6 2018

gl.finish() is actually a gl.flush() in WebGL in Chrome.

Instead you can use readPixels() to force a finish.

Comment 3 by zmo@chromium.org, Apr 6 2018

Cc: kbr@chromium.org kainino@chromium.org cwallez@chromium.org jdarpinian@chromium.org geoffl...@chromium.org jmad...@chromium.org

Comment 4 Deleted

Comment 5 Deleted

Indeed it works, thx! (readPixels as finish)

Comment 7 by zmo@chromium.org, Apr 6 2018

Status: Available (was: Unconfirmed)
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

Comment 8 by zmo@chromium.org, 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?
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.
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")

Components: Internals>GPU>ANGLE
Summary: Long shader compilation time on ANGLE/D3D due to high uniform count (was: Long shader compilation time on window (ANGLE?) due to high uniform count)
Blocking: angleproject:1155

Sign in to add a comment