Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/wined3d/device.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 87684dc1c46..d8992424797 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3889,7 +3889,8 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, { const struct wined3d_d3d_info *d3d_info = &stateblock->device->adapter->d3d_info; const struct wined3d_stateblock_state *state = &stateblock->stateblock_state; - unsigned int i, j; + const unsigned int word_bit_count = sizeof(DWORD) * CHAR_BIT; + unsigned int i, j, idx; DWORD map;
TRACE("device %p, stateblock %p.\n", device, stateblock); @@ -3968,10 +3969,15 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, } }
- for (i = 0; i < ARRAY_SIZE(state->transforms); ++i) + for (i = 0; i < ARRAY_SIZE(stateblock->changed.transform); ++i) { - if (stateblock->changed.transform[i >> 5] & (1u << (i & 0x1f))) - wined3d_device_set_transform(device, i, &state->transforms[i]); + map = stateblock->changed.transform[i]; + while (map) + { + j = wined3d_bit_scan(&map); + idx = i * word_bit_count + j; + wined3d_device_set_transform(device, idx, &state->transforms[idx]); + } }
if (stateblock->changed.indices)