From 0ccc7c09bbe740ff94c7164a6c3ab1cab85fd72d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Mon, 11 Dec 2017 10:25:25 +0100 Subject: [PATCH] d3d9/tests: Add test for checking D3DUSAGE_AUTOGENMIPMAP support. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- dlls/d3d9/tests/device.c | 47 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) diff --git a/dlls/d3d9/tests/device.c b/dlls/d3d9/tests/device.c index 866f435f836..1a226ec9f1d 100644 --- a/dlls/d3d9/tests/device.c +++ b/dlls/d3d9/tests/device.c @@ -11497,6 +11497,27 @@ static void test_swapchain_parameters(void) static void test_check_device_format(void) { + static const D3DFORMAT adapter_formats[] = + { + D3DFMT_A8R8G8B8, + D3DFMT_X8R8G8B8, + }; + static const D3DFORMAT mipmap_autogen_formats[] = + { + D3DFMT_R8G8B8, + D3DFMT_A8R8G8B8, + D3DFMT_X8R8G8B8, + D3DFMT_R5G6B5, + D3DFMT_X1R5G5B5, + D3DFMT_A8P8, + D3DFMT_P8, + D3DFMT_A1R5G5B5, + D3DFMT_A4R4G4B4, + }; + + D3DFORMAT adapter_format, format; + BOOL render_target_supported; + unsigned int i, j; IDirect3D9 *d3d; HRESULT hr; @@ -11538,6 +11559,32 @@ static void test_check_device_format(void) D3DUSAGE_SOFTWAREPROCESSING, D3DRTYPE_INDEXBUFFER, D3DFMT_INDEX16); todo_wine ok(hr == D3DERR_INVALIDCALL, "Got unexpected hr %#x.\n", hr); + for (i = 0; i < ARRAY_SIZE(adapter_formats); ++i) + { + adapter_format = adapter_formats[i]; + + for (j = 0; j < ARRAY_SIZE(mipmap_autogen_formats); ++j) + { + format = mipmap_autogen_formats[j]; + + hr = IDirect3D9_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL, adapter_format, + D3DUSAGE_RENDERTARGET, D3DRTYPE_TEXTURE, format); + ok(hr == D3D_OK || hr == D3DERR_NOTAVAILABLE, "Got unexpected hr %#x.\n", hr); + render_target_supported = hr == D3D_OK; + + hr = IDirect3D9_CheckDeviceFormat(d3d, 0, D3DDEVTYPE_HAL, adapter_format, + D3DUSAGE_RENDERTARGET | D3DUSAGE_AUTOGENMIPMAP, D3DRTYPE_TEXTURE, format); + if (render_target_supported) + { + ok(hr == D3D_OK || hr == D3DOK_NOAUTOGEN, "Got unexpected hr %#x.\n", hr); + } + else + { + ok(hr == D3DERR_NOTAVAILABLE, "Got unexpected hr %#x.\n", hr); + } + } + } + IDirect3D9_Release(d3d); }