=?UTF-8?Q?J=C3=B3zef=20Kucia=20?=: wined3d: Use wined3d_bit_scan() in context_apply_compute_state().

Alexandre Julliard julliard at winehq.org
Tue Feb 6 15:55:50 CST 2018


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

Author: Józef Kucia <jkucia at codeweavers.com>
Date:   Tue Feb  6 11:40:04 2018 +0100

wined3d: Use wined3d_bit_scan() in context_apply_compute_state().

Signed-off-by: Józef Kucia <jkucia at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 dlls/wined3d/context.c | 10 ++++++----
 1 file changed, 6 insertions(+), 4 deletions(-)

diff --git a/dlls/wined3d/context.c b/dlls/wined3d/context.c
index 81a0f4f..ccfe630 100644
--- a/dlls/wined3d/context.c
+++ b/dlls/wined3d/context.c
@@ -3983,7 +3983,7 @@ void context_apply_compute_state(struct wined3d_context *context,
 {
     const struct StateEntry *state_table = context->state_table;
     const struct wined3d_gl_info *gl_info = context->gl_info;
-    unsigned int state_id, i, j;
+    unsigned int state_id, i;
 
     context_load_shader_resources(context, state, 1u << WINED3D_SHADER_TYPE_COMPUTE);
     context_load_unordered_access_resources(context, state->shader[WINED3D_SHADER_TYPE_COMPUTE],
@@ -3991,11 +3991,13 @@ void context_apply_compute_state(struct wined3d_context *context,
 
     for (i = 0, state_id = STATE_COMPUTE_OFFSET; i < ARRAY_SIZE(context->dirty_compute_states); ++i)
     {
-        for (j = 0; j < sizeof(*context->dirty_compute_states) * CHAR_BIT; ++j, ++state_id)
+        unsigned int dirty_mask = context->dirty_compute_states[i];
+        while (dirty_mask)
         {
-            if (context->dirty_compute_states[i] & (1u << j))
-                state_table[state_id].apply(context, state, state_id);
+            unsigned int current_state_id = state_id + wined3d_bit_scan(&dirty_mask);
+            state_table[current_state_id].apply(context, state, current_state_id);
         }
+        state_id += sizeof(*context->dirty_compute_states) * CHAR_BIT;
     }
     memset(context->dirty_compute_states, 0, sizeof(*context->dirty_compute_states));
 




More information about the wine-cvs mailing list