From 44d419ad8e203926710c8b2bf291e69586ce2bd3 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stefan=20D=C3=B6singer?= Date: Mon, 4 Aug 2008 13:34:47 -0500 Subject: [PATCH] wined3d: Call glFlush outside the GL lock. --- dlls/wined3d/device.c | 6 +++--- dlls/wined3d/surface.c | 12 +++++------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 9e97d3bcd79..dab4b38b50e 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4945,10 +4945,10 @@ static HRESULT WINAPI IWineD3DDeviceImpl_EndScene(IWineD3DDevice *iface) { ActivateContext(This, This->lastActiveRenderTarget, CTXUSAGE_RESOURCELOAD); /* We only have to do this if we need to read the, swapbuffers performs a flush for us */ - ENTER_GL(); glFlush(); - checkGLcall("glFlush"); - LEAVE_GL(); + /* No checkGLcall here to avoid locking the lock just for checking a call that hardly ever + * fails + */ This->inScene = FALSE; return WINED3D_OK; diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c index cb4d879cd57..10c8ab1a0fc 100644 --- a/dlls/wined3d/surface.c +++ b/dlls/wined3d/surface.c @@ -3438,10 +3438,6 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, RECT * checkGLcall("glDisable(GL_ALPHA_TEST)"); } - /* Flush in case the drawable is used by multiple GL contexts */ - if(dstSwapchain && (This == (IWineD3DSurfaceImpl *) dstSwapchain->frontBuffer || dstSwapchain->num_contexts >= 2)) - glFlush(); - glBindTexture(Src->glDescription.target, 0); checkGLcall("glBindTexture(Src->glDescription.target, 0)"); /* Leave the opengl state valid for blitting */ @@ -3465,6 +3461,10 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, RECT * LEAVE_GL(); + /* Flush in case the drawable is used by multiple GL contexts */ + if(dstSwapchain && (This == (IWineD3DSurfaceImpl *) dstSwapchain->frontBuffer || dstSwapchain->num_contexts >= 2)) + glFlush(); + /* TODO: If the surface is locked often, perform the Blt in software on the memory instead */ /* The surface is now in the drawable. On onscreen surfaces or without fbos the texture * is outdated now @@ -3729,9 +3729,7 @@ HRESULT WINAPI IWineD3DSurfaceImpl_RealizePalette(IWineD3DSurface *iface) { /* Without this some palette updates are missed. This at least happens on Nvidia drivers but * it works fine using Mesa. */ - ENTER_GL(); glFlush(); - LEAVE_GL(); } else { if(!(This->Flags & SFLAG_INSYSMEM)) { TRACE("Palette changed with surface that does not have an up to date system memory copy\n"); @@ -4183,6 +4181,7 @@ static inline void surface_blt_to_drawable(IWineD3DSurfaceImpl *This, const RECT glDisable(GL_TEXTURE_2D); checkGLcall("glDisable(GL_TEXTURE_2D)"); } + LEAVE_GL(); hr = IWineD3DSurface_GetContainer((IWineD3DSurface*)This, &IID_IWineD3DSwapChain, (void **) &swapchain); if(hr == WINED3D_OK && swapchain) { @@ -4204,7 +4203,6 @@ static inline void surface_blt_to_drawable(IWineD3DSurfaceImpl *This, const RECT IWineD3DBaseTexture_Release(texture); } } - LEAVE_GL(); } /***************************************************************************** -- 2.11.4.GIT