wined3d: Optimize scanning changed textures in wined3d_device_apply_stateblock().

Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Matteo Bruni 2020-02-28 11:25:02 +01:00 committed by Alexandre Julliard
parent 02d3cfe0ae
commit aa21b022bb
1 changed files with 7 additions and 7 deletions

View File

@ -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,12 +4012,13 @@ 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]);
}