PDA

View Full Version : Multiple vendor GPU selection in Windows



elFarto
03-02-2015, 11:40 AM
Hi

Am I right in thinking that there's no way to select which GPU you'll get in Windows, and that it will just use whatever device is set to the primary display?

I ask this because I think I've found a way around this, although I should note, it's a complete hack, and requires dynamically patching opengl32.dll in memory to get change its device selection code.

Regards
elFarto

elFarto
03-07-2015, 01:14 PM
Well, I probably posted this at the wrong time, what with Vulkan coming out and all, so here's the source for my example. The basic premise is to override the EnumDisplayDevices call the opengl32.dll library makes. It's hard coded to pick the primary device, so we intercept that call, replace the device index with our pre-selected one, and pretend it's the primary device before returning to opengl32.dll.

This will allow me to select between my Intel and NVIDIA card.

Regards
elFarto

Alfonse Reinheart
03-07-2015, 01:29 PM
Well, I probably posted this at the wrong time, what with Vulkan coming out and all

Unless there's an extension to create an OpenGL context against a Vulkan GPU device (and hey, I'm all for that), it's still important. Khronos's slides suggest that OpenGL's still going to be updated alongside Vulkan, so it's like like GL will fall off the face of the Earth once Vulkan lands.

Though I am holding out hope that someone will write a "mini-GL" that implements a subset of core GL 4.5 over top of Vulkan. Not so much for performance but for stability; it'll be an open-source library, so it can be fixed reasonably easily if there's a problem.