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; }
DECLEXPORT(GLint) WINAPI VBoxGetWindowId( HDC hdc ) { WindowInfo *window; GLint winid = 0; CR_DDI_PROLOGUE(); crHashtableLock(stub.windowTable); window = stubGetWindowInfo(hdc); if (!window) { crWarning("stubGetWindowInfo: window not found!"); goto end; } if (!window->spuWindow) { crWarning("stubGetWindowInfo: window is null!"); goto end; } winid = window->spuWindow; end: crHashtableUnlock(stub.windowTable); return winid; }
BOOL WINAPI wglSwapBuffers_prox( HDC hdc ) { const WindowInfo *window = stubGetWindowInfo(hdc); stubSwapBuffers( window, 0 ); return 1; }
//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 wglSwapBuffers_prox( HDC hdc ) { WindowInfo *window = stubGetWindowInfo(hdc); CR_DDI_PROLOGUE(); stubSwapBuffers( window, 0 ); return 1; }
BOOL APIENTRY DrvSwapBuffers(HDC hdc) { WindowInfo *window; CR_DDI_PROLOGUE(); /*crDebug( "DrvSwapBuffers(0x%x) called", hdc );*/ window = stubGetWindowInfo(hdc); stubSwapBuffers( window, 0 ); return 1; }
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 ); }
DECLEXPORT(GLint) WINAPI VBoxGetWindowId( HDC hdc ) { WindowInfo *window = stubGetWindowInfo(hdc); if (!window) { CRASSERT(0); crWarning("stubGetWindowInfo: window not found!"); return 0; } if (!window->spuWindow) { CRASSERT(0); crWarning("stubGetWindowInfo: window is null!"); return 0; } return window->spuWindow; }
//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; }