From 25a8773d21d0113dc5e4f9dee49d9d9dbeed347b Mon Sep 17 00:00:00 2001 From: Matteo Bruni Date: Thu, 21 Sep 2017 01:07:07 +0200 Subject: [PATCH] wined3d: Advertise AUTOGENMIPMAP only for renderable and filterable formats. Signed-off-by: Matteo Bruni Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d9/tests/device.c | 1 - dlls/wined3d/directx.c | 4 +++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 1d8b8a99af8..b24136af761 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -6963,7 +6963,6 @@ static void test_mipmap_gen(void) D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, formats[i])); hr = IDirect3D9_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL, D3DFMT_X8R8G8B8, D3DUSAGE_AUTOGENMIPMAP, D3DRTYPE_TEXTURE, formats[i]); - todo_wine_if (!renderable && hr == D3D_OK) ok((hr == D3D_OK && renderable) || hr == D3DOK_NOAUTOGEN, "Got unexpected hr %#x for %srenderable format %#x.\n", hr, renderable ? "" : "non", formats[i]); diff --git a/dlls/wined3d/directx.c b/dlls/wined3d/directx.c index 168e494c0e5..da66ad36fd2 100644 --- a/dlls/wined3d/directx.c +++ b/dlls/wined3d/directx.c @@ -5364,7 +5364,9 @@ HRESULT CDECL wined3d_check_device_format(const struct wined3d *wined3d, UINT ad return WINED3DERR_NOTAVAILABLE; } - if ((usage & WINED3DUSAGE_AUTOGENMIPMAP) && !gl_info->supported[SGIS_GENERATE_MIPMAP]) + if ((usage & WINED3DUSAGE_AUTOGENMIPMAP) && (!gl_info->supported[SGIS_GENERATE_MIPMAP] + || (format->flags[gl_type] & (WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_FILTERING)) + != (WINED3DFMT_FLAG_RENDERTARGET | WINED3DFMT_FLAG_FILTERING))) { TRACE("No WINED3DUSAGE_AUTOGENMIPMAP support, returning WINED3DOK_NOAUTOGEN.\n"); return WINED3DOK_NOAUTOGEN;