Matteo Bruni : wined3d: Optimize scanning for changed state in wined3d_stateblock_capture().

Alexandre Julliard julliard at winehq.org
Wed Mar 18 15:42:02 CDT 2020


Module: wine
Branch: master
Commit: f4788c4b089e7cfd5ebfa0795e2255d0181b5986
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=f4788c4b089e7cfd5ebfa0795e2255d0181b5986

Author: Matteo Bruni <mbruni at codeweavers.com>
Date:   Wed Mar 18 14:01:21 2020 +0100

wined3d: Optimize scanning for changed state in wined3d_stateblock_capture().

Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/stateblock.c | 16 ++++++++--------
 1 file changed, 8 insertions(+), 8 deletions(-)

diff --git a/dlls/wined3d/stateblock.c b/dlls/wined3d/stateblock.c
index db0019adbf..6d747f9731 100644
--- a/dlls/wined3d/stateblock.c
+++ b/dlls/wined3d/stateblock.c
@@ -852,9 +852,9 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock,
     }
 
     map = stateblock->changed.streamSource;
-    for (i = 0; map; map >>= 1, ++i)
+    while (map)
     {
-        if (!(map & 1)) continue;
+        i = wined3d_bit_scan(&map);
 
         if (stateblock->stateblock_state.streams[i].stride != state->streams[i].stride
                 || stateblock->stateblock_state.streams[i].offset != state->streams[i].offset
@@ -877,9 +877,9 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock,
     }
 
     map = stateblock->changed.streamFreq;
-    for (i = 0; map; map >>= 1, ++i)
+    while (map)
     {
-        if (!(map & 1)) continue;
+        i = wined3d_bit_scan(&map);
 
         if (stateblock->stateblock_state.streams[i].frequency != state->streams[i].frequency
                 || stateblock->stateblock_state.streams[i].flags != state->streams[i].flags)
@@ -893,9 +893,9 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock,
     }
 
     map = stateblock->changed.clipplane;
-    for (i = 0; map; map >>= 1, ++i)
+    while (map)
     {
-        if (!(map & 1)) continue;
+        i = wined3d_bit_scan(&map);
 
         if (memcmp(&stateblock->stateblock_state.clip_planes[i], &state->clip_planes[i], sizeof(state->clip_planes[i])))
         {
@@ -929,9 +929,9 @@ void CDECL wined3d_stateblock_capture(struct wined3d_stateblock *stateblock,
 
     /* Samplers */
     map = stateblock->changed.textures;
-    for (i = 0; map; map >>= 1, ++i)
+    while (map)
     {
-        if (!(map & 1)) continue;
+        i = wined3d_bit_scan(&map);
 
         TRACE("Updating texture %u to %p (was %p).\n",
                 i, state->textures[i], stateblock->stateblock_state.textures[i]);




More information about the wine-cvs mailing list