[PATCH 1/5] wined3d: Optimize scanning changed texture states in wined3d_device_apply_stateblock().

Matteo Bruni mbruni at codeweavers.com
Fri Feb 28 04:24:59 CST 2020


Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
 dlls/wined3d/device.c | 9 +++++----
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index e706c830d31..9478c459e0a 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3951,12 +3951,13 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
         }
     }
 
-    for (i = 0; i < ARRAY_SIZE(state->texture_states); ++i)
+    for (i = 0; i < ARRAY_SIZE(changed->textureState); ++i)
     {
-        for (j = 0; j < ARRAY_SIZE(state->texture_states[i]); ++j)
+        map = changed->textureState[i];
+        while (map)
         {
-            if (changed->textureState[i] & (1u << j))
-                wined3d_device_set_texture_stage_state(device, i, j, state->texture_states[i][j]);
+            j = wined3d_bit_scan(&map);
+            wined3d_device_set_texture_stage_state(device, i, j, state->texture_states[i][j]);
         }
     }
 
-- 
2.24.1




More information about the wine-devel mailing list