0

Is there a way to force VSCode to use CPU/SW rendering?

I am currently working with 3D graphics program (Daz Studio), it extensively uses GPU for asset rendering and needs every bit of my 6GB GPU memory. I mainly use browser, VSCodium and Daz Studio. I have already switched my browsers to use only CPU (i.e Software rendering) which saves me 200-300MB of GPU memory, I want to do the same with VSCode which would free up 200MB more. Is this possible?

I tried to look around the settings but I could force the "Terminal" to use CPU but it did not help much.

starball
  • 20,030
  • 7
  • 43
  • 238
Lokanath
  • 662
  • 5
  • 18

2 Answers2

2

You can edit your ~/.vscode/argv.json file and uncomment the line that says ""disable-hardware-acceleration": true":

// Use software rendering instead of hardware accelerated rendering.
// This can help in cases where you see rendering issues in VS Code.
// "disable-hardware-acceleration": true,

See the docs for more info: https://code.visualstudio.com/updates/v1_40#_disable-gpu-acceleration. Quoting from those docs:

We have heard issue reports from users that seem related to how the GPU is used to render VS Code's UI. These users have a much better experience when running VS Code with the additional --disable-gpu command-line argument. Running with this argument will disable the GPU hardware acceleration and fall back to a software renderer.

To make life easier, you can add this flag as a setting so that it does not have to be passed on the command line each time.

To add this flag:

  • Open the Command Palette (Ctrl+Shift+P).
  • Run the Preferences: Configure Runtime Arguments command.
  • This command will open a argv.json file to configure runtime arguments. You might see some default arguments there already.
  • Add "disable-hardware-acceleration": true.
  • Restart VS Code.

Note: Do not use this setting unless you are seeing issues!

starball
  • 20,030
  • 7
  • 43
  • 238
0

Alright, After some digging into vscode's repo I figured that we can pass the argument "--disable-gpu" on the executable, this prevents VSCode from using the GPU.

I directly edited this to codium.bat Example : "%~dp0..\VSCodium.exe" "%~dp0..\resources\app\out\cli.js" --ms-enable-electron-run-as-node %* --disable-gpu

Still I could not find a built in setting to do this, for now I am use this workaround.

Update : Hopefully there will a UI option in future ticked submitted at https://github.com/microsoft/vscode/issues/174936

Lokanath
  • 662
  • 5
  • 18