Module: wine Branch: master Commit: f3e381d1c9dd7bbb1a8aa4ccb22e5b2b992d4b86 URL: https://gitlab.winehq.org/wine/wine/-/commit/f3e381d1c9dd7bbb1a8aa4ccb22e5b2...
Author: Zebediah Figura zfigura@codeweavers.com Date: Mon Dec 19 18:09:45 2022 -0600
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
---
dlls/d3d9/d3d9_private.h | 1 - dlls/d3d9/device.c | 2 +- dlls/d3d9/tests/visual.c | 2 +- dlls/d3d9/texture.c | 4 +++- 4 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/dlls/d3d9/d3d9_private.h b/dlls/d3d9/d3d9_private.h index fe13f679db4..7dc32e6c12f 100644 --- a/dlls/d3d9/d3d9_private.h +++ b/dlls/d3d9/d3d9_private.h @@ -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 { diff --git a/dlls/d3d9/device.c b/dlls/d3d9/device.c index 55641670665..eddb2a0ebdd 100644 --- a/dlls/d3d9/device.c +++ b/dlls/d3d9/device.c @@ -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; diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index e6c0458c69f..12105cfa0e0 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -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); diff --git a/dlls/d3d9/texture.c b/dlls/d3d9/texture.c index e5b52fdcc82..0a27941ac2b 100644 --- a/dlls/d3d9/texture.c +++ b/dlls/d3d9/texture.c @@ -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; }