BOOL WINAPI wglMakeCurrent_prox( HDC hdc, HGLRC hglrc ) { ContextInfo *context; WindowInfo *window; BOOL ret; CR_DDI_PROLOGUE(); crHashtableLock(stub.windowTable); crHashtableLock(stub.contextTable); context = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc); window = stubGetWindowInfo(hdc); if (hglrc!=0 && !context) { crWarning("wglMakeCurrent got unexpected hglrc 0x%x", hglrc); } ret = stubMakeCurrent( window, context ); crHashtableUnlock(stub.contextTable); crHashtableUnlock(stub.windowTable); return ret; }
//we're not going to change icdTable at runtime, so callback is unused PICDTABLE APIENTRY DrvSetContext(HDC hdc, HGLRC hglrc, void *callback) { ContextInfo *pContext; WindowInfo *pWindowInfo; BOOL ret = false; CR_DDI_PROLOGUE(); (void) (callback); crHashtableLock(stub.windowTable); crHashtableLock(stub.contextTable); pContext = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc); if (pContext) { pWindowInfo = stubGetWindowInfo(hdc); if (pWindowInfo) ret = stubMakeCurrent(pWindowInfo, pContext); else crError("no window info available."); } else crError("No context found."); crHashtableUnlock(stub.contextTable); crHashtableUnlock(stub.windowTable); return ret ? &icdTable : NULL; }
BOOL WINAPI wglMakeCurrent_prox( HDC hdc, HGLRC hglrc ) { ContextInfo *context; WindowInfo *window; context = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc); window = stubGetWindowInfo(hdc); return stubMakeCurrent( window, context ); }
/** * This is called when we exit. * We call all the SPU's cleanup functions. */ static void stubSPUTearDownLocked(void) { crDebug("stubSPUTearDownLocked"); #ifdef WINDOWS # ifndef CR_NEWWINTRACK stubUninstallWindowMessageHook(); # endif #endif #ifdef CR_NEWWINTRACK ASMAtomicWriteBool(&stub.bShutdownSyncThread, true); #endif //delete all created contexts stubMakeCurrent( NULL, NULL); /* the lock order is windowTable->contextTable (see wglMakeCurrent_prox, glXMakeCurrent) * this is why we need to take a windowTable lock since we will later do stub.windowTable access & locking */ crHashtableLock(stub.windowTable); crHashtableWalk(stub.contextTable, hsWalkStubDestroyContexts, NULL); crHashtableUnlock(stub.windowTable); /* shutdown, now trap any calls to a NULL dispatcher */ crSPUCopyDispatchTable(&glim, &stubNULLDispatch); crSPUUnloadChain(stub.spu); stub.spu = NULL; #ifndef Linux crUnloadOpenGL(); #endif #ifndef WINDOWS crNetTearDown(); #endif #ifdef GLX if (stub.xshmSI.shmid>=0) { shmctl(stub.xshmSI.shmid, IPC_RMID, 0); shmdt(stub.xshmSI.shmaddr); } crFreeHashtable(stub.pGLXPixmapsHash, crFree); #endif crFreeHashtable(stub.windowTable, crFree); crFreeHashtable(stub.contextTable, NULL); crMemset(&stub, 0, sizeof(stub)); }
void APIENTRY crMakeCurrent( GLint window, GLint context ) { WindowInfo *winInfo = (WindowInfo *) crHashtableSearch(stub.windowTable, (unsigned int) window); ContextInfo *contextInfo = (ContextInfo *) crHashtableSearch(stub.contextTable, context); if (contextInfo && contextInfo->type == NATIVE) { crWarning("Can't call crMakeCurrent with native GL context"); return; } stubMakeCurrent(winInfo, contextInfo); }
//we're not going to change icdTable at runtime, so callback is unused PICDTABLE APIENTRY DrvSetContext(HDC hdc, HGLRC hglrc, void *callback) { ContextInfo *context; WindowInfo *window; BOOL ret; CR_DDI_PROLOGUE(); /*crDebug( "DrvSetContext called(0x%x, 0x%x)", hdc, hglrc );*/ (void) (callback); crHashtableLock(stub.windowTable); crHashtableLock(stub.contextTable); context = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc); window = stubGetWindowInfo(hdc); ret = stubMakeCurrent(window, context); crHashtableUnlock(stub.contextTable); crHashtableUnlock(stub.windowTable); return ret ? &icdTable:NULL; }
void APIENTRY DrvReleaseContext(HGLRC hglrc) { CR_DDI_PROLOGUE(); /*crDebug( "DrvReleaseContext(0x%x) called", hglrc );*/ stubMakeCurrent( NULL, NULL ); }