mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-04-20 14:20:36 +02:00
progs/wgl: Fix shreadtex_mt too.
This commit is contained in:
parent
6e24fdeae5
commit
1bee650ef3
1 changed files with 24 additions and 6 deletions
|
|
@ -50,6 +50,7 @@ struct window {
|
|||
float Angle;
|
||||
int Id;
|
||||
HGLRC sharedContext;
|
||||
HANDLE hEventInitialised;
|
||||
};
|
||||
|
||||
|
||||
|
|
@ -414,6 +415,10 @@ threadRunner (void *arg)
|
|||
Error("Couldn't obtain HDC");
|
||||
}
|
||||
|
||||
/* Wait for the previous thread */
|
||||
if(tia->id > 0)
|
||||
WaitForSingleObject(Windows[tia->id - 1].hEventInitialised, INFINITE);
|
||||
|
||||
pfd.cColorBits = 24;
|
||||
pfd.cDepthBits = 24;
|
||||
pfd.dwFlags = PFD_DOUBLEBUFFER | PFD_DRAW_TO_WINDOW | PFD_SUPPORT_OPENGL;
|
||||
|
|
@ -434,9 +439,16 @@ threadRunner (void *arg)
|
|||
}
|
||||
|
||||
if (win->sharedContext) {
|
||||
wglShareLists(win->sharedContext, win->Context);
|
||||
if(!wglShareLists(win->sharedContext, win->Context))
|
||||
Error("Couldn't share WGL context lists");
|
||||
}
|
||||
|
||||
SetEvent(win->hEventInitialised);
|
||||
|
||||
/* Wait for all threads to initialize otherwise wglShareLists will fail */
|
||||
if(tia->id < NumWindows - 1)
|
||||
WaitForSingleObject(Windows[NumWindows - 1].hEventInitialised, INFINITE);
|
||||
|
||||
SendMessage(win->Win, WM_SIZE, 0, 0);
|
||||
|
||||
while (1) {
|
||||
|
|
@ -511,20 +523,26 @@ main(int argc, char *argv[])
|
|||
h[2] = AddWindow( 10, 350, gCtx);
|
||||
h[3] = AddWindow(330, 350, gCtx);
|
||||
|
||||
if (!wglMakeCurrent(gHDC, gCtx)) {
|
||||
Error("wglMakeCurrent failed for init thread.");
|
||||
return -1;
|
||||
for (i = 0; i < NumWindows; i++) {
|
||||
Windows[i].hEventInitialised = CreateEvent(NULL, TRUE, FALSE, NULL);
|
||||
}
|
||||
|
||||
InitGLstuff();
|
||||
|
||||
for (i = 0; i < NumWindows; i++) {
|
||||
DWORD id;
|
||||
|
||||
tia[i].id = i;
|
||||
threads[i] = CreateThread(NULL, 0, threadRunner, &tia[i], 0, &id);
|
||||
|
||||
WaitForSingleObject(Windows[i].hEventInitialised, INFINITE);
|
||||
}
|
||||
|
||||
if (!wglMakeCurrent(gHDC, gCtx)) {
|
||||
Error("wglMakeCurrent failed for init thread.");
|
||||
return -1;
|
||||
}
|
||||
|
||||
InitGLstuff();
|
||||
|
||||
while (1) {
|
||||
MSG msg;
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue