Stefan Dösinger : wined3d: Pass a struct wined3d_fb_state to device_clear_render_targets.

Alexandre Julliard julliard at winehq.org
Tue Jul 5 12:59:07 CDT 2011


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

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Mon Jun 27 18:23:13 2011 +0200

wined3d: Pass a struct wined3d_fb_state to device_clear_render_targets.

---

 dlls/wined3d/device.c          |   28 ++++++++++++++--------------
 dlls/wined3d/surface.c         |    6 ++++--
 dlls/wined3d/wined3d_private.h |    6 +++---
 3 files changed, 21 insertions(+), 19 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index e9a98c4..14e6613 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -649,12 +649,12 @@ static void prepare_ds_clear(struct wined3d_surface *ds, struct wined3d_context
 }
 
 /* Do not call while under the GL lock. */
-HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count, struct wined3d_surface **rts,
-        struct wined3d_surface *depth_stencil, UINT rect_count, const RECT *rects, const RECT *draw_rect,
-        DWORD flags, const WINED3DCOLORVALUE *color, float depth, DWORD stencil)
+HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count, const struct wined3d_fb_state *fb,
+        UINT rect_count, const RECT *rects, const RECT *draw_rect, DWORD flags, const WINED3DCOLORVALUE *color,
+        float depth, DWORD stencil)
 {
     const RECT *clear_rect = (rect_count > 0 && rects) ? (const RECT *)rects : NULL;
-    struct wined3d_surface *target = rt_count ? rts[0] : NULL;
+    struct wined3d_surface *target = rt_count ? fb->render_targets[0] : NULL;
     UINT drawable_width, drawable_height;
     struct wined3d_context *context;
     GLbitfield clear_mask = 0;
@@ -673,7 +673,7 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count
     {
         for (i = 0; i < rt_count; ++i)
         {
-            if (rts[i]) surface_load_location(rts[i], SFLAG_INDRAWABLE, NULL);
+            if (fb->render_targets[i]) surface_load_location(fb->render_targets[i], SFLAG_INDRAWABLE, NULL);
         }
     }
 
@@ -685,7 +685,7 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count
         return WINED3D_OK;
     }
 
-    if (!context_apply_clear_state(context, device, rt_count, rts, depth_stencil))
+    if (!context_apply_clear_state(context, device, rt_count, fb->render_targets, fb->depth_stencil))
     {
         context_release(context);
         WARN("Failed to apply clear state, skipping clear.\n");
@@ -700,8 +700,8 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count
     else
     {
         render_offscreen = TRUE;
-        drawable_width = depth_stencil->pow2Width;
-        drawable_height = depth_stencil->pow2Height;
+        drawable_width = fb->depth_stencil->pow2Width;
+        drawable_height = fb->depth_stencil->pow2Height;
     }
 
     ENTER_GL();
@@ -725,14 +725,14 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count
     {
         DWORD location = render_offscreen ? SFLAG_DS_OFFSCREEN : SFLAG_DS_ONSCREEN;
 
-        if (location == SFLAG_DS_ONSCREEN && depth_stencil != device->onscreen_depth_stencil)
+        if (location == SFLAG_DS_ONSCREEN && fb->depth_stencil != device->onscreen_depth_stencil)
         {
             LEAVE_GL();
-            device_switch_onscreen_ds(device, context, depth_stencil);
+            device_switch_onscreen_ds(device, context, fb->depth_stencil);
             ENTER_GL();
         }
-        prepare_ds_clear(depth_stencil, context, location, draw_rect, rect_count, clear_rect);
-        surface_modify_location(depth_stencil, SFLAG_INDRAWABLE, TRUE);
+        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);
         device_invalidate_state(device, STATE_RENDER(WINED3DRS_ZWRITEENABLE));
@@ -745,7 +745,7 @@ HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count
     {
         for (i = 0; i < rt_count; ++i)
         {
-            if (rts[i]) surface_modify_location(rts[i], SFLAG_INDRAWABLE, TRUE);
+            if (fb->render_targets[i]) surface_modify_location(fb->render_targets[i], SFLAG_INDRAWABLE, TRUE);
         }
 
         glColorMask(GL_TRUE, GL_TRUE, GL_TRUE, GL_TRUE);
@@ -4043,7 +4043,7 @@ HRESULT CDECL wined3d_device_clear(struct wined3d_device *device, DWORD rect_cou
     device_get_draw_rect(device, &draw_rect);
 
     return device_clear_render_targets(device, device->adapter->gl_info.limits.buffers,
-            device->fb.render_targets, device->fb.depth_stencil, rect_count, rects,
+            &device->fb, rect_count, rects,
             &draw_rect, flags, &c, depth, stencil);
 }
 
diff --git a/dlls/wined3d/surface.c b/dlls/wined3d/surface.c
index d415159..46d2b84 100644
--- a/dlls/wined3d/surface.c
+++ b/dlls/wined3d/surface.c
@@ -6392,8 +6392,9 @@ static HRESULT ffp_blit_color_fill(struct wined3d_device *device, struct wined3d
         const RECT *dst_rect, const WINED3DCOLORVALUE *color)
 {
     const RECT draw_rect = {0, 0, dst_surface->resource.width, dst_surface->resource.height};
+    struct wined3d_fb_state fb = {&dst_surface, NULL};
 
-    return device_clear_render_targets(device, 1, &dst_surface, NULL,
+    return device_clear_render_targets(device, 1, &fb,
             1, dst_rect, &draw_rect, WINED3DCLEAR_TARGET, color, 0.0f, 0);
 }
 
@@ -6402,8 +6403,9 @@ static HRESULT ffp_blit_depth_fill(struct wined3d_device *device,
         struct wined3d_surface *surface, const RECT *rect, float depth)
 {
     const RECT draw_rect = {0, 0, surface->resource.width, surface->resource.height};
+    struct wined3d_fb_state fb = {NULL, surface};
 
-    return device_clear_render_targets(device, 0, NULL, surface,
+    return device_clear_render_targets(device, 0, &fb,
             1, rect, &draw_rect, WINED3DCLEAR_ZBUFFER, 0, depth, 0);
 }
 
diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h
index 8f210d8..1b040ff 100644
--- a/dlls/wined3d/wined3d_private.h
+++ b/dlls/wined3d/wined3d_private.h
@@ -1745,9 +1745,9 @@ struct wined3d_device
     struct WineD3DRectPatch *currentPatch;
 };
 
-HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count, struct wined3d_surface **rts,
-        struct wined3d_surface *depth_stencil, UINT rect_count, const RECT *rects, const RECT *draw_rect,
-        DWORD flags, const WINED3DCOLORVALUE *color, float depth, DWORD stencil) DECLSPEC_HIDDEN;
+HRESULT device_clear_render_targets(struct wined3d_device *device, UINT rt_count, const struct wined3d_fb_state *fb,
+        UINT rect_count, const RECT *rects, const RECT *draw_rect, DWORD flags,
+        const WINED3DCOLORVALUE *color, float depth, DWORD stencil) DECLSPEC_HIDDEN;
 BOOL device_context_add(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
 void device_context_remove(struct wined3d_device *device, struct wined3d_context *context) DECLSPEC_HIDDEN;
 void device_get_draw_rect(struct wined3d_device *device, RECT *rect) DECLSPEC_HIDDEN;




More information about the wine-cvs mailing list