adriengivry / Overload

3D game engine with lua scripting
https://overloadengine.org/
MIT License
1.76k stars 226 forks source link

Add hint to prioritize AMD discrete GPU #305

Open adriengivry opened 3 months ago

adriengivry commented 3 months ago

Problem this feature should fix Overload isn't setting the appropriate hint for the application to prioritizing using an AMD discrete GPU if available.

Expected solution Update our FORCE_DEDICATED_GPU macro to add:

// Hint that the discrete gpu should be enabled on optimus/enduro systems
// NVIDIA docs: http://developer.download.nvidia.com/devzone/devcenter/gamegraphics/files/OptimusRenderingPolicies.pdf
// AMD forum post: http://devgurus.amd.com/thread/169965
extern "C"
{
    __declspec(dllexport) DWORD NvOptimusEnablement = 0x00000001;
    __declspec(dllexport) int AmdPowerXpressRequestHighPerformance = 1; // <-- Add this line
}
eXpl0it3r commented 2 months ago

Relates to #40

Can also just be: DWORD NvOptimusEnablement = 1

SFML uses unsigned int. Not sure it matters.

https://github.com/SFML/SFML/blob/b50f62da43e0d7dc2b2855730e78a4ccf5048249/include/SFML/GpuPreference.hpp#L62-L70