[PATCH 5/5] wined3d: Optimize scanning changed render states in wined3d_device_apply_stateblock().
Matteo Bruni
mbruni at codeweavers.com
Mon Feb 10 13:35:53 CST 2020
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
---
dlls/wined3d/device.c | 13 ++++++++-----
1 file changed, 8 insertions(+), 5 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c
index d8992424797..64b783395e4 100644
--- a/dlls/wined3d/device.c
+++ b/dlls/wined3d/device.c
@@ -3933,18 +3933,21 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
}
}
- for (i = 0; i < ARRAY_SIZE(state->rs); ++i)
+ for (i = 0; i < ARRAY_SIZE(stateblock->changed.renderState); ++i)
{
- if (stateblock->changed.renderState[i >> 5] & (1u << (i & 0x1f)))
+ map = stateblock->changed.renderState[i];
+ while (map)
{
- if (i == WINED3D_RS_BLENDFACTOR)
+ j = wined3d_bit_scan(&map);
+ idx = i * word_bit_count + j;
+ if (idx == WINED3D_RS_BLENDFACTOR)
{
struct wined3d_color color;
- wined3d_color_from_d3dcolor(&color, state->rs[i]);
+ wined3d_color_from_d3dcolor(&color, state->rs[idx]);
wined3d_device_set_blend_state(device, NULL, &color);
}
else
- wined3d_device_set_render_state(device, i, state->rs[i]);
+ wined3d_device_set_render_state(device, idx, state->rs[idx]);
}
}
--
2.24.1
More information about the wine-devel
mailing list