0

I have an Electron app and I'm trying to figure out if there's a way to programmatically force OS to run it on high-performance (discrete) GPU instead of the integrated GPU.

Is there a CLI command / hack that can force OS to do this (similarly to how games automatically run on discrete GPU)?

I found this thread, but I'm not sure how to apply it for Node.js:

// Enable dedicated graphics for NVIDIA:

extern "C" 
{
  __declspec(dllexport) unsigned long NvOptimusEnablement = 0x00000001;
}

// Enable dedicated graphics for AMD Radeon:

extern "C"
{
  __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1;
}
AlekseyHoffman
  • 2,438
  • 1
  • 8
  • 31

1 Answers1

1

Have you looked into gpu.js? The linked blog post offers useful examples.

Edit:
Ah, entire app. How about the Electron flag --force_high_performance_gpu?

If that doesn't work someone here figured out a way to restart the app on dGPU. ...although the thread also mentions it's on dedicated by default, so maybe something changed in the last couple years?