OpenGL and multiple GPUs - General possibility

2019-04-09 09:39发布

问题:

I was wondering, is it possible to run a multi-window OpenGL application on more than one GPU simultaneously? To be more specific, let's say I've created an application with two windows each sharing it's GL context between each other. Now if I'd move one of those windows from display 1 (running on GPU 1) to display 2 (running on GPU 2), would this actually work? Would sharing contexts alone do the trick?

My first guess would be no. And if this is really not that simple, is there a way to accomplish this? I could also imagine that it depends on whether the two GPUs are controlled by the same driver or not (or even worse, let the machine have an ATI as well as an nVidia card, both supporting different GL versions).

I would appreciate any insights on this topic, purely informational since I can't find anything after quick googling. Does anyone know the possibilities?

EDIT: By the way, unfortunately I don't have a machine with multiple GPUs available at the moment, so I would test around a little bit.

回答1:

Short Answer: yes.

Long Answer: Windows/Mac OS X: The windows are always updated by one GPU, and possibly the pixels are copied to another GPU.

Linux: If Xinerama is off, you can't move the window between screens (GPUs). If Xinerama is on, iirc at least the nVidia drivers send GL commands to both GPUs simultaneously so you can move them.

There are ways to control GPU selection and GPU-GPU copies programmatically. More information here.