From 9266c7956a2d359d5cb3e3a214293199be7c0fa5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 3 Jul 2010 12:10:47 +0200 Subject: [PATCH 02/12] d3d9: Skip YUV tests when encountering a broken driver --- dlls/d3d9/tests/visual.c | 19 ++++++++++++++++++- 1 files changed, 18 insertions(+), 1 deletions(-) diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index c0cd79d..17dfc73 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -10062,6 +10062,22 @@ static void yuv_color_test(IDirect3DDevice9 *device) { hr = IDirect3DDevice9_StretchRect(device, surface, NULL, target, NULL, D3DTEXF_POINT); ok(hr == D3D_OK, "IDirect3DDevice9_StretchRect failed with 0x%08x\n", hr); + color = getPixelColor(device, 40, 240); + /* Geforce 8+ Nvidia drivers mix the U and V channels in the surfaces, thus returning + * swapped colors. The Y channel is used correctly. D3DFMT_UYVY essentially turns into + * D3DFMT_VYUY. Skip the tests if this behavior is found. + * + * In this if condition 0x00008700 would be the correct result for input 0x0000ff00. + * This input value in turn returns 0x004bff1c, the correct result for 0xff000000. + */ + if(format == D3DFMT_UYVY && test_data[i].in == 0xff000000 && + color_match(color, 0x00008700, 18)) + { + win_skip("Windows driver confuses U and V channels, skipping test\n"); + IDirect3DSurface9_Release(surface); + goto break_nested_loop; + } + /* Native D3D can't resist filtering the YUY surface, even though we asked it not to do so above. To * prevent running into precision problems, read a far left and far right pixel. In the future we may * want to add tests for the filtered pixels as well. @@ -10069,7 +10085,6 @@ static void yuv_color_test(IDirect3DDevice9 *device) { * Unfortunately different implementations(Windows-NV and Mac-ATI tested) interpret some colors vastly * differently, so we need a max diff of 16 */ - color = getPixelColor(device, 40, 240); ok(color_match(color, ref_color_left, 18), "Input 0x%08x: Got color 0x%08x for pixel 1/1, expected 0x%08x, format %s\n", test_data[i].in, color, ref_color_left, fmt_string); @@ -10082,6 +10097,8 @@ static void yuv_color_test(IDirect3DDevice9 *device) { } IDirect3DSurface9_Release(surface); } + break_nested_loop: + IDirect3DSurface9_Release(target); IDirect3D9_Release(d3d); } -- 1.6.4.4