diff options
author | Jon TURNEY <jon.turney@dronecode.org.uk> | 2009-06-23 17:26:37 +0100 |
---|---|---|
committer | Jon TURNEY <jon.turney@dronecode.org.uk> | 2009-10-04 17:12:56 +0100 |
commit | f33c87518b02e8ce1548e9d6f5b2ac60ca3e697e (patch) | |
tree | e905d55181a1b4a7fd3d9a62ac7c42b5360f6605 | |
parent | 612501486546ad61bfb6e1e73bce01fdffe073bc (diff) |
Turn on GLX_EXT_import_context and GLX_OML_swap_method
Report swapMethod for fbConfigs learnt using DecribePixelFormats
Implement swapInterval
-rwxr-xr-x | hw/xwin/indirect.c | 37 | ||||
-rw-r--r-- | hw/xwin/wgl_ext_api.c | 22 | ||||
-rw-r--r-- | hw/xwin/wgl_ext_api.h | 5 |
3 files changed, 57 insertions, 7 deletions
diff --git a/hw/xwin/indirect.c b/hw/xwin/indirect.c index b812e25d9..6b03f3615 100755 --- a/hw/xwin/indirect.c +++ b/hw/xwin/indirect.c @@ -45,7 +45,11 @@ TODO: - hook up remaining unimplemented extensions - provide a method to fallback to turn WGL extensions off (via env var), for testing etc. - + - research what guarantees glXWaitX, glXWaitGL are supposed to offer, and implement then + using GdiFlush and/or glFinish + - pbuffer clobbering: we don't get async notification, but can we arrange to emit the + event when we notice it's been clobbered? at the very least, check if it's been clobbered + before using it? */ #ifdef HAVE_XWIN_CONFIG_H @@ -351,6 +355,17 @@ glxWinScreenDestroy(__GLXscreen *screen) xfree(screen); } +static int +glxWinScreenSwapInterval(__GLXdrawable *drawable, int interval) +{ + BOOL ret = wglSwapIntervalEXTWrapper(interval); + if (!ret) + { + ErrorF("wglSwapIntervalEXT interval %d failed:%s\n", interval, glxWinErrorMessage()); + } + return ret; +} + /* This is called by GlxExtensionInit() asking the GLX provider if it can handle the screen... */ static __GLXscreen * glxWinScreenProbe(ScreenPtr pScreen) @@ -428,8 +443,8 @@ glxWinScreenProbe(ScreenPtr pScreen) __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_visual_info"); __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_visual_rating"); - // __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_import_context"); ??? - // __glXEnableExtension(screen->glx_enable_bits, "GLX_OML_swap_method"); ??? + __glXEnableExtension(screen->glx_enable_bits, "GLX_EXT_import_context"); + __glXEnableExtension(screen->glx_enable_bits, "GLX_OML_swap_method"); __glXEnableExtension(screen->glx_enable_bits, "GLX_SGIX_fbconfig"); if (strstr(wgl_extensions, "WGL_ARB_make_current_read")) @@ -478,7 +493,7 @@ glxWinScreenProbe(ScreenPtr pScreen) screen->base.destroy = glxWinScreenDestroy; screen->base.createContext = glxWinCreateContext; screen->base.createDrawable = glxWinCreateDrawable; - screen->base.swapInterval = NULL; + screen->base.swapInterval = glxWinScreenSwapInterval; screen->base.hyperpipeFuncs = NULL; screen->base.swapBarrierFuncs = NULL; screen->base.pScreen = pScreen; @@ -962,7 +977,10 @@ glxWinDeferredCreateContext(__GLXWinContext *gc, __GLXWinDrawable *draw) // if the native context was created successfully, shareLists if needed if (gc->ctx && gc->shareContext) { - GLWIN_DEBUG_MSG("glxWinCreateContextReal shareLists with context%p (native ctx %p)", gc->shareContext, gc->shareContext->ctx); + wglMakeCurrent(NULL, NULL); + + GLWIN_DEBUG_MSG("glxWinCreateContextReal shareLists with context %p (native ctx %p)", gc->shareContext, gc->shareContext->ctx); + if (!wglShareLists(gc->shareContext->ctx, gc->ctx)) { ErrorF("wglShareLists error: %s\n", glxWinErrorMessage()); @@ -1437,8 +1455,14 @@ glxWinCreateConfigs(HDC hdc, int *numConfigsPtr, int screenNumber) c->visualSelectGroup = 0; /* OML_swap_method */ - c->swapMethod = GLX_SWAP_UNDEFINED_OML; + if (pfd.dwFlags & PFD_SWAP_EXCHANGE) + c->swapMethod = GLX_SWAP_EXCHANGE_OML; + else if (pfd.dwFlags & PFD_SWAP_COPY) + c->swapMethod = GLX_SWAP_COPY_OML; + else + c->swapMethod = GLX_SWAP_UNDEFINED_OML; + /* EXT_import_context */ c->screen = screenNumber; /* EXT_texture_from_pixmap */ @@ -1728,6 +1752,7 @@ glxWinCreateConfigsExt(HDC hdc, int *numConfigsPtr, int screenNumber) c->swapMethod = GLX_SWAP_UNDEFINED_OML; } + /* EXT_import_context */ c->screen = screenNumber; /* EXT_texture_from_pixmap */ diff --git a/hw/xwin/wgl_ext_api.c b/hw/xwin/wgl_ext_api.c index f8ef921f5..d1937f68c 100644 --- a/hw/xwin/wgl_ext_api.c +++ b/hw/xwin/wgl_ext_api.c @@ -104,6 +104,10 @@ typedef wBOOL (__stdcall *PFNWGLQUERYPBUFFERARB)(HPBUFFERARB hPbuffer, int iAttribute, int *piValue); +typedef wBOOL (__stdcall *PFNWGLSWAPINTERVALEXT)(int interval); +typedef int (__stdcall *PFNWGLGETSWAPINTERVALEXT)(void); + + RESOLVE_DECL(PFNWGLGETEXTENSIONSSTRINGARB, "wglGetExtensionsStringARB"); RESOLVE_DECL(PFNWGLMAKECONTEXTCURRENTARB, "wglMakeContextCurrentARB"); RESOLVE_DECL(PFNWGLGETCURRENTREADDCARB, "wglGetCurrentReadDCARB"); @@ -115,7 +119,8 @@ RESOLVE_DECL(PFNWGLGETPBUFFERDCARB, "wglGetPbufferDCARB"); RESOLVE_DECL(PFNWGLRELEASEPBUFFERDCARB, "wglReleasePbufferDCARB"); RESOLVE_DECL(PFNWGLDESTROYPBUFFERARB, "wglDestroyPbufferARB"); RESOLVE_DECL(PFNWGLQUERYPBUFFERARB, "wglQueryPbufferARB"); - +RESOLVE_DECL(PFNWGLSWAPINTERVALEXT, "wglSwapIntervalEXT"); +RESOLVE_DECL(PFNWGLGETSWAPINTERVALEXT, "wglGetSwapIntervalEXT"); void wglResolveExtensionProcs(void) @@ -131,6 +136,8 @@ wglResolveExtensionProcs(void) PRERESOLVE(PFNWGLRELEASEPBUFFERDCARB, "wglReleasePbufferDCARB"); PRERESOLVE(PFNWGLDESTROYPBUFFERARB, "wglDestroyPbufferARB"); PRERESOLVE(PFNWGLQUERYPBUFFERARB, "wglQueryPbufferARB"); + PRERESOLVE(PFNWGLSWAPINTERVALEXT, "wglSwapIntervalEXT"); + PRERESOLVE(PFNWGLGETSWAPINTERVALEXT, "wglGetSwapIntervalEXT"); } // WGL_ARB_extensions_string @@ -230,4 +237,17 @@ wBOOL wglQueryPbufferARBWrapper(HPBUFFERARB hPbuffer, return RESOLVED_PROC(PFNWGLQUERYPBUFFERARB)(hPbuffer, iAttribute, piValue); } +// WGL_EXT_swap_control + +wBOOL wglSwapIntervalEXTWrapper(int interval) +{ + RESOLVE_RET(PFNWGLSWAPINTERVALEXT, "wglSwapIntervalEXT", FALSE); + return RESOLVED_PROC(PFNWGLSWAPINTERVALEXT)(interval); +} + +int wglGetSwapIntervalEXTWrapper(void) +{ + RESOLVE_RET(PFNWGLGETSWAPINTERVALEXT, "wglGetSwapIntervalEXT", FALSE); + return RESOLVED_PROC(PFNWGLGETSWAPINTERVALEXT)(); +} diff --git a/hw/xwin/wgl_ext_api.h b/hw/xwin/wgl_ext_api.h index c28dbcae4..349a76d62 100644 --- a/hw/xwin/wgl_ext_api.h +++ b/hw/xwin/wgl_ext_api.h @@ -75,6 +75,11 @@ wBOOL wglQueryPbufferARBWrapper(HPBUFFERARB hPbuffer, int iAttribute, int *piValue); +wBOOL wglSwapIntervalEXTWrapper(int interval); + +int wglGetSwapIntervalEXTWrapper(void); + + #define WGL_NUMBER_PIXEL_FORMATS_ARB 0x2000 #define WGL_DRAW_TO_WINDOW_ARB 0x2001 |