Frame time counters/GPU engine intrumentation don't work on mobile

When using code from the example for frame time counters (https://playground.babylonjs.com/#HH8T00#1) the frame times always read 0 on mobile, even if the scene is far too complex and is lagging hard on the device.

It doesn’t show frame time on a Pixel 6 or a Moto Z2 Force using Chrome. It does show the shader compilation time.

Perhaps there is other instrumentation that should be used instead?

This relies on some WebGL level apis which are unfortunately not availalbe on mobile so there is not much we can do on our side, this is using the timer query extensions from webgl

The docs here Optimizing Your Scene | Babylon.js Documentation note that this has been added in on some browsers, it also provides a link to test pages to see what features are enabled on your browser.

When I go to the Khronos link on mobile, it shows all passing for EXT_disjoint_timer_query extension support. Similarly the Webgl2 support link shows that all functions are implemented (Though it makes no mention of disjoint_timer_query, on desktop or mobile)

But your supported extension list does not show it being supported on your mobile, could you check if you see it in chrome://gpu ?

I used this yesterday on Chrome/Android and it works. I had to turn on the flag chrome://flags#enable-webgl-developer-extensions and restart the browser.

4 Likes

Good point, I wonder why the test passes, but the extension doesn’t show :thinking:

On chrome://gpu it lists the extension in GL_EXTENSIONS, and not under disable ones.

However the solution from @brunobg works!

How does one contribute to the docs to make a note that it can be enabled manually through that flag?

1 Like

You could make a PR to Documentation/Optimizing_your_scene.md at 727f01cf6fe5ace30ba50140f68c13d871b2dec6 · BabylonJS/Documentation · GitHub

This would be awesome !!!

1 Like

PR made! Adds instructions for enabling EXT_DISJOINT_TIMER_QUERY on chrome mobile by douglasg14b · Pull Request #390 · BabylonJS/Documentation · GitHub

3 Likes