Stefan Dösinger : wined3d: Disable the SWAPEFFECT_DISCARD clear.

Alexandre Julliard julliard at winehq.org
Tue Dec 18 07:34:50 CST 2007


Module: wine
Branch: master
Commit: cd858dfa220b05d0233010ea08772a12b4ff591e
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=cd858dfa220b05d0233010ea08772a12b4ff591e

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Thu Dec 13 22:13:39 2007 +0100

wined3d: Disable the SWAPEFFECT_DISCARD clear.

---

 dlls/wined3d/swapchain.c |   20 ++++++++++++++++++--
 1 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/dlls/wined3d/swapchain.c b/dlls/wined3d/swapchain.c
index 28fd54b..187c0c4 100644
--- a/dlls/wined3d/swapchain.c
+++ b/dlls/wined3d/swapchain.c
@@ -274,8 +274,24 @@ static HRESULT WINAPI IWineD3DSwapChainImpl_Present(IWineD3DSwapChain *iface, CO
 }
 #endif
 
-    if (This->presentParms.SwapEffect == WINED3DSWAPEFFECT_DISCARD) {
-        TRACE("Clearing the color buffer with pink color\n");
+    /* This is disabled, but the code left in for debug purposes.
+     *
+     * Since we're allowed to modify the new back buffer on a D3DSWAPEFFECT_DISCARD flip,
+     * we can clear it with some ugly color to make bad drawing visible and ease debugging.
+     * The Debug runtime does the same on Windows. However, a few games do not redraw the
+     * screen properly, like Max Payne 2, which leaves a few pixels undefined.
+     *
+     * Tests show that the content of the back buffer after a discard flip is indeed not
+     * reliable, so no game can depend on the exact content. However, it resembles the
+     * old contents in some way, for example by showing fragments at other locations. In
+     * general, the color theme is still intact. So Max payne, which draws rather dark scenes
+     * gets a dark background image. If we clear it with a bright ugly color, the game's
+     * bug shows up much more than it does on Windows, and the players see single pixels
+     * with wrong colors.
+     * (The Max Payne bug has been confirmed on Windows with the debug runtime)
+     */
+    if (FALSE && This->presentParms.SwapEffect == WINED3DSWAPEFFECT_DISCARD) {
+        TRACE("Clearing the color buffer with cyan color\n");
 
         IWineD3DDevice_Clear((IWineD3DDevice*)This->wineD3DDevice, 0, NULL,
                               WINED3DCLEAR_TARGET, 0xff00ffff, 1.0, 0);




More information about the wine-cvs mailing list