Matteo Bruni : wined3d: Optimize scanning changed textures in wined3d_device_apply_stateblock().
Module: wine Branch: master Commit: aa21b022bb79d945515b15e8293c043c8f77c979 URL: https://source.winehq.org/git/wine.git/?a=commit;h=aa21b022bb79d945515b15e82... Author: Matteo Bruni <mbruni(a)codeweavers.com> Date: Fri Feb 28 11:25:02 2020 +0100 wined3d: Optimize scanning changed textures in wined3d_device_apply_stateblock(). Signed-off-by: Matteo Bruni <mbruni(a)codeweavers.com> Signed-off-by: Henri Verbeet <hverbeet(a)codeweavers.com> Signed-off-by: Alexandre Julliard <julliard(a)winehq.org> --- 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 add20cc63e..6474b02ccc 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)
participants (1)
-
Alexandre Julliard