Henri Verbeet : wined3d: Apply clear state after depth / stencil setup in device_clear_render_targets().

Alexandre Julliard julliard at winehq.org
Mon Aug 1 13:22:08 CDT 2011


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

Author: Henri Verbeet <hverbeet at codeweavers.com>
Date:   Sun Jul 31 17:33:41 2011 +0200

wined3d: Apply clear state after depth / stencil setup in device_clear_render_targets().

---

 dlls/wined3d/device.c |   32 ++++++++++++++++----------------
 1 files changed, 16 insertions(+), 16 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index 84c7789..7d88b57 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -680,13 +680,6 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count
         return WINED3D_OK;
     }
 
-    if (!context_apply_clear_state(context, device, rt_count, fb))
-    {
-        context_release(context);
-        WARN("Failed to apply clear state, skipping clear.\n");
-        return WINED3D_OK;
-    }
-
     if (target)
     {
         render_offscreen = context->render_offscreen;
@@ -699,6 +692,22 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count
         drawable_height = fb->depth_stencil->pow2Height;
     }
 
+    if (flags & WINED3DCLEAR_ZBUFFER)
+    {
+        DWORD location = render_offscreen ? SFLAG_DS_OFFSCREEN : SFLAG_DS_ONSCREEN;
+
+        if (location == SFLAG_DS_ONSCREEN && fb->depth_stencil != device->onscreen_depth_stencil)
+            device_switch_onscreen_ds(device, context, fb->depth_stencil);
+        prepare_ds_clear(fb->depth_stencil, context, location, draw_rect, rect_count, clear_rect);
+    }
+
+    if (!context_apply_clear_state(context, device, rt_count, fb))
+    {
+        context_release(context);
+        WARN("Failed to apply clear state, skipping clear.\n");
+        return WINED3D_OK;
+    }
+
     ENTER_GL();
 
     /* Only set the values up once, as they are not changing. */
@@ -718,15 +727,6 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count
 
     if (flags & WINED3DCLEAR_ZBUFFER)
     {
-        DWORD location = render_offscreen ? SFLAG_DS_OFFSCREEN : SFLAG_DS_ONSCREEN;
-
-        if (location == SFLAG_DS_ONSCREEN && fb->depth_stencil != device->onscreen_depth_stencil)
-        {
-            LEAVE_GL();
-            device_switch_onscreen_ds(device, context, fb->depth_stencil);
-            ENTER_GL();
-        }
-        prepare_ds_clear(fb->depth_stencil, context, location, draw_rect, rect_count, clear_rect);
         surface_modify_location(fb->depth_stencil, SFLAG_INDRAWABLE, TRUE);
 
         glDepthMask(GL_TRUE);




More information about the wine-cvs mailing list