Module: wine
Branch: master
Commit: e1c60caa42a028f5a13c1dacbb2003ab0bb7fd13
URL: http://source.winehq.org/git/wine.git/?a=commit;h=e1c60caa42a028f5a13c1dacb…
Author: Alexander Dorofeyev <alexd4(a)inbox.lv>
Date: Mon May 12 01:44:08 2008 +0300
wined3d: glFlush when updating front buffer.
Fixes screen not updating or getting updated inconsistently when apps blit to
front buffer or lock it when RenderTargetLockMode=readtex, as happens in e.g.
Red Alert 2 and also in p8_primary_test in ddraw tests.
---
dlls/wined3d/surface.c | 5 +++--
1 files changed, 3 insertions(+), 2 deletions(-)
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index 40626d6..d40ad06 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -3397,7 +3397,7 @@ static HRESULT IWineD3DSurfaceImpl_BltOverride(IWineD3DSurfaceImpl *This, RECT *
}
/* Flush in case the drawable is used by multiple GL contexts */
- if(dstSwapchain && (dstSwapchain->num_contexts >= 2))
+ if(dstSwapchain && (This == (IWineD3DSurfaceImpl *) dstSwapchain->frontBuffer || dstSwapchain->num_contexts >= 2))
glFlush();
glBindTexture(Src->glDescription.target, 0);
@@ -4020,7 +4020,8 @@ static inline void surface_blt_to_drawable(IWineD3DSurfaceImpl *This, const RECT
hr = IWineD3DSurface_GetContainer((IWineD3DSurface*)This, &IID_IWineD3DSwapChain, (void **) &swapchain);
if(hr == WINED3D_OK && swapchain) {
/* Make sure to flush the buffers. This is needed in apps like Red Alert II and Tiberian SUN that use multiple WGL contexts. */
- if(((IWineD3DSwapChainImpl*)swapchain)->num_contexts >= 2)
+ if(((IWineD3DSwapChainImpl*)swapchain)->frontBuffer == (IWineD3DSurface*)This ||
+ ((IWineD3DSwapChainImpl*)swapchain)->num_contexts >= 2)
glFlush();
IWineD3DSwapChain_Release(swapchain);