d3d9: Upload the relevant texture in d3d9_texture_gen_auto_mipmap().

Instead of uploading all currently bound textures. Besides being redundant, this
would generate mipmaps for an uninitialized texture, and subsequently trying to
render from nonzero mipmap levels would yield uninitialized data.

Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54170
This commit is contained in:
Zebediah Figura 2022-12-19 18:09:45 -06:00 committed by Alexandre Julliard
parent c3ee85b606
commit f3e381d1c9
4 changed files with 5 additions and 4 deletions

View file

@ -125,7 +125,6 @@ struct d3d9_device
HRESULT device_init(struct d3d9_device *device, struct d3d9 *parent, struct wined3d *wined3d,
UINT adapter, D3DDEVTYPE device_type, HWND focus_window, DWORD flags,
D3DPRESENT_PARAMETERS *parameters, D3DDISPLAYMODEEX *mode) DECLSPEC_HIDDEN;
void d3d9_device_upload_managed_textures(struct d3d9_device *device);
struct d3d9_resource
{

View file

@ -3010,7 +3010,7 @@ static HRESULT d3d9_device_upload_sysmem_index_buffer(struct d3d9_device *device
return S_OK;
}
void d3d9_device_upload_managed_textures(struct d3d9_device *device)
static void d3d9_device_upload_managed_textures(struct d3d9_device *device)
{
const struct wined3d_stateblock_state *state = device->stateblock_state;
unsigned int i;

View file

@ -27903,7 +27903,7 @@ static void test_managed_generate_mipmap(void)
ok(hr == S_OK, "Got hr %#lx.\n", hr);
draw_textured_quad(&context, texture);
check_rt_color_todo(context.backbuffer, 0x0000ff00);
check_rt_color(context.backbuffer, 0x0000ff00);
IDirect3DTexture9_Release(texture);
release_test_context(&context);

View file

@ -138,7 +138,9 @@ void d3d9_texture_gen_auto_mipmap(struct d3d9_texture *texture)
if (!(texture->flags & D3D9_TEXTURE_MIPMAP_DIRTY))
return;
d3d9_texture_acquire_shader_resource_view(texture);
d3d9_device_upload_managed_textures(texture->parent_device);
if (texture->draw_texture)
wined3d_device_update_texture(texture->parent_device->wined3d_device,
texture->wined3d_texture, texture->draw_texture);
wined3d_device_context_generate_mipmaps(texture->parent_device->immediate_context, texture->wined3d_srv);
texture->flags &= ~D3D9_TEXTURE_MIPMAP_DIRTY;
}