I have a Dell XPS 15 under Ubuntu 20.04 with an Intel UHD 630 and Nvidia GTX 1050 configured in "on-demand" mode. In gaming it works properly. However when I use Firefox to load this demo under the Intel GPU, I can display up to 1000 fishes at 60FPS. Under the Nvidia GPU, it fluctuates between 20 and 30FPS, even with one fish. Under chromuim-based browser it's worse and limited at 15FPS.
Thanks by advance for your answers ?
Most probably, your browser is set not to use hardware acceleration. In Chrome navigate to Menu → Settings → Advanced → System and switch on Use hardware acceleration when available.
You're right, gpu acceleration is disabled under on-demand mode, in both web-base (chromium and firefox). It's probably due to an incompatibility. If I run all the system under the Nvidia GPU (performance mode), then the GPU acceleration is enabled and I can go up to 15000 fishes at 60FPS ?. So now I know that WebGL doesn't support Nvidia Prime on-demand mode.
However I'll go back to on-demand mode because the laptop is noisy and the battery doesn't hold charge for a long time in performance mode. For many WebGL apps, the Intel GPU is enough.
Thanks for your answer ?