[PATCH 6/6] wined3d: Avoid storing color and rectangle pointers in struct wined3d_cs_clear.

Henri Verbeet hverbeet at codeweavers.com
Thu Mar 24 12:24:31 CDT 2016


From: Stefan Dösinger <stefan at codeweavers.com>

Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
---
 dlls/wined3d/cs.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 0e6cc5b..91e1759 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -67,12 +67,12 @@ struct wined3d_cs_present
 struct wined3d_cs_clear
 {
     enum wined3d_cs_op opcode;
-    DWORD rect_count;
-    const RECT *rects;
     DWORD flags;
-    const struct wined3d_color *color;
+    struct wined3d_color color;
     float depth;
     DWORD stencil;
+    unsigned int rect_count;
+    RECT rects[1];
 };
 
 struct wined3d_cs_draw
@@ -287,7 +287,7 @@ static void wined3d_cs_exec_clear(struct wined3d_cs *cs, const void *data)
     wined3d_get_draw_rect(&device->state, &draw_rect);
     device_clear_render_targets(device, device->adapter->gl_info.limits.buffers,
             &device->fb, op->rect_count, op->rects, &draw_rect, op->flags,
-            op->color, op->depth, op->stencil);
+            &op->color, op->depth, op->stencil);
 }
 
 void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *rects,
@@ -295,14 +295,14 @@ void wined3d_cs_emit_clear(struct wined3d_cs *cs, DWORD rect_count, const RECT *
 {
     struct wined3d_cs_clear *op;
 
-    op = cs->ops->require_space(cs, sizeof(*op));
+    op = cs->ops->require_space(cs, FIELD_OFFSET(struct wined3d_cs_clear, rects[rect_count]));
     op->opcode = WINED3D_CS_OP_CLEAR;
-    op->rect_count = rect_count;
-    op->rects = rects;
     op->flags = flags;
-    op->color = color;
+    op->color = *color;
     op->depth = depth;
     op->stencil = stencil;
+    op->rect_count = rect_count;
+    memcpy(op->rects, rects, sizeof(*rects) * rect_count);
 
     cs->ops->submit(cs);
 }
-- 
2.1.4




More information about the wine-patches mailing list