Module: wine Branch: master Commit: 4e1da07b277a67578400cbe802ca3f6bb5d4121a URL: https://gitlab.winehq.org/wine/wine/-/commit/4e1da07b277a67578400cbe802ca3f6...
Author: Zebediah Figura zfigura@codeweavers.com Date: Thu Oct 26 13:43:49 2023 -0500
d3d9/tests: Do not test sysmem textures in test_mipmap_upload().
This does not work reliably on Windows. The application in question uses a managed texture.
Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=53743
---
dlls/d3d9/tests/visual.c | 76 ++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 45 deletions(-)
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 2479e6576a7..0ac6b58cb36 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -27966,11 +27966,11 @@ static void test_managed_generate_mipmap(void) release_test_context(&context); }
-/* Some applications lock a mipmapped texture at level 0, write every level at - * once, and expect it to be uploaded. */ +/* Some applications (Vivisector, Cryostasis) lock a mipmapped managed texture + * at level 0, write every level at once, and expect it to be uploaded. */ static void test_mipmap_upload(void) { - unsigned int i, j, width, level_count; + unsigned int j, width, level_count; struct d3d9_test_context context; IDirect3DTexture9 *texture; D3DLOCKED_RECT locked_rect; @@ -27978,64 +27978,50 @@ static void test_mipmap_upload(void) unsigned int *mem; HRESULT hr;
- static const D3DPOOL pools[] = - { - D3DPOOL_MANAGED, - D3DPOOL_SYSTEMMEM, - }; - if (!init_test_context(&context)) return; device = context.device;
- for (i = 0; i < ARRAY_SIZE(pools); ++i) - { - winetest_push_context("pool %#x", pools[i]); - - hr = IDirect3DDevice9_CreateTexture(device, 32, 32, 0, 0, - D3DFMT_A8R8G8B8, pools[i], &texture, NULL); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - - level_count = IDirect3DBaseTexture9_GetLevelCount(texture); - - hr = IDirect3DTexture9_LockRect(texture, 0, &locked_rect, NULL, 0); - ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IDirect3DDevice9_CreateTexture(device, 32, 32, 0, 0, + D3DFMT_A8R8G8B8, D3DPOOL_MANAGED, &texture, NULL); + ok(hr == S_OK, "Got hr %#lx.\n", hr);
- mem = locked_rect.pBits; + level_count = IDirect3DBaseTexture9_GetLevelCount(texture);
- for (j = 0; j < level_count; ++j) - { - width = 32 >> j; - memset(mem, 0x11 * (j + 1), width * width * 4); - mem += width * width; - } + hr = IDirect3DTexture9_LockRect(texture, 0, &locked_rect, NULL, 0); + ok(hr == S_OK, "Got hr %#lx.\n", hr);
- hr = IDirect3DTexture9_UnlockRect(texture, 0); - ok(hr == S_OK, "Got hr %#lx.\n", hr); + mem = locked_rect.pBits;
- for (j = 0; j < level_count; ++j) - { - winetest_push_context("level %u", j); + for (j = 0; j < level_count; ++j) + { + width = 32 >> j; + memset(mem, 0x11 * (j + 1), width * width * 4); + mem += width * width; + }
- hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff0000, 0.0, 0); - ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IDirect3DTexture9_UnlockRect(texture, 0); + ok(hr == S_OK, "Got hr %#lx.\n", hr);
- hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MIPFILTER, D3DTEXF_POINT); - ok(hr == S_OK, "Got hr %#lx.\n", hr); - hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAXMIPLEVEL, j); - ok(hr == S_OK, "Got hr %#lx.\n", hr); + for (j = 0; j < level_count; ++j) + { + winetest_push_context("level %u", j);
- draw_textured_quad(&context, texture); - /* AMD Windows drivers don't sample from sysmem textures. */ - check_rt_color_broken(context.backbuffer, 0x00111111 * (j + 1), 0x00000000, pools[i] == D3DPOOL_SYSTEMMEM); + hr = IDirect3DDevice9_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffff0000, 0.0, 0); + ok(hr == S_OK, "Got hr %#lx.\n", hr);
- winetest_pop_context(); - } + hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MIPFILTER, D3DTEXF_POINT); + ok(hr == S_OK, "Got hr %#lx.\n", hr); + hr = IDirect3DDevice9_SetSamplerState(device, 0, D3DSAMP_MAXMIPLEVEL, j); + ok(hr == S_OK, "Got hr %#lx.\n", hr);
- IDirect3DTexture9_Release(texture); + draw_textured_quad(&context, texture); + check_rt_color(context.backbuffer, 0x00111111 * (j + 1));
winetest_pop_context(); } + + IDirect3DTexture9_Release(texture); release_test_context(&context); }