- Home /
How to do I make a windows build default to using nVidia instead of integrated on a Windows laptop?
I am a developer. I'm building a game in Unity. My laptop runs Windows 8.1 and has an nVidia GT 750M and an integrated Intel HD 4600. When I build for Windows the game runs with the integrated graphics card, not the dedicated GPU, so quality and performance suffer.
I don't care that this happens to me. I am a developer and I can find the end-user work-arounds to change the default graphics processor for this specific instance on my machine.
I do care that players of my game on laptops like mine will have a sub-optimal experience because they don't know or don't care to work out how to change the graphics processor option.
How do I make a Unity windows executable default to using the faster GPU, or explicitly give the option to the end-user?
The work around, before someone suggests it: right-click on the executable and choose "Run with graphics processor > High-performance NVIDIA prcessor".
Please don't tell my end-users they have to do this or similar. There are other end-user solutions and workarounds listed within the links below, but I'm asking for a developer solution, if anyone can help.
Sorry, this question has been asked before. However, I'm yet to find an answer for developers.
Here's a selection of previous, similar questions (none with solutions for developers):
Standalone Desktop player: nvidia Optimus uses internal gpu; How to let use dGPU ?
How do we force Unity 3d build to run on a specific graphics device?
How to make Unity games use you Nvidia card on a laptop (SOLUTION) (Solutions for end-users, but doesn't help developers)
How can I set my application to run on the High performance GPU by default? — includes a partial answer
For completeness, here's a list of others having had the same problem with other platforms:
Unity not picking up NVIDIA display adapter (web player)
How to get webplayer to detect and use dedicated GPU over integreated(or vice versa) (with end-user solution April 2014)
Problem with nVidia Optimus technology! (web player, with end-user solution circa 2011)
Detect / force a Mac to use dedicated graphics card ? (Mac in power saving mode)
How to get Unity working on dual gpu laptop? (Ubuntu Linux - with end-user solution)
Answer by pengo · Aug 05, 2014 at 11:09 PM
I've found the documentation for how to direct the Optimus driver at runtime to use the High Performance Graphics
Starting with the Release 302 drivers, application developers can to render any application–even those applications for which there is no existing application profile.
I haven't attempted to write code to do interface with this API as yet. It really ought to be done by Unity itself though, or at least be a Windows/Desktop build option.
Did you find a solution or try setoptimusprofile on http://drivenbynostalgia.com/ ?
Answer by Twitwi · May 08, 2016 at 08:56 PM
If you look at The Optimus Rendering Policies (also cited by @pengo) you will find that there is a few ways to do it. I have found that the simplest solution is to do number 4: Static Library Bindings.
All you need to do here is to put one of the following libraries in your plugins folder: vcamp110.dll, vcamp110d.dll, nvapi.dll, nvapi64.dll, opencl.dll, nvcuda.dll, and cudart*.*
Note: I don't know if there is some licensing issue with distributing some of these libraries as part of your game, check it for yourself.
OpenCL.dll can be retrieved from C:\Windows\System32\
That is all you need.
Answer by tswalk · Jun 22, 2014 at 08:44 AM
this isn't a unity build issue (unless you've intentionally lowered the quality settings), it's either BIOS/EFI related to the laptop and or driver related... unity will use whatever video card the system hands off to it for use.
just taking a guess... it's probably a Dell product (?), then you either have to find that magic key combo that switches that Quantum garbage to the GTX, update to the latest drivers, or figure out how to disable the Intel integrated card. Even though the HD4000 isn't the biggest kid on the block it can handle stuff most stuff well enough... unless you're trying to run Crysis in ultra mode.
have you tried testing the build on a desktop with a dedicated graphics card?
It's an Asus, not Dell. As I said, I can configure the nVidia control panel so that the instance of my game on my laptop will use the dedicated GPU. That's not my worry. $$anonymous$$ost games will use the nVidia GPU without the user having to configure anything or right-click on anything, and that's what I'd like to be able to do. Is it possible?
I personally think it would be too much trouble to try to resolve that use case.. even though it isn't "rare", I think most people who have a system like that should (or would ) know that they need to switch GPU modes. I have an Alienware that does this and it was one of the first things as a user I had to figure out.
In order to attempt to address this as a developer, you more than likely would be required to get some in-depth knowledge of the driver for the system that controls this... and that would probably be the most difficult part. It could be different for multiple platforms as I do not think there is a standard interface for it. I've seen it on several Dells, but as you pointed out.. you have an ASUS that does this. The code could be very different between the two.
There isn't anything stopping you from trying and perhaps making a Win$$anonymous$$D for Unity to address it, but then you have crossed a line over from being a game developer to being a hardware platform developer and then supporting it.
Since these platforms have a built in mechanism to change GPU modes already, I just think you would be wasting your time trying to programmatically do this in Unity.
Your answer
Follow this Question
Related Questions
[Android] Escape characters for the password of my alias key 0 Answers
Can you disable Android immersive mode in Unity 5? 2 Answers
Build Settings or Project descriptor file in Unity 1 Answer
Unity build with multiple .exe files 2 Answers
won't acknowledge scene in build settings, but will load it 0 Answers