BOOL WINAPI wglDescribeLayerPlane_prox( HDC hdc, int pixelFormat, int layerPlane, UINT nBytes, LPLAYERPLANEDESCRIPTOR lpd ) { CR_DDI_PROLOGUE(); crWarning( "wglDescribeLayerPlane: unimplemented" ); return 0; }
//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; }
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; }
DECLEXPORT(GLint) WINAPI VBoxGetContextId( HGLRC hglrc ) { ContextInfo *context; GLint ctxid = 0; CR_DDI_PROLOGUE(); // crHashtableLock(stub.windowTable); crHashtableLock(stub.contextTable); context = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc); if (!context) { crWarning("crHashtableSearch: context not found!"); goto end; } if (context->type != CHROMIUM) { crWarning("unexpected context type %d", context->type); goto end; } if (context->spuContext <= 0) { crWarning("no spuSontext defined"); goto end; } ctxid = context->spuContext; end: crHashtableUnlock(stub.contextTable); return ctxid; }
DECLEXPORT(HGLRC) WINAPI VBoxCreateContext( HDC hdc, struct VBOXUHGSMI *pHgsmi ) { char dpyName[MAX_DPY_NAME]; ContextInfo *context; CR_DDI_PROLOGUE(); stubInit(); CRASSERT(stub.contextTable); sprintf(dpyName, "%d", hdc); #ifndef VBOX_CROGL_USE_VBITS_SUPERSET if (stub.haveNativeOpenGL) desiredVisual |= ComputeVisBits( hdc ); #endif context = stubNewContext(dpyName, desiredVisual, UNDECIDED, 0 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) , pHgsmi #else , NULL #endif ); if (!context) return 0; return (HGLRC) context->id; }
HGLRC APIENTRY DrvCreateContext(HDC hdc) { char dpyName[MAX_DPY_NAME]; ContextInfo *context; CR_DDI_PROLOGUE(); crDebug( "DrvCreateContext(0x%x) called.", hdc); stubInit(); CRASSERT(stub.contextTable); sprintf(dpyName, "%d", hdc); #ifndef VBOX_CROGL_USE_VBITS_SUPERSET if (stub.haveNativeOpenGL) desiredVisual |= ComputeVisBits( hdc ); #endif context = stubNewContext(dpyName, desiredVisual, UNDECIDED, 0 #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) , NULL #endif ); if (!context) return 0; return (HGLRC) context->id; }
int WINAPI wglGetLayerPaletteEntries_prox( HDC hdc, int layerPlane, int start, int entries, COLORREF *cr ) { CR_DDI_PROLOGUE(); crWarning( "wglGetLayerPaletteEntries: unsupported" ); return 0; }
HGLRC WINAPI wglCreateLayerContext_prox( HDC hdc, int layerPlane ) { CR_DDI_PROLOGUE(); stubInit(); crWarning( "wglCreateLayerContext: unsupported" ); return 0; }
BOOL APIENTRY DrvDeleteContext(HGLRC hglrc) { #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) ContextInfo *pContext; PVBOXUHGSMI pHgsmi = NULL; #endif CR_DDI_PROLOGUE(); crDebug( "DrvDeleteContext(0x%x) called", hglrc ); #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) crHashtableLock(stub.contextTable); pContext = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc); if (pContext) pHgsmi = pContext->pHgsmi; crHashtableUnlock(stub.contextTable); #endif stubDestroyContext( (unsigned long) hglrc ); #if defined(VBOX_WITH_CRHGSMI) && defined(IN_GUEST) if (pHgsmi) VBoxCrHgsmiDestroy(pHgsmi); #endif return true; }
BOOL APIENTRY DrvDeleteContext(HGLRC hglrc) { CR_DDI_PROLOGUE(); /*crDebug( "DrvDeleteContext(0x%x) called", hglrc );*/ stubDestroyContext( (unsigned long) hglrc ); return 1; }
const GLubyte * WINAPI wglGetExtensionsStringARB_prox(HDC hdc) { CR_DDI_PROLOGUE(); (void) hdc; return gsz_wgl_extensions; }
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; }
BOOL WINAPI wglUseFontOutlinesW_prox( HDC hdc, DWORD first, DWORD count, DWORD listBase, FLOAT deviation, FLOAT extrusion, int format, LPGLYPHMETRICSFLOAT gmf ) { CR_DDI_PROLOGUE(); crWarning( "wglUseFontOutlinesW: unsupported" ); return 0; }
BOOL WINAPI wglSwapBuffers_prox( HDC hdc ) { WindowInfo *window = stubGetWindowInfo(hdc); CR_DDI_PROLOGUE(); stubSwapBuffers( window, 0 ); return 1; }
int APIENTRY DrvSetLayerPaletteEntries(HDC hdc, int iLayerPlane, int iStart, int cEntries, CONST COLORREF *pcr) { CR_DDI_PROLOGUE(); crWarning( "DrvSetLayerPaletteEntries: unsupported" ); return 0; }
HDC WINAPI wglGetCurrentDC_prox( void ) { ContextInfo *context = stubGetCurrentContext(); CR_DDI_PROLOGUE(); if (context && context->currentDrawable) return (HDC) context->currentDrawable->drawable; else return (HDC) NULL; }
BOOL APIENTRY DrvDescribeLayerPlane(HDC hdc,int iPixelFormat, int iLayerPlane, UINT nBytes, LPLAYERPLANEDESCRIPTOR plpd) { CR_DDI_PROLOGUE(); crWarning( "DrvDescribeLayerPlane: unimplemented" ); CRASSERT(false); return 0; }
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 wglSetPixelFormat_prox( HDC hdc, int pixelFormat, CONST PIXELFORMATDESCRIPTOR *pdf ) { CR_DDI_PROLOGUE(); if ( pixelFormat != 1 ) { crError( "wglSetPixelFormat: pixelFormat=%d?\n", pixelFormat ); } return 1; }
BOOL APIENTRY DrvValidateVersion(DWORD version) { CR_DDI_PROLOGUE(); if (stubInit()) { crDebug("DrvValidateVersion %x -> TRUE\n", version); return TRUE; } crDebug("DrvValidateVersion %x -> FALSE, going to use system default opengl32.dll\n", version); return FALSE; }
BOOL APIENTRY DrvSetPixelFormat(HDC hdc, int iPixelFormat) { CR_DDI_PROLOGUE(); crDebug( "DrvSetPixelFormat(0x%x, %i) called.", hdc, iPixelFormat ); if ( (iPixelFormat<1) || (iPixelFormat>2) ) { crError( "wglSetPixelFormat: iPixelFormat=%d?", iPixelFormat ); } return 1; }
int WINAPI wglDescribePixelFormat_prox( HDC hdc, int pixelFormat, UINT nBytes, LPPIXELFORMATDESCRIPTOR pfd ) { CR_DDI_PROLOGUE(); /* if ( pixelFormat != 1 ) { * crError( "wglDescribePixelFormat: pixelFormat=%d?\n", pixelFormat ); * return 0; * } */ if ( !pfd ) { crWarning( "wglDescribePixelFormat: pfd=NULL\n" ); return 1; /* There's only one, baby */ } if ( nBytes != sizeof(*pfd) ) { crWarning( "wglDescribePixelFormat: nBytes=%u?\n", nBytes ); return 1; /* There's only one, baby */ } pfd->nSize = sizeof(*pfd); pfd->nVersion = 1; pfd->dwFlags = ( PFD_DRAW_TO_WINDOW | PFD_SUPPORT_GDI | PFD_SUPPORT_OPENGL | PFD_DOUBLEBUFFER ); pfd->iPixelType = PFD_TYPE_RGBA; pfd->cColorBits = 32; pfd->cRedBits = 8; pfd->cRedShift = 24; pfd->cGreenBits = 8; pfd->cGreenShift = 16; pfd->cBlueBits = 8; pfd->cBlueShift = 8; pfd->cAlphaBits = 8; pfd->cAlphaShift = 0; pfd->cAccumBits = 0; pfd->cAccumRedBits = 0; pfd->cAccumGreenBits = 0; pfd->cAccumBlueBits = 0; pfd->cAccumAlphaBits = 0; pfd->cDepthBits = 32; pfd->cStencilBits = 8; pfd->cAuxBuffers = 0; pfd->iLayerType = PFD_MAIN_PLANE; pfd->bReserved = 0; pfd->dwLayerMask = 0; pfd->dwVisibleMask = 0; pfd->dwDamageMask = 0; /* the max PFD index */ return 1; }
HGLRC APIENTRY DrvCreateLayerContext(HDC hdc, int iLayerPlane) { CR_DDI_PROLOGUE(); crDebug( "DrvCreateLayerContext(0x%x, %i) called.", hdc, iLayerPlane); //We don't support more than 1 layers. if (iLayerPlane == 0) { return DrvCreateContext(hdc); } else { crError( "DrvCreateLayerContext (%x,%x): unsupported", hdc, iLayerPlane); return NULL; } }
BOOL WINAPI wglSwapLayerBuffers_prox( HDC hdc, UINT planes ) { CR_DDI_PROLOGUE(); if (planes == WGL_SWAP_MAIN_PLANE) { return wglSwapBuffers_prox(hdc); } else { crWarning( "wglSwapLayerBuffers: unsupported" ); return 0; } }
BOOL APIENTRY DrvSwapLayerBuffers(HDC hdc, UINT fuPlanes) { CR_DDI_PROLOGUE(); if (fuPlanes == 1) { return DrvSwapBuffers(hdc); } else { crWarning( "DrvSwapLayerBuffers: unsupported" ); CRASSERT(false); return 0; } }
DECLEXPORT(void) WINAPI VBoxFlushToHost ( HGLRC hglrc ) { ContextInfo *context; CR_DDI_PROLOGUE(); // crHashtableLock(stub.windowTable); crHashtableLock(stub.contextTable); context = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc); if (context) stubConFlush(CR_CTX_CON(context)); crHashtableUnlock(stub.contextTable); // crHashtableUnlock(stub.windowTable); }
HGLRC WINAPI wglCreateContext_prox( HDC hdc ) { char dpyName[MAX_DPY_NAME]; ContextInfo *context; CR_DDI_PROLOGUE(); stubInit(); CRASSERT(stub.contextTable); sprintf(dpyName, "%d", hdc); if (stub.haveNativeOpenGL) desiredVisual |= ComputeVisBits( hdc ); context = stubNewContext(dpyName, desiredVisual, UNDECIDED, 0); if (!context) return 0; return (HGLRC) context->id; }
DECLEXPORT(void) WINAPI VBoxCtxChromiumParameteriCR(HGLRC hglrc, GLenum param, GLint value) { ContextInfo *context; CR_DDI_PROLOGUE(); // crHashtableLock(stub.windowTable); crHashtableLock(stub.contextTable); context = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc); if (context) { stubCtxCheckCreate(context); stubConChromiumParameteriCR(CR_CTX_CON(context), param, value); } else crWarning("invalid context %#x", hglrc); crHashtableUnlock(stub.contextTable); // crHashtableUnlock(stub.windowTable); }
DECLEXPORT(BOOL) WINAPI wglShareLists_prox( HGLRC hglrc1, HGLRC hglrc2 ) { ContextInfo *context1, *context2; GLint aSpuContexts[2]; CR_DDI_PROLOGUE(); // crHashtableLock(stub.windowTable); crHashtableLock(stub.contextTable); context1 = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc1); if (!context1) { WARN(("invalid hglrc1")); return FALSE; } stubCtxCheckCreate(context1); context2 = (ContextInfo *) crHashtableSearch(stub.contextTable, (unsigned long) hglrc2); if (!context2) { WARN(("invalid hglrc2")); return FALSE; } stubCtxCheckCreate(context2); aSpuContexts[0] = context1->spuContext; aSpuContexts[1] = context2->spuContext; stubConChromiumParametervCR(CR_CTX_CON(context2), GL_SHARE_LISTS_CR, GL_INT, 2, aSpuContexts); crHashtableUnlock(stub.contextTable); return TRUE; }
//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; }