[PATCH 5/5] ddraw/tests: Don't rely on the implicit vertex color in test_viewport.

Stefan Dösinger stefan at codeweavers.com
Thu Jan 23 03:45:43 CST 2020

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


Yes, the driver behavior seems pretty broken, but it is not the point of
this test, so I feel placing this workaround is OK. Otherwise the test is
passing without any ifs and buts on this card.

I have worked with this card a lot in the past and I don't remember it
doing that. I guess it is something specific to the setup of this test -
implicit color, transforms on, but lighting off or so.

The actual values it picks vary slightly from test run to test run.
Usually the first few tests are non-zero, e.g. 0x00071b4f and the later
tests are just 0x00000000. Disabling the other tests in ddraw7 does not
change things. The non-zero number varies.
 dlls/ddraw/tests/ddraw7.c | 10 ++++++++++
 1 file changed, 10 insertions(+)

diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 2f2ac29a082..c34d9394861 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -15015,6 +15015,16 @@ static void test_viewport(void)
     hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_LIGHTING, FALSE);
     ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+    /* Well, by default the vertices without color info should be white, and without any texture
+     * ops this should just show up in the output, but the r200 driver begs to differ and draws a
+     * random color. */
+    hr = IDirect3DDevice7_SetTextureStageState(device, 0, D3DTSS_COLOROP, D3DTOP_SELECTARG1);
+    ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+    hr = IDirect3DDevice7_SetTextureStageState(device, 0, D3DTSS_COLORARG1, D3DTA_TFACTOR);
+    ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
+    hr = IDirect3DDevice7_SetRenderState(device, D3DRENDERSTATE_TEXTUREFACTOR, 0x00ffffff);
+    ok(hr == DD_OK, "Got unexpected hr %#x.\n", hr);
     hr = IDirect3DDevice7_SetViewport(device, NULL);
     ok(hr == E_INVALIDARG, "Got unexpected hr %#x.\n", hr);

More information about the wine-devel mailing list