Choosing specific GPU for OpenGL context?

Started by
5 comments, last by Dark Helmet 10 years, 5 months ago

I have an issue with my application (Win7 64bit OpenGL 4.0), picking the wrong GPU on some peoples machine for OpenGL acceleration such as the Intel HD3000 embedded GPU vs the Nvidia or ATI GPU. HD3000 does not support OpenGL 4.0 (AFAIK), which is my min requirement, so the app fails to run.

BTW, my app is intended to be cross platform (but for right now Windows 7 is most important, then Linux, then Mac).

I am currently creating my OpenGL 4.x context with the aid of SDL 1.2 (started this code base a while back) and glew. With SDL 1.2 there is no way to enumerate the available devices (GPUs) and select one. I remember back in my DX days, device enumeration and selection was supported.

Does anyone know if any other cross platform OpenGL context creating libraries such as SDL 2.0, SFML, GLFW, support device enumeration and device specific gl context creation (with glew support)?

My only work around right now is forcing the app to use the Nvidia card under the Nvidia control panel (or ATI), and turning off Intel Optimus at the bios level, neither of which (I think) can be automated. This is alot to ask of a user, and is a horrid kludge.

Thanks for any guidance.

Advertisement

Well, as far as I remember there were extensions like: http://www.opengl.org/registry/specs/NV/gpu_affinity.txt and http://www.opengl.org/registry/specs/AMD/wgl_gpu_association.txt for WGL, these also have equivalent for GLX if you're under operating system (for working on multi-gpu systems - like Crossfire'd GPUs). Not sure whether this helps though - for this case.

My current blog on programming, linux and stuff - http://gameprogrammerdiary.blogspot.com

With optimus there is usually only a single GPU as far as application software can see, and the driver chooses what hardware to use depending on control panel settings or whether the computer is plugged in or whatever it wants.

With optimus there is usually only a single GPU as far as application software can see, and the driver chooses what hardware to use depending on control panel settings or whether the computer is plugged in or whatever it wants.

This. Optimus won't show separate GPUs. You may be able to do what you want through the NVAPI but no promises.

SlimDX | Ventspace Blog | Twitter | Diverse teams make better games. I am currently hiring capable C++ engine developers in Baltimore, MD.

This. Optimus won't show separate GPUs.

However, if you specify a mode that the integrated part doesn't support, Optimus should auto-select the discrete GPU.

It might not always work - that's why the NVidia control panel lets you force one or the other.

Tristam MacDonald. Ex-BigTech Software Engineer. Future farmer. [https://trist.am]

Other than Optimus GPU switching issue (say for example we just shut it off in the bios), do any of the cross platform OpenGl Context creating libraries out there such as SDL2, SFML, or GLFW, support device enumeration and device specific GL context creation (with glew support, since i would like to use OGL 4.0 min or OGL 4.3 if available)?

From their online documentation, I haven't found it obvious if they do or do not support this (haven't gone into much depth).

Or is it just beyond there control fundamentally?

Too bad we're talking Windows here not Linux. There you just setup one GPU per screen, create an X connection on the appropriate screen, and create a GL context on that connection (on NVidia at least). Pretty simple.

With optimus there is usually only a single GPU as far as application software can see, and the driver chooses what hardware to use depending on control panel settings or whether the computer is plugged in or whatever it wants.

This. Optimus won't show separate GPUs. You may be able to do what you want through the NVAPI but no promises.

But, but... isn't that always the case anyway, even without optimus?

The only OpenGL context that you can create to my knowledge is one that belongs to a device context. The device context, on the other hand, belongs to the one GPU (or, in the case of dual GPU the manufacturer and GPU model, though it may be one GPU or the other, identical one) that Windows uses to render the desktop with. No?

This topic is closed to new replies.

Advertisement