Stefan Dösinger : wined3d: Call glFlush outside the GL lock.
Alexandre Julliard
julliard at winehq.org
Tue Aug 5 07:26:31 CDT 2008
Module: wine
Branch: master
Commit: 44d419ad8e203926710c8b2bf291e69586ce2bd3
URL: http://source.winehq.org/git/wine.git/?a=commit;h=44d419ad8e203926710c8b2bf291e69586ce2bd3
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Mon Aug 4 13:34:47 2008 -0500
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 9e97d3b..dab4b38 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 cb4d879..10c8ab1 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();
}
/*****************************************************************************
More information about the wine-cvs
mailing list