Stefan Dösinger : ddraw/tests: Account for random WARP behavior in test_texturemapblend.
Alexandre Julliard
julliard at winehq.org
Wed Feb 9 16:03:51 CST 2022
Module: wine
Branch: master
Commit: 3a833d9b0b73aef54499e89b0d0c2ead959e650e
URL: https://source.winehq.org/git/wine.git/?a=commit;h=3a833d9b0b73aef54499e89b0d0c2ead959e650e
Author: Stefan Dösinger <stefan at codeweavers.com>
Date: Wed Feb 9 14:23:17 2022 +0300
ddraw/tests: Account for random WARP behavior in test_texturemapblend.
Signed-off-by: Stefan Dösinger <stefan at codeweavers.com>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/ddraw/tests/ddraw1.c | 34 ++++++++++++++++++++++++++++++----
1 file changed, 30 insertions(+), 4 deletions(-)
diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 304671558af..458b3f48fdb 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -8390,6 +8390,20 @@ 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
+ * fragments based on something, even though texture and diffuse 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. Setting FOGENABLE = FALSE
+ * does not help either (specular alpha can contain a per-vertex fog
+ * factor. Doesn't seem to matter here). */
+ emit_set_rs(&ptr, D3DRENDERSTATE_SPECULARENABLE, FALSE);
+
emit_tquad(&ptr, 0);
emit_tquad(&ptr, 4);
emit_end(&ptr);
@@ -8407,6 +8421,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 +8491,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);
More information about the wine-cvs
mailing list