On Fri, Feb 1, 2019 at 1:00 PM Matteo Bruni mbruni@codeweavers.com wrote:
unsigned int i = stage >= D3DVERTEXTEXTURESAMPLER0 ? stage - D3DVERTEXTEXTURESAMPLER0 + 16 : stage;
if (i < D3D9_MAX_TEXTURE_UNITS)
{
if (texture_impl && texture_impl->usage & D3DUSAGE_AUTOGENMIPMAP)
device->auto_mipmaps |= 1u << i;
else
device->auto_mipmaps &= ~(1u << i);
}
- }
We probably need to validate the "stage" parameter, otherwise SetTexture() with stage = 16 updates the "auto_mipmaps" for vertex texture sampler 0.
- while (map) {
i = ffs(map) - 1;
map ^= 1u << i;
wined3d_bit_scan() is preferred.
if ((wined3d_texture = wined3d_device_get_texture(device->wined3d_device, stage))
&& (texture = wined3d_texture_get_parent(wined3d_texture))
&& texture->usage & D3DUSAGE_AUTOGENMIPMAP)
device->auto_mipmaps |= 1u << i;
else
device->auto_mipmaps &= ~(1u << i);
Formatting.