2

I know this might sound crazy but I have the GPU locked up doing some heavy neural-network processing in a webworker, but I still want to use the canvas for some visuals. When the GPU is being shared the canvas only manages about 5fps so I'm hoping that a software (CPU) rendering approach might provide modest improvements.

Is there any way to force the canvas to use the software rendering, which I think is the usual fallback when GPU is not available?

Thank you in advance.

Cooper Moss
  • 107
  • 1
  • 6
  • 1
    Ideally you would move all the heavy neural-network processing to the cloud and leave the browser to do what it does best – Helder Sepulveda Apr 29 '20 at 22:40
  • Note that it might be possible for you to generate the graphics yourself from the CPU only by manipulating an ImageData, but not sure you'll have more than 5FPS either, it really depends on what you are doing. Might be worth an other question with these details, but the previous comment is right, these neural network processings should probably be offloaded. – Kaiido Apr 30 '20 at 01:10

1 Answers1

3

I am not sure it can be controlled from code, but specific browsers might provide this as an option.

If you use Google Chrome go to URL chrome://flags and search for "Accelerated 2D canvas". It should be Enabled by default, change it to Disabled and relaunch the browser. It should do the trick.

To verify you can open chrome://gpu page and in "Graphics Feature Status" section you should see

Canvas: Software only. Hardware acceleration disabled

Michael Radionov
  • 12,859
  • 1
  • 55
  • 72
  • I feared that was the case. It's not really practical to ask users to do this. Thanks for the tip though. I can at least see it it would make a difference. – Cooper Moss Apr 29 '20 at 22:48