From: Sebastian Mayr me@sam.st
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=54898 --- dlls/d3d8/tests/device.c | 60 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 60 insertions(+)
diff --git a/dlls/d3d8/tests/device.c b/dlls/d3d8/tests/device.c index 6a585458bae..a2d40b4b154 100644 --- a/dlls/d3d8/tests/device.c +++ b/dlls/d3d8/tests/device.c @@ -10910,6 +10910,65 @@ static void test_window_position(void) IDirect3D8_Release(d3d); }
+static void test_min_mag_mip_filter_validate(void) +{ + static const D3DTEXTUREFILTERTYPE filters[] = {D3DTEXF_NONE, D3DTEXF_POINT, D3DTEXF_LINEAR, D3DTEXF_ANISOTROPIC}; + IDirect3DTexture8 *texture; + IDirect3DDevice8 *device; + unsigned int i, j, k, l; + IDirect3D8 *d3d; + ULONG refcount; + HWND window; + HRESULT hr; + + window = create_window(); + ok(!!window, "Failed to create a window.\n"); + d3d = Direct3DCreate8(D3D_SDK_VERSION); + ok(!!d3d, "Failed to create a D3D object.\n"); + if (!(device = create_device(d3d, window, NULL))) + { + skip("Failed to create a 3D device, skipping test.\n"); + goto cleanup; + } + + hr = IDirect3DDevice8_CreateTexture(device, 16, 16, 1, 0, D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &texture); + ok(hr == D3D_OK, "CreateTexture failed, error %#lx.\n", hr); + + for (i = 0; i < 8; ++i) + { + hr = IDirect3DDevice8_SetTexture(device, i, (IDirect3DBaseTexture8 *)texture); + ok(hr == D3D_OK, "SetTexture failed, error %#lx.\n", hr); + + for (j = 0; j < ARRAY_SIZE(filters); ++j) + for (k = 0; k < ARRAY_SIZE(filters); ++k) + for (l = 0; l < ARRAY_SIZE(filters); ++l) + { + DWORD passes; + + hr = IDirect3DDevice8_SetTextureStageState(device, i, D3DTSS_MINFILTER, filters[j]); + ok(hr == D3D_OK, "SetTextureStageState MINFILTER failed, error %#lx.\n", hr); + hr = IDirect3DDevice8_SetTextureStageState(device, i, D3DTSS_MAGFILTER, filters[k]); + ok(hr == D3D_OK, "SetTextureStageState MAGFILTER failed, error %#lx.\n", hr); + hr = IDirect3DDevice8_SetTextureStageState(device, i, D3DTSS_MIPFILTER, filters[l]); + ok(hr == D3D_OK, "SetTextureStageState MIPFILTER failed, error %#lx.\n", hr); + + hr = IDirect3DDevice8_ValidateDevice(device, &passes); + ok(hr == D3D_OK, "ValidateDevice failed, error %#lx.\n", hr); + } + + hr = IDirect3DDevice8_SetTexture(device, i, NULL); + ok(hr == D3D_OK, "SetTexture NULL failed, error %#lx.\n", hr); + } + + refcount = IDirect3DTexture8_Release(texture); + ok(!refcount, "Texture has %lu references left.\n", refcount); + refcount = IDirect3DDevice8_Release(device); + ok(!refcount, "Device has %lu references left.\n", refcount); +cleanup: + IDirect3D8_Release(d3d); + DestroyWindow(window); +} + START_TEST(device) { HMODULE d3d8_handle = GetModuleHandleA("d3d8.dll"); @@ -11031,6 +11090,7 @@ START_TEST(device) test_creation_parameters(); test_cursor_clipping(); test_window_position(); + test_min_mag_mip_filter_validate();
UnregisterClassA("d3d8_test_wc", GetModuleHandleA(NULL)); }