Henri Verbeet : wined3d: Just mark the color write mask dirty in IWineD3DDeviceImpl_ClearSurface().

Alexandre Julliard julliard at winehq.org
Thu Mar 25 11:44:43 CDT 2010


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Thu Mar 25 09:32:38 2010 +0100

wined3d: Just mark the color write mask dirty in IWineD3DDeviceImpl_ClearSurface().

---

 dlls/wined3d/device.c |   26 +++++++-------------------
 1 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 3acbc30..a6ba6a3 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4417,16 +4417,12 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfac
         glMask = glMask | GL_DEPTH_BUFFER_BIT;
     }
 
-    if (Flags & WINED3DCLEAR_TARGET) {
-        TRACE("Clearing screen with glClear to color %x\n", Color);
-        glClearColor(D3DCOLOR_R(Color),
-                     D3DCOLOR_G(Color),
-                     D3DCOLOR_B(Color),
-                     D3DCOLOR_A(Color));
-        checkGLcall("glClearColor");
-
-        /* Clear ALL colors! */
+    if (Flags & WINED3DCLEAR_TARGET)
+    {
         glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
+        IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_COLORWRITEENABLE));
+        glClearColor(D3DCOLOR_R(Color), D3DCOLOR_G(Color), D3DCOLOR_B(Color), D3DCOLOR_A(Color));
+        checkGLcall("glClearColor");
         glMask = glMask | GL_COLOR_BUFFER_BIT;
     }
 
@@ -4486,16 +4482,8 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfac
         }
     }
 
-    if (Flags & WINED3DCLEAR_TARGET) {
-        DWORD mask = This->stateBlock->renderState[WINED3DRS_COLORWRITEENABLE];
-        glColorMask(mask & WINED3DCOLORWRITEENABLE_RED ? GL_TRUE : GL_FALSE,
-                    mask & WINED3DCOLORWRITEENABLE_GREEN ? GL_TRUE : GL_FALSE,
-                    mask & WINED3DCOLORWRITEENABLE_BLUE  ? GL_TRUE : GL_FALSE,
-                    mask & WINED3DCOLORWRITEENABLE_ALPHA ? GL_TRUE : GL_FALSE);
-
-        /* Dirtify the target surface for now. If the surface is locked regularly, and an up to date sysmem copy exists,
-         * it is most likely more efficient to perform a clear on the sysmem copy too instead of downloading it
-         */
+    if (Flags & WINED3DCLEAR_TARGET)
+    {
         IWineD3DSurface_ModifyLocation((IWineD3DSurface *)target, SFLAG_INDRAWABLE, TRUE);
     }
     if (Flags & WINED3DCLEAR_ZBUFFER) {




More information about the wine-cvs mailing list