[PATCH 3/6] wined3d: Use the same order of operations for depth clears as for stencil clears.

Henri Verbeet hverbeet at codeweavers.com
Thu Mar 25 03:32:37 CDT 2010


---
 dlls/wined3d/device.c |   11 ++++++-----
 1 files changed, 6 insertions(+), 5 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index fab9e65..3acbc30 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -4404,16 +4404,17 @@ HRESULT IWineD3DDeviceImpl_ClearSurface(IWineD3DDeviceImpl *This, IWineD3DSurfac
         glMask = glMask | GL_STENCIL_BUFFER_BIT;
     }
 
-    if (Flags & WINED3DCLEAR_ZBUFFER) {
+    if (Flags & WINED3DCLEAR_ZBUFFER)
+    {
         DWORD location = context->render_offscreen ? SFLAG_DS_OFFSCREEN : SFLAG_DS_ONSCREEN;
+        if (!(depth_stencil->Flags & location) && !is_full_clear(depth_stencil, vp, scissor_rect, clear_rect))
+            surface_load_ds_location(This->stencilBufferTarget, context, location);
+
         glDepthMask(GL_TRUE);
+        IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_ZWRITEENABLE));
         glClearDepth(Z);
         checkGLcall("glClearDepth");
         glMask = glMask | GL_DEPTH_BUFFER_BIT;
-        IWineD3DDeviceImpl_MarkStateDirty(This, STATE_RENDER(WINED3DRS_ZWRITEENABLE));
-
-        if (!(depth_stencil->Flags & location) && !is_full_clear(depth_stencil, vp, scissor_rect, clear_rect))
-            surface_load_ds_location(This->stencilBufferTarget, context, location);
     }
 
     if (Flags & WINED3DCLEAR_TARGET) {
-- 
1.6.4.4




More information about the wine-patches mailing list