From 812dd97a39a69b8053de49caecaefce947635972 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stefan=20D=C3=B6singer?= Date: Sat, 3 Jul 2010 15:34:35 +0200 Subject: [PATCH 03/12] d3d9: Windows7 doesn't draw with Viewports bigger than the framebuffer --- dlls/d3d9/tests/visual.c | 46 +++++++++++++++++++++++++++------------------- 1 files changed, 27 insertions(+), 19 deletions(-) diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c index 17dfc73..19a74b3 100644 --- a/dlls/d3d9/tests/visual.c +++ b/dlls/d3d9/tests/visual.c @@ -10747,6 +10747,7 @@ static void viewport_test(IDirect3DDevice9 *device) { HRESULT hr; DWORD color; D3DVIEWPORT9 vp, old_vp; + BOOL draw_failed = TRUE; const float quad[] = { -0.5, -0.5, 0.1, @@ -10766,6 +10767,10 @@ static void viewport_test(IDirect3DDevice9 *device) { * * TODO: Test Width < surface.width, but X + Width > surface.width * TODO: Test Width < surface.width, what happens with the height? + * + * Note that Windows 7 rejects MinZ / MaxZ outside [0;1], but accepts Width + * and Height fields bigger than the framebuffer. However, it later refuses + * to draw. */ memset(&vp, 0, sizeof(vp)); vp.X = 0; @@ -10784,29 +10789,32 @@ static void viewport_test(IDirect3DDevice9 *device) { if(SUCCEEDED(hr)) { hr = IDirect3DDevice9_DrawPrimitiveUP(device, D3DPT_TRIANGLESTRIP, 2, quad, 3 * sizeof(float)); - ok(hr == D3D_OK, "DrawPrimitiveUP failed (%08x)\n", hr); + ok(hr == D3D_OK || broken(hr == D3DERR_INVALIDCALL), "DrawPrimitiveUP failed (%08x)\n", hr); + draw_failed = FAILED(hr); hr = IDirect3DDevice9_EndScene(device); ok(hr == D3D_OK, "IDirect3DDevice9_EndScene returned %08x\n", hr); } - ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); - color = getPixelColor(device, 158, 118); - ok(color == 0x00ff0000, "viewport test: (158,118) has color %08x\n", color); - color = getPixelColor(device, 162, 118); - ok(color == 0x00ff0000, "viewport test: (162,118) has color %08x\n", color); - color = getPixelColor(device, 158, 122); - ok(color == 0x00ff0000, "viewport test: (158,122) has color %08x\n", color); - color = getPixelColor(device, 162, 122); - ok(color == 0x00ffffff, "viewport test: (162,122) has color %08x\n", color); + if(!draw_failed) + { + color = getPixelColor(device, 158, 118); + ok(color == 0x00ff0000, "viewport test: (158,118) has color %08x\n", color); + color = getPixelColor(device, 162, 118); + ok(color == 0x00ff0000, "viewport test: (162,118) has color %08x\n", color); + color = getPixelColor(device, 158, 122); + ok(color == 0x00ff0000, "viewport test: (158,122) has color %08x\n", color); + color = getPixelColor(device, 162, 122); + ok(color == 0x00ffffff, "viewport test: (162,122) has color %08x\n", color); - color = getPixelColor(device, 478, 358); - ok(color == 0x00ffffff, "viewport test: (478,358 has color %08x\n", color); - color = getPixelColor(device, 482, 358); - ok(color == 0x00ff0000, "viewport test: (482,358) has color %08x\n", color); - color = getPixelColor(device, 478, 362); - ok(color == 0x00ff0000, "viewport test: (478,362) has color %08x\n", color); - color = getPixelColor(device, 482, 362); - ok(color == 0x00ff0000, "viewport test: (482,362) has color %08x\n", color); + color = getPixelColor(device, 478, 358); + ok(color == 0x00ffffff, "viewport test: (478,358 has color %08x\n", color); + color = getPixelColor(device, 482, 358); + ok(color == 0x00ff0000, "viewport test: (482,358) has color %08x\n", color); + color = getPixelColor(device, 478, 362); + ok(color == 0x00ff0000, "viewport test: (478,362) has color %08x\n", color); + color = getPixelColor(device, 482, 362); + ok(color == 0x00ff0000, "viewport test: (482,362) has color %08x\n", color); + } hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL); ok(hr == D3D_OK, "IDirect3DDevice9_Present failed with %08x\n", hr); -- 1.6.4.4