Sebastian Lackner : wined3d: Avoid unnecessary memory allocations in nested command stream calls.

Alexandre Julliard julliard at winehq.org
Fri Feb 17 14:37:12 CST 2017


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

Author: Sebastian Lackner <sebastian at fds-team.de>
Date:   Fri Feb 17 16:54:45 2017 +0100

wined3d: Avoid unnecessary memory allocations in nested command stream calls.

Signed-off-by: Sebastian Lackner <sebastian at fds-team.de>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/cs.c | 13 ++++++-------
 1 file changed, 6 insertions(+), 7 deletions(-)

diff --git a/dlls/wined3d/cs.c b/dlls/wined3d/cs.c
index 10905c0..bbae5ad 100644
--- a/dlls/wined3d/cs.c
+++ b/dlls/wined3d/cs.c
@@ -1608,15 +1608,14 @@ static void wined3d_cs_st_submit(struct wined3d_cs *cs)
     data = cs->data;
     start = cs->start;
     cs->start = cs->end;
+
     opcode = *(const enum wined3d_cs_op *)&data[start];
     wined3d_cs_op_handlers[opcode](cs, &data[start]);
-    if (!start)
-    {
-        if (cs->data != data)
-            HeapFree(GetProcessHeap(), 0, data);
-        else
-            cs->start = cs->end = 0;
-    }
+
+    if (cs->data == data)
+        cs->start = cs->end = start;
+    else if (!start)
+        HeapFree(GetProcessHeap(), 0, data);
 }
 
 static void wined3d_cs_st_push_constants(struct wined3d_cs *cs, enum wined3d_push_constants p,




More information about the wine-cvs mailing list