Signed-off-by: Stefan Dösinger stefan@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.
Version 2: Fix whitespace in the comment. I don't think Visual Studio mangled it ("anddiffuse" didn't make sense) so I guess I need to get my butterfly keyboard replaced a second time...
I also checked the possibility that fog is used. Doesn't seem like it is the case here. --- 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);