[PATCH 4/4] ddraw/tests: Account for random WARP behavior in test_texturemapblend.

Stefan Dösinger stefan at codeweavers.com
Sun Feb 6 11:07:49 CST 2022


Signed-of-by: Stefan Dösinger <stefan at codeweavers.com>

---

I don't want to just disable color keying because some of the tests here
make a point that the results are different in ddraw1 (ckey on by
default) vs ddraw2 (ckey off by default). The test doesn't bother about
SPECULARENABLE, so I am fine with just overriding the broken WARP
default.
---
 dlls/ddraw/tests/ddraw1.c | 32 ++++++++++++++++++++++++++++----
 1 file changed, 28 insertions(+), 4 deletions(-)

diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 304671558af..25a19dffa18 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -8390,6 +8390,18 @@ static void test_texturemapblend(void)
     emit_set_rs(&ptr, D3DRENDERSTATE_TEXTUREMAPBLEND, D3DTBLEND_MODULATE);
     emit_set_rs(&ptr, D3DRENDERSTATE_TEXTUREHANDLE, texture_handle);
 
+    /* SPECULARENABLE shouldn't matter in this test, but WARP begs to
+     * differ. In the event that color keying is randomly on(see comments
+     * in test_ck_default for reference), WARP will randomly discard
+     * geometry based on something, even though texture anddiffuse color
+     * alpha components are non - zero.Setting SPECULARENABLE to FALSE
+     * prevents this in some cases - presumably WARP multiplies the
+     * specular color "alpha" channel into the final result and then
+     * alpha tests the result.Since the specular property normally does
+     * not have an alpha component the actual specular color we set in
+     * the vertex data above does not matter. */
+    emit_set_rs(&ptr, D3DRENDERSTATE_SPECULARENABLE, FALSE);
+
     emit_tquad(&ptr, 0);
     emit_tquad(&ptr, 4);
     emit_end(&ptr);
@@ -8407,6 +8419,7 @@ static void test_texturemapblend(void)
     hr = IDirect3DDevice_EndScene(device);
     ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
 
+    /* The above SPECULARENABLE = FALSE on WARP matters here.*/
     color = get_surface_color(rt, 5, 5);
     ok(compare_color(color, 0x00000080, 2), "Got unexpected color 0x%08x.\n", color);
     color = get_surface_color(rt, 400, 5);
@@ -8476,14 +8489,25 @@ static void test_texturemapblend(void)
     hr = IDirect3DDevice_EndScene(device);
     ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
 
+    /* Despite our best efforts at not making color keying randomly triggering, those
+     * four broken() results occur every now and then on WARP. Presumably the non-
+     * existent alpha channel sometimes samples 0.0 instead of the expected 1.0. */
     color = get_surface_color(rt, 5, 5);
-    ok(compare_color(color, 0x000000ff, 2), "Got unexpected color 0x%08x.\n", color);
+    ok(compare_color(color, 0x000000ff, 2)
+            || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x00000000, 2)),
+            "Got unexpected color 0x%08x.\n", color);
     color = get_surface_color(rt, 400, 5);
-    ok(compare_color(color, 0x000000ff, 2), "Got unexpected color 0x%08x.\n", color);
+    ok(compare_color(color, 0x000000ff, 2)
+            || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x00000000, 2)),
+            "Got unexpected color 0x%08x.\n", color);
     color = get_surface_color(rt, 5, 245);
-    ok(compare_color(color, 0x00000080, 2), "Got unexpected color 0x%08x.\n", color);
+    ok(compare_color(color, 0x00000080, 2)
+            || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x00000000, 2)),
+            "Got unexpected color 0x%08x.\n", color);
     color = get_surface_color(rt, 400, 245);
-    ok(compare_color(color, 0x00000080, 2), "Got unexpected color 0x%08x.\n", color);
+    ok(compare_color(color, 0x00000080, 2)
+            || broken(ddraw_is_warp(ddraw) && compare_color(color, 0x00000000, 2)),
+            "Got unexpected color 0x%08x.\n", color);
 
     IDirect3DTexture_Release(texture);
     ref = IDirectDrawSurface_Release(surface);
-- 
2.34.1




More information about the wine-devel mailing list