Signed-off-by: Matteo Bruni mbruni@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]); } }
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/wined3d/device.c | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 9478c459e0a..863b483babe 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3961,15 +3961,17 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, } }
- for (i = 0; i < ARRAY_SIZE(state->sampler_states); ++i) + for (i = 0; i < ARRAY_SIZE(changed->samplerState); ++i) { DWORD stage = i; + if (stage >= WINED3D_MAX_FRAGMENT_SAMPLERS) stage += WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS; - for (j = 0; j < ARRAY_SIZE(state->sampler_states[j]); ++j) + map = changed->samplerState[i]; + while (map) { - if (changed->samplerState[i] & (1 << j)) - wined3d_device_set_sampler_state(device, stage, j, state->sampler_states[i][j]); + j = wined3d_bit_scan(&map); + wined3d_device_set_sampler_state(device, stage, j, state->sampler_states[i][j]); } }
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/wined3d/device.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 863b483babe..add20cc63e0 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3998,14 +3998,19 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, if (changed->scissorRect) wined3d_device_set_scissor_rects(device, 1, &state->scissor_rect);
- for (i = 0; i < ARRAY_SIZE(state->streams); ++i) - { - if (changed->streamSource & (1u << i)) - wined3d_device_set_stream_source(device, i, state->streams[i].buffer, - state->streams[i].offset, state->streams[i].stride); - if (changed->streamFreq & (1u << i)) - wined3d_device_set_stream_source_freq(device, i, - state->streams[i].frequency | state->streams[i].flags); + map = changed->streamSource; + while (map) + { + i = wined3d_bit_scan(&map); + wined3d_device_set_stream_source(device, i, state->streams[i].buffer, + state->streams[i].offset, state->streams[i].stride); + } + map = changed->streamFreq; + while (map) + { + i = wined3d_bit_scan(&map); + wined3d_device_set_stream_source_freq(device, i, + state->streams[i].frequency | state->streams[i].flags); }
for (i = 0; i < ARRAY_SIZE(state->textures); ++i)
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/wined3d/device.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index add20cc63e0..6474b02cccc 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -3843,7 +3843,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, struct wined3d_color colour; struct wined3d_range range; BOOL set_blend_state; - DWORD map; + DWORD map, stage;
TRACE("device %p, stateblock %p.\n", device, stateblock);
@@ -3963,8 +3963,7 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device,
for (i = 0; i < ARRAY_SIZE(changed->samplerState); ++i) { - DWORD stage = i; - + stage = i; if (stage >= WINED3D_MAX_FRAGMENT_SAMPLERS) stage += WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS; map = changed->samplerState[i]; @@ -4013,13 +4012,14 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, state->streams[i].frequency | state->streams[i].flags); }
- for (i = 0; i < ARRAY_SIZE(state->textures); ++i) + map = changed->textures; + while (map) { - DWORD stage = i; + i = wined3d_bit_scan(&map); + stage = i; if (stage >= WINED3D_MAX_FRAGMENT_SAMPLERS) stage += WINED3DVERTEXTEXTURESAMPLER0 - WINED3D_MAX_FRAGMENT_SAMPLERS; - if (changed->textures & (1u << i)) - wined3d_device_set_texture(device, stage, state->textures[i]); + wined3d_device_set_texture(device, stage, state->textures[i]); }
for (i = 0; i < ARRAY_SIZE(state->clip_planes); ++i)
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com
Signed-off-by: Matteo Bruni mbruni@codeweavers.com --- dlls/wined3d/device.c | 7 ++++--- dlls/wined3d/wined3d_private.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/dlls/wined3d/device.c b/dlls/wined3d/device.c index 6474b02cccc..660ba777efc 100644 --- a/dlls/wined3d/device.c +++ b/dlls/wined3d/device.c @@ -4022,10 +4022,11 @@ void CDECL wined3d_device_apply_stateblock(struct wined3d_device *device, wined3d_device_set_texture(device, stage, state->textures[i]); }
- for (i = 0; i < ARRAY_SIZE(state->clip_planes); ++i) + map = changed->clipplane; + while (map) { - if (changed->clipplane & (1u << i)) - wined3d_device_set_clip_plane(device, i, &state->clip_planes[i]); + i = wined3d_bit_scan(&map); + wined3d_device_set_clip_plane(device, i, &state->clip_planes[i]); }
memset(&stateblock->changed, 0, sizeof(stateblock->changed)); diff --git a/dlls/wined3d/wined3d_private.h b/dlls/wined3d/wined3d_private.h index 15e376c8328..744e647008e 100644 --- a/dlls/wined3d/wined3d_private.h +++ b/dlls/wined3d/wined3d_private.h @@ -3926,7 +3926,7 @@ struct wined3d_saved_states DWORD renderState[(WINEHIGHEST_RENDER_STATE >> 5) + 1]; DWORD textureState[WINED3D_MAX_TEXTURES]; /* WINED3D_HIGHEST_TEXTURE_STATE + 1, 18 */ WORD samplerState[WINED3D_MAX_COMBINED_SAMPLERS]; /* WINED3D_HIGHEST_SAMPLER_STATE + 1, 14 */ - DWORD clipplane; /* WINED3D_MAX_USER_CLIP_PLANES, 32 */ + DWORD clipplane; /* WINED3D_MAX_CLIP_DISTANCES, 8 */ DWORD textures : 20; /* WINED3D_MAX_COMBINED_SAMPLERS, 20 */ DWORD indices : 1; DWORD material : 1;
Signed-off-by: Henri Verbeet hverbeet@codeweavers.com