(Chrome, Windows, WebGPU) Frictionless option to use dedicated graphics card?

Hey everyone,

I’m a bit sad. I’ve been working on my very WIP game and while my laptop had a decent CPU, it had no dedicated GPU. So I finally splashed a little (a lot) for my birthday and bought a new laptop with a latest-and-greatest Nvidia card, but to my surprise I was getting nearly the same performance as my older machine.

It just occurred to me today that the browser might not even be using my brand new GPU – I went to check the task manager (Windows 11) and indeed the integrated GPU is being used rather than the Nvidia one.

I was able to fix this following Setting the Preferred Graphics Processor to assign the dedicated GPU to my browser (Chrome).

But I feel like this isn’t something I can reasonably expect players of my game to do. I had some hope at first about the GPUPowerPreference option of WebGPU (the engine I’m using in Babylon) which allows to choose a “high-performance” (dedicated) or “low-power” (integrated) GPU. Unfortunately this is both behind a Chrome flag (#enable-webgpu-developer-features) and didn’t work when I tested it.

I guess I have a statement and a question:

  • If you are using Windows and Chrome and haven’t ever done this, try selecting a dedicated GPU in Graphics settings for Chrome if you haven’t done so. It can make an insane performance difference, making at least the development environment less frustrating if slowness is an issue.
  • Am I missing something that I can control from my app to get the more performant GPU used by default?

I do understand why the default configuration is to use low performance, as it’s fine for normal browsing use and doesn’t consume as much energy. But it’s sad for the web-based gaming community (at least on Chrome + Windows) if there isn’t a frictionless way for a game to request with minimal / no user interaction an ‘upgrade’ for a tab that needs the extra acceleration, if I haven’t missed something.

Happy to hear your thoughts!

EDIT:

Oh, a follow-up question:

I hope to eventually publish the game to steam, and was planning to just bundle Chromium into a simple installer. I guess I could then have the installer do Windows-level config stuff, like setting the GPU adapter for my chrome.exe target?

Apparently something like this is possible via the registry:

[HKEY_CURRENT_USER\Software\Microsoft\DirectX\UserGpuPreferences]
"C:\\Program Files\\MyGame\\MyGame.exe"="GpuPreference=2;"

Anyone ever done something like this before?

1 Like

My understanding is that there is no way for web content to make a decision about which graphics device is used for WebGL, and I imagine the same is true for WebGPU. I’d be very excited to find out that I’m wrong, many users could be affected by this. Different browsers have different defaults, so users could be advised to use one that is more likely to use the GPU by default (e.g. Brave instead of Chrome), but I don’t think it gets any more frictionless than that.

1 Like

You are totally right default is the cheapest to minimize power consumption :slight_smile: i will relay this to the dev team as we have the same ask a few times and users should be able to upgrade to their discrete gpu if they want too.

2 Likes

Thanks! A similar precedent that comes to mind is being able to choose between webcams in the Media API based on desired constraints, e.g. { facingMode: { exact: "user" } }.

While I don’t know about WebGL, It’s wonderful that this is explicitly considered already in the WebGPU spec: WebGPU: Adapter selection

It just doesn’t seem to be honored in browsers yet. Or perhaps I’m testing it wrong. I do see that the flag is exposed through Babylon but haven’t seen anyone make use of it anywhere yet.