Commit f3e381d1 authored by Zebediah Figura's avatar Zebediah Figura Committed by Alexandre Julliard

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
parent c3ee85b6
......@@ -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
{
......
......@@ -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;
......
......@@ -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);
......@@ -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;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment