PDA

View Full Version : Context Sharing and Hardware


Matrix
2005.05.02, 05:24 AM
I'm trying to implement dual-screen mode in one of my projects and have a few questions. I plan to use context sharing so that I don't need to rebind all the textures and such for each display but most people run two displays using two different GPU's. I'm assuming that context sharing doesn't work between 2 separate GPU's (because their pixel format is different).

The problem is, I have no way of testing this. I have an iBook, and the best is can do is use the firmware hack to enable dual-head mode. But thats one GPU and so it always works...

Also, what happens when a user drags a window with an OGL context to a screen powered by another GPU? Does the system copy all the resources over to the other GPU?

Thanks,
Adam Zegelin

OneSadCookie
2005.05.02, 05:45 AM
I think you should be able to share your contexts, but I'm not 100% sure.

A window is always rendered by the GPU owning the largest portion of its content area.

arekkusu
2005.05.02, 11:49 AM
You can not share contexts across GPUs, only within the same virtual screen. If you detect that you have two (or more!) GPUs, you'll need to send your resources (textures, display lists, etc) to each of them.

An alternative is to make one big window spanning two displays. In this case the renderer owning the largest portion of the window will render everything, and the resulting bitmap is copied to the other renderer to draw on the portion of the window on its display. Of course, there is a performance hit involved here. And it only works in windowed mode, not fullscreen. And, you're severely limited by MAX_VIEWPORT_DIMS... it might work for two 1024x768 displays, but not two 2650x1600 displays... ;)

If any of the above restrictions doesn't work for you, make two separate contexts and manage them yourself. You really need to get access to a desktop machine with two GPUs to test it.

Matrix
2005.05.05, 11:23 PM
Thanks guys for all your help. I think I've got it working now. I'm still gonna have to test it somehow, but I'll leave that for later.

Cheers,
Zegelin