0

I am programming a simple OpenGL 3D application. If I am running the application on a laptop, the performance is terrible since the internal Intel GPU is selected always and not the more powerfull dedicated AMD GPU.

I did read that I have to inlclude this line to force the application to run on the dedicated GPU:

extern "C" __declspec(dllexport) DWORD AmdPowerXpressRequestHighPerformance = 0x00000001;

However, I get an LNK2005 error that AmdPowerXpressRequestHighPerformanceis already defined in multiple .obj files. I don't know how to fix this and I didn't find this variable name in any of the files that I did include in my application.

If it helps: I am using GLFW3 and GLAD for the OpenGL rendering.

Lemonbonbon
  • 686
  • 5
  • 25

2 Answers2

1

Make sure you aren't building GLFW with GLFW_USE_HYBRID_HPG defined, which causes GLFW to export NvOptimusEnablement & AmdPowerXpressRequestHighPerformance itself.

genpfault
  • 51,148
  • 11
  • 85
  • 139
0

Solved by putting the code in the correct place, as suggested in the comments above.

Lemonbonbon
  • 686
  • 5
  • 25