Multithreading + OpenGL
System Configuration:-
--------------------
1) '2' AMD Opteron 64-bit processors
2) '2' Geforce 7800 GTX GPUs (NOT connected in SLI)
Problem:-
-------
1) Created Win0 (hDC0, hRC0) that maps to GPU0 and Win1 (hDC1, hRC1) that maps to GPU1.
2) Now I've created two threads, and trying to render to their respective windows. Inside the ThreadProc() (using Win32 Threads):
ThreadProc(LPVOID tData)
{
wglMakeCurrent(tData->hDC, tData->hRC);
GLCommands......
}
Each thread calls the same function but with different tData. I also map Thread0-to-CPU0 and Thread1-to-CPU1. So,
Thread0:-
wglMakeCurrent(hDC0, hRC0);
Thread1:-
wglMakeCurrent(hDC1, hRC1);
Can multiple (hDC, hRC) be active at the sametime. Bare in mind there are two different windows that map to two Physical GPUs. Also at any given time only one window is current (in focus). Two windows do not overlap.
win0 = CreateWindow(0, 0, 2048, 768);
win1 = CreateWindow(2048, 0, 2048, 768);
Thanks!
you can have multiple contexts active at the same time as long as they are in different threads and you dont try to activate a context while it is current in another thread
Quote:Original post by Toolmaker
Your problem is a bit unclear... What is the exact problem?
I haven't actually implemented this.
I want to create two windows one on each GPU. Then create two threads to render into these windows simultaneously.
I have two threads, each one is running on a different CPU. Each thread calls wglMakeCurrent(hDC, hRC) (their respective hDC,hRC pair). Since the two threads are running on different CPUs they are running in parallel. So each thread calls its wglMakeCurrent(). Can multiple hDC,hRC pairs be current at the sametime ?
Quote:Original post by Ademan555
Just for the record, your hardware sounds orgasmic
cheers
-Dan
Thank you! Also enjoying experimenting with different GPU configurations.
Quote:Original post by dimensionX
Can multiple hDC,hRC pairs be current at the sametime ?
Quote:Original post by _the_phantom_
you can have multiple contexts active at the same time as long as they are in different threads and you dont try to activate a context while it is current in another thread
I'd be interested in how this turns out, I did some test with threaded rendering before, but switching an OGL context in and out is a very expensive operation.
yeah, context switching is a killer, which is why everyone is glad to see the back of pbuffers.
What the OP is doing on the other hand should work perfectly, as he'll only have to make the context current once per thread as long as he keeps rendering to the same context from the same thread.
There was some stuff from the GDC05 presentations which briefly touched on MT rendering with OGL, the OGL forum FAQ has some links to the pdfs and videos from it.
What the OP is doing on the other hand should work perfectly, as he'll only have to make the context current once per thread as long as he keeps rendering to the same context from the same thread.
There was some stuff from the GDC05 presentations which briefly touched on MT rendering with OGL, the OGL forum FAQ has some links to the pdfs and videos from it.
I'm assuming you know all about setting processor affinity masks, and that you hvae SMP-capable drivers, etc?
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement