From: Stefan Dösinger stefan@codeweavers.com
Signed-off-by: Stefan Dösinger stefan@codeweavers.com Signed-off-by: Henri Verbeet hverbeet@codeweavers.com --- dlls/ddraw/tests/ddraw1.c | 32 ++++++++++++++++++++++++++------ dlls/ddraw/tests/ddraw2.c | 32 ++++++++++++++++++++++++++------ dlls/ddraw/tests/ddraw4.c | 39 +++++++++++++++++++++++++++++++++------ dlls/ddraw/tests/ddraw7.c | 39 +++++++++++++++++++++++++++++++++------ 4 files changed, 118 insertions(+), 24 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c index 56521f6a4e3..ee03ee94b68 100644 --- a/dlls/ddraw/tests/ddraw1.c +++ b/dlls/ddraw/tests/ddraw1.c @@ -10971,9 +10971,21 @@ static void test_clear(void) hr = IDirect3DViewport_Clear(viewport, 2, rect, D3DCLEAR_TARGET); ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
+ color = get_surface_color(rt, 160, 360); + ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 3 (pos, neg) has color 0x%08x.\n", color); + color = get_surface_color(rt, 160, 120); + ok(compare_color(color, 0x00ff0000, 0), "Clear rectangle 1 (pos, pos) has color 0x%08x.\n", color); + color = get_surface_color(rt, 480, 360); + ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 4 (NULL) has color 0x%08x.\n", color); + color = get_surface_color(rt, 480, 120); + ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 4 (neg, neg) has color 0x%08x.\n", color); + + viewport_set_background(device, viewport, white); + hr = IDirect3DViewport_Clear(viewport, 1, &rect_full, D3DCLEAR_TARGET); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + /* negative x, negative y. - * - * FIXME: WARP seems to clear the entire screen here. */ + * Also ignored, except on WARP, which clears the entire screen. */ rect_negneg.x1 = 640; rect_negneg.y1 = 240; rect_negneg.x2 = 320; @@ -10983,13 +10995,21 @@ static void test_clear(void) ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
color = get_surface_color(rt, 160, 360); - ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 3 (pos, neg) has color 0x%08x.\n", color); + ok(compare_color(color, 0x00ffffff, 0) + || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x0000ff00, 0)), + "Got unexpected color 0x%08x.\n", color); color = get_surface_color(rt, 160, 120); - ok(compare_color(color, 0x00ff0000, 0), "Clear rectangle 1 (pos, pos) has color 0x%08x.\n", color); + ok(compare_color(color, 0x00ffffff, 0) + || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x0000ff00, 0)), + "Got unexpected color 0x%08x.\n", color); color = get_surface_color(rt, 480, 360); - ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 4 (NULL) has color 0x%08x.\n", color); + ok(compare_color(color, 0x00ffffff, 0) + || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x0000ff00, 0)), + "Got unexpected color 0x%08x.\n", color); color = get_surface_color(rt, 480, 120); - ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 4 (neg, neg) has color 0x%08x.\n", color); + ok(compare_color(color, 0x00ffffff, 0) + || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x0000ff00, 0)), + "Got unexpected color 0x%08x.\n", color);
/* Test how the viewport affects clears. */ viewport_set_background(device, viewport, white); diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c index 9e4aebdef4b..42dc3f262d0 100644 --- a/dlls/ddraw/tests/ddraw2.c +++ b/dlls/ddraw/tests/ddraw2.c @@ -12342,9 +12342,21 @@ static void test_clear(void) hr = IDirect3DViewport2_Clear(viewport, 2, rect, D3DCLEAR_TARGET); ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
+ color = get_surface_color(rt, 160, 360); + ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 3 (pos, neg) has color 0x%08x.\n", color); + color = get_surface_color(rt, 160, 120); + ok(compare_color(color, 0x00ff0000, 0), "Clear rectangle 1 (pos, pos) has color 0x%08x.\n", color); + color = get_surface_color(rt, 480, 360); + ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 4 (NULL) has color 0x%08x.\n", color); + color = get_surface_color(rt, 480, 120); + ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 4 (neg, neg) has color 0x%08x.\n", color); + + viewport_set_background(device, viewport, white); + hr = IDirect3DViewport2_Clear(viewport, 1, &rect_full, D3DCLEAR_TARGET); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); + /* negative x, negative y. - * - * FIXME: WARP seems to clear the entire screen here. */ + * Also ignored, except on WARP, which clears the entire screen. */ rect_negneg.x1 = 640; rect_negneg.y1 = 240; rect_negneg.x2 = 320; @@ -12354,13 +12366,21 @@ static void test_clear(void) ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
color = get_surface_color(rt, 160, 360); - ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 3 (pos, neg) has color 0x%08x.\n", color); + ok(compare_color(color, 0x00ffffff, 0) + || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x0000ff00, 0)), + "Got unexpected color 0x%08x.\n", color); color = get_surface_color(rt, 160, 120); - ok(compare_color(color, 0x00ff0000, 0), "Clear rectangle 1 (pos, pos) has color 0x%08x.\n", color); + ok(compare_color(color, 0x00ffffff, 0) + || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x0000ff00, 0)), + "Got unexpected color 0x%08x.\n", color); color = get_surface_color(rt, 480, 360); - ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 4 (NULL) has color 0x%08x.\n", color); + ok(compare_color(color, 0x00ffffff, 0) + || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x0000ff00, 0)), + "Got unexpected color 0x%08x.\n", color); color = get_surface_color(rt, 480, 120); - ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 4 (neg, neg) has color 0x%08x.\n", color); + ok(compare_color(color, 0x00ffffff, 0) + || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x0000ff00, 0)), + "Got unexpected color 0x%08x.\n", color);
/* Test how the viewport affects clears. */ viewport_set_background(device, viewport, white); diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c index e4b65a5ca1f..dab1e6d0f97 100644 --- a/dlls/ddraw/tests/ddraw4.c +++ b/dlls/ddraw/tests/ddraw4.c @@ -14358,6 +14358,8 @@ static void test_clear(void) IDirect3DViewport3 *viewport, *viewport2, *viewport3; IDirect3DDevice3 *device; IDirectDrawSurface4 *rt; + IDirectDraw4 *ddraw; + IDirect3D3 *d3d; D3DRECT rect[2]; D3DCOLOR color; ULONG refcount; @@ -14372,6 +14374,11 @@ static void test_clear(void) return; }
+ hr = IDirect3DDevice3_GetDirect3D(device, &d3d); + ok(SUCCEEDED(hr), "Failed to get Direct3D3 interface, hr %#x.\n", hr); + hr = IDirect3D3_QueryInterface(d3d, &IID_IDirectDraw4, (void **)&ddraw); + ok(SUCCEEDED(hr), "Failed to get ddraw interface, hr %#x.\n", hr); + hr = IDirect3DDevice3_GetRenderTarget(device, &rt); ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
@@ -14399,9 +14406,19 @@ static void test_clear(void) hr = IDirect3DViewport3_Clear2(viewport, 2, rect, D3DCLEAR_TARGET, 0xffff0000, 0.0f, 0); ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
+ color = get_surface_color(rt, 160, 360); + ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 3 (pos, neg) has color 0x%08x.\n", color); + color = get_surface_color(rt, 160, 120); + ok(compare_color(color, 0x00ff0000, 0), "Clear rectangle 1 (pos, pos) has color 0x%08x.\n", color); + color = get_surface_color(rt, 480, 360); + ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 4 (NULL) has color 0x%08x.\n", color); + color = get_surface_color(rt, 480, 120); + ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 4 (neg, neg) has color 0x%08x.\n", color); + + hr = IDirect3DViewport3_Clear2(viewport, 1, &rect_full, D3DCLEAR_TARGET, 0xffffffff, 0.0, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); /* negative x, negative y. - * - * FIXME: WARP seems to clear the entire screen here. */ + * Also ignored, except on WARP, which clears the entire screen. */ rect_negneg.x1 = 640; rect_negneg.y1 = 240; rect_negneg.x2 = 320; @@ -14410,13 +14427,21 @@ static void test_clear(void) ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
color = get_surface_color(rt, 160, 360); - ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 3 (pos, neg) has color 0x%08x.\n", color); + ok(compare_color(color, 0x00ffffff, 0) + || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x0000ff00, 0)), + "Got unexpected color 0x%08x.\n", color); color = get_surface_color(rt, 160, 120); - ok(compare_color(color, 0x00ff0000, 0), "Clear rectangle 1 (pos, pos) has color 0x%08x.\n", color); + ok(compare_color(color, 0x00ffffff, 0) + || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x0000ff00, 0)), + "Got unexpected color 0x%08x.\n", color); color = get_surface_color(rt, 480, 360); - ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 4 (NULL) has color 0x%08x.\n", color); + ok(compare_color(color, 0x00ffffff, 0) + || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x0000ff00, 0)), + "Got unexpected color 0x%08x.\n", color); color = get_surface_color(rt, 480, 120); - ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 4 (neg, neg) has color 0x%08x.\n", color); + ok(compare_color(color, 0x00ffffff, 0) + || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x0000ff00, 0)), + "Got unexpected color 0x%08x.\n", color);
/* Test how the viewport affects clears. */ hr = IDirect3DViewport3_Clear2(viewport, 1, &rect_full, D3DCLEAR_TARGET, 0xffffffff, 0.0f, 0); @@ -14524,6 +14549,8 @@ static void test_clear(void) IDirect3DViewport3_Release(viewport2); IDirect3DViewport3_Release(viewport); IDirectDrawSurface4_Release(rt); + IDirectDraw4_Release(ddraw); + IDirect3D3_Release(d3d); refcount = IDirect3DDevice3_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); DestroyWindow(window); diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c index 5b29f9cd13e..cebe0ecbf50 100644 --- a/dlls/ddraw/tests/ddraw7.c +++ b/dlls/ddraw/tests/ddraw7.c @@ -13728,7 +13728,9 @@ static void test_clear(void) IDirect3DDevice7 *device; IDirectDrawSurface7 *rt; D3DVIEWPORT7 vp, old_vp; + IDirectDraw7 *ddraw; D3DRECT rect_negneg; + IDirect3D7 *d3d; D3DRECT rect[2]; D3DCOLOR color; ULONG refcount; @@ -13743,6 +13745,11 @@ static void test_clear(void) return; }
+ hr = IDirect3DDevice7_GetDirect3D(device, &d3d); + ok(SUCCEEDED(hr), "Failed to get Direct3D7 interface, hr %#x.\n", hr); + hr = IDirect3D7_QueryInterface(d3d, &IID_IDirectDraw7, (void **)&ddraw); + ok(SUCCEEDED(hr), "Failed to get ddraw interface, hr %#x.\n", hr); + hr = IDirect3DDevice7_GetRenderTarget(device, &rt); ok(SUCCEEDED(hr), "Failed to get render target, hr %#x.\n", hr);
@@ -13766,9 +13773,19 @@ static void test_clear(void) hr = IDirect3DDevice7_Clear(device, 2, rect, D3DCLEAR_TARGET, 0xffff0000, 0.0f, 0); ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
+ color = get_surface_color(rt, 160, 360); + ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 3 (pos, neg) has color 0x%08x.\n", color); + color = get_surface_color(rt, 160, 120); + ok(compare_color(color, 0x00ff0000, 0), "Clear rectangle 1 (pos, pos) has color 0x%08x.\n", color); + color = get_surface_color(rt, 480, 360); + ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 4 (NULL) has color 0x%08x.\n", color); + color = get_surface_color(rt, 480, 120); + ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 4 (neg, neg) has color 0x%08x.\n", color); + + hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0, 0); + ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr); /* negative x, negative y. - * - * FIXME: WARP seems to clear the entire screen here. */ + * Also ignored, except on WARP, which clears the entire screen. */ rect_negneg.x1 = 640; rect_negneg.y1 = 240; rect_negneg.x2 = 320; @@ -13777,13 +13794,21 @@ static void test_clear(void) ok(SUCCEEDED(hr), "Failed to clear, hr %#x.\n", hr);
color = get_surface_color(rt, 160, 360); - ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 3 (pos, neg) has color 0x%08x.\n", color); + ok(compare_color(color, 0x00ffffff, 0) + || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x0000ff00, 0)), + "Got unexpected color 0x%08x.\n", color); color = get_surface_color(rt, 160, 120); - ok(compare_color(color, 0x00ff0000, 0), "Clear rectangle 1 (pos, pos) has color 0x%08x.\n", color); + ok(compare_color(color, 0x00ffffff, 0) + || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x0000ff00, 0)), + "Got unexpected color 0x%08x.\n", color); color = get_surface_color(rt, 480, 360); - ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 4 (NULL) has color 0x%08x.\n", color); + ok(compare_color(color, 0x00ffffff, 0) + || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x0000ff00, 0)), + "Got unexpected color 0x%08x.\n", color); color = get_surface_color(rt, 480, 120); - ok(compare_color(color, 0x00ffffff, 0), "Clear rectangle 4 (neg, neg) has color 0x%08x.\n", color); + ok(compare_color(color, 0x00ffffff, 0) + || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x0000ff00, 0)), + "Got unexpected color 0x%08x.\n", color);
/* Test how the viewport affects clears. */ hr = IDirect3DDevice7_Clear(device, 0, NULL, D3DCLEAR_TARGET, 0xffffffff, 0.0f, 0); @@ -13852,6 +13877,8 @@ static void test_clear(void) * in d3d7. */
IDirectDrawSurface7_Release(rt); + IDirectDraw7_Release(ddraw); + IDirect3D7_Release(d3d); refcount = IDirect3DDevice7_Release(device); ok(!refcount, "Device has %u references left.\n", refcount); DestroyWindow(window);