[PATCH 5/5] ddraw/tests: r200 ignores the alpha channel when matching color keys.

Stefan Dösinger stefan at codeweavers.com
Thu Mar 12 04:55:19 CDT 2015


The game that this test was written for (Harbinger, bug 22558) works on
this card. As far as I can see it doesn't use a color that differs from
the color key only in the alpha channel. Since this is the only GPU I
have that behaves in this way I think it's better to mark it broken and
show that other GPUs check the alpha channel when applying a color key.
---
 dlls/ddraw/tests/ddraw1.c | 34 ++++++++++++++++++++--------------
 dlls/ddraw/tests/ddraw2.c | 34 ++++++++++++++++++++--------------
 dlls/ddraw/tests/ddraw4.c | 34 ++++++++++++++++++++--------------
 dlls/ddraw/tests/ddraw7.c | 34 ++++++++++++++++++++--------------
 4 files changed, 80 insertions(+), 56 deletions(-)

diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index a26fd65..f59355e 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -1202,19 +1202,21 @@ static void test_ck_rgba(void)
         D3DCOLOR fill_color;
         BOOL color_key;
         BOOL blend;
-        D3DCOLOR result1;
-        D3DCOLOR result2;
+        D3DCOLOR result1, result1_broken;
+        D3DCOLOR result2, result2_broken;
     }
     tests[] =
     {
-        {0xff00ff00, TRUE,  TRUE,  0x00ff0000, 0x000000ff},
-        {0xff00ff00, TRUE,  FALSE, 0x00ff0000, 0x000000ff},
-        {0xff00ff00, FALSE, TRUE,  0x0000ff00, 0x0000ff00},
-        {0xff00ff00, FALSE, FALSE, 0x0000ff00, 0x0000ff00},
-        {0x7f00ff00, TRUE,  TRUE,  0x00807f00, 0x00807f00},
-        {0x7f00ff00, TRUE,  FALSE, 0x0000ff00, 0x0000ff00},
-        {0x7f00ff00, FALSE, TRUE,  0x00807f00, 0x00807f00},
-        {0x7f00ff00, FALSE, FALSE, 0x0000ff00, 0x0000ff00},
+        /* r200 on Windows doesn't check the alpha component when applying the color
+         * key, so the key matches on every texel. */
+        {0xff00ff00, TRUE,  TRUE,  0x00ff0000, 0x00ff0000, 0x000000ff, 0x000000ff},
+        {0xff00ff00, TRUE,  FALSE, 0x00ff0000, 0x00ff0000, 0x000000ff, 0x000000ff},
+        {0xff00ff00, FALSE, TRUE,  0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00},
+        {0xff00ff00, FALSE, FALSE, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00},
+        {0x7f00ff00, TRUE,  TRUE,  0x00807f00, 0x00ff0000, 0x00807f00, 0x000000ff},
+        {0x7f00ff00, TRUE,  FALSE, 0x0000ff00, 0x00ff0000, 0x0000ff00, 0x000000ff},
+        {0x7f00ff00, FALSE, TRUE,  0x00807f00, 0x00807f00, 0x00807f00, 0x00807f00},
+        {0x7f00ff00, FALSE, FALSE, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00},
     };
 
     IDirect3DExecuteBuffer *execute_buffer;
@@ -1328,10 +1330,12 @@ static void test_ck_rgba(void)
 
         color = get_surface_color(rt, 320, 240);
         if (i == 2)
-            todo_wine ok(compare_color(color, tests[i].result1, 1), "Expected color 0x%08x for test %u, got 0x%08x.\n",
+            todo_wine ok(compare_color(color, tests[i].result1, 1) || compare_color(color, tests[i].result1_broken, 1),
+                    "Expected color 0x%08x for test %u, got 0x%08x.\n",
                     tests[i].result1, i, color);
         else
-            ok(compare_color(color, tests[i].result1, 1), "Expected color 0x%08x for test %u, got 0x%08x.\n",
+            ok(compare_color(color, tests[i].result1, 1) || compare_color(color, tests[i].result1_broken, 1),
+                    "Expected color 0x%08x for test %u, got 0x%08x.\n",
                     tests[i].result1, i, color);
 
         U5(fx).dwFillColor = 0xff0000ff;
@@ -1350,10 +1354,12 @@ static void test_ck_rgba(void)
          * discarded, instead of just fully transparent. */
         color = get_surface_color(rt, 320, 240);
         if (i == 2)
-            todo_wine ok(compare_color(color, tests[i].result2, 1), "Expected color 0x%08x for test %u, got 0x%08x.\n",
+            todo_wine ok(compare_color(color, tests[i].result2, 1) || compare_color(color, tests[i].result2_broken, 1),
+                    "Expected color 0x%08x for test %u, got 0x%08x.\n",
                     tests[i].result2, i, color);
         else
-            ok(compare_color(color, tests[i].result2, 1), "Expected color 0x%08x for test %u, got 0x%08x.\n",
+            ok(compare_color(color, tests[i].result2, 1) || compare_color(color, tests[i].result2_broken, 1),
+                    "Expected color 0x%08x for test %u, got 0x%08x.\n",
                     tests[i].result2, i, color);
     }
 
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index f448455..44bd589 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -1471,19 +1471,21 @@ static void test_ck_rgba(void)
         D3DCOLOR fill_color;
         BOOL color_key;
         BOOL blend;
-        D3DCOLOR result1;
-        D3DCOLOR result2;
+        D3DCOLOR result1, result1_broken;
+        D3DCOLOR result2, result2_broken;
     }
     tests[] =
     {
-        {0xff00ff00, TRUE,  TRUE,  0x00ff0000, 0x000000ff},
-        {0xff00ff00, TRUE,  FALSE, 0x00ff0000, 0x000000ff},
-        {0xff00ff00, FALSE, TRUE,  0x0000ff00, 0x0000ff00},
-        {0xff00ff00, FALSE, FALSE, 0x0000ff00, 0x0000ff00},
-        {0x7f00ff00, TRUE,  TRUE,  0x00807f00, 0x00807f00},
-        {0x7f00ff00, TRUE,  FALSE, 0x0000ff00, 0x0000ff00},
-        {0x7f00ff00, FALSE, TRUE,  0x00807f00, 0x00807f00},
-        {0x7f00ff00, FALSE, FALSE, 0x0000ff00, 0x0000ff00},
+        /* r200 on Windows doesn't check the alpha component when applying the color
+         * key, so the key matches on every texel. */
+        {0xff00ff00, TRUE,  TRUE,  0x00ff0000, 0x00ff0000, 0x000000ff, 0x000000ff},
+        {0xff00ff00, TRUE,  FALSE, 0x00ff0000, 0x00ff0000, 0x000000ff, 0x000000ff},
+        {0xff00ff00, FALSE, TRUE,  0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00},
+        {0xff00ff00, FALSE, FALSE, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00},
+        {0x7f00ff00, TRUE,  TRUE,  0x00807f00, 0x00ff0000, 0x00807f00, 0x000000ff},
+        {0x7f00ff00, TRUE,  FALSE, 0x0000ff00, 0x00ff0000, 0x0000ff00, 0x000000ff},
+        {0x7f00ff00, FALSE, TRUE,  0x00807f00, 0x00807f00, 0x00807f00, 0x00807f00},
+        {0x7f00ff00, FALSE, FALSE, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00},
     };
 
     D3DTEXTUREHANDLE texture_handle;
@@ -1576,10 +1578,12 @@ static void test_ck_rgba(void)
 
         color = get_surface_color(rt, 320, 240);
         if (i == 2)
-            todo_wine ok(compare_color(color, tests[i].result1, 1), "Expected color 0x%08x for test %u, got 0x%08x.\n",
+            todo_wine ok(compare_color(color, tests[i].result1, 1) || compare_color(color, tests[i].result1_broken, 1),
+                    "Expected color 0x%08x for test %u, got 0x%08x.\n",
                     tests[i].result1, i, color);
         else
-            ok(compare_color(color, tests[i].result1, 1), "Expected color 0x%08x for test %u, got 0x%08x.\n",
+            ok(compare_color(color, tests[i].result1, 1) || compare_color(color, tests[i].result1_broken, 1),
+                    "Expected color 0x%08x for test %u, got 0x%08x.\n",
                     tests[i].result1, i, color);
 
         U5(fx).dwFillColor = 0xff0000ff;
@@ -1597,10 +1601,12 @@ static void test_ck_rgba(void)
          * discarded, instead of just fully transparent. */
         color = get_surface_color(rt, 320, 240);
         if (i == 2)
-            todo_wine ok(compare_color(color, tests[i].result2, 1), "Expected color 0x%08x for test %u, got 0x%08x.\n",
+            todo_wine ok(compare_color(color, tests[i].result2, 1) || compare_color(color, tests[i].result2_broken, 1),
+                    "Expected color 0x%08x for test %u, got 0x%08x.\n",
                     tests[i].result2, i, color);
         else
-            ok(compare_color(color, tests[i].result2, 1), "Expected color 0x%08x for test %u, got 0x%08x.\n",
+            ok(compare_color(color, tests[i].result2, 1) || compare_color(color, tests[i].result2_broken, 1),
+                    "Expected color 0x%08x for test %u, got 0x%08x.\n",
                     tests[i].result2, i, color);
     }
 
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index 87caf78..8f8b757 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -1662,19 +1662,21 @@ static void test_ck_rgba(void)
         D3DCOLOR fill_color;
         BOOL color_key;
         BOOL blend;
-        D3DCOLOR result1;
-        D3DCOLOR result2;
+        D3DCOLOR result1, result1_broken;
+        D3DCOLOR result2, result2_broken;
     }
     tests[] =
     {
-        {0xff00ff00, TRUE,  TRUE,  0x00ff0000, 0x000000ff},
-        {0xff00ff00, TRUE,  FALSE, 0x00ff0000, 0x000000ff},
-        {0xff00ff00, FALSE, TRUE,  0x0000ff00, 0x0000ff00},
-        {0xff00ff00, FALSE, FALSE, 0x0000ff00, 0x0000ff00},
-        {0x7f00ff00, TRUE,  TRUE,  0x00807f00, 0x00807f00},
-        {0x7f00ff00, TRUE,  FALSE, 0x0000ff00, 0x0000ff00},
-        {0x7f00ff00, FALSE, TRUE,  0x00807f00, 0x00807f00},
-        {0x7f00ff00, FALSE, FALSE, 0x0000ff00, 0x0000ff00},
+        /* r200 on Windows doesn't check the alpha component when applying the color
+         * key, so the key matches on every texel. */
+        {0xff00ff00, TRUE,  TRUE,  0x00ff0000, 0x00ff0000, 0x000000ff, 0x000000ff},
+        {0xff00ff00, TRUE,  FALSE, 0x00ff0000, 0x00ff0000, 0x000000ff, 0x000000ff},
+        {0xff00ff00, FALSE, TRUE,  0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00},
+        {0xff00ff00, FALSE, FALSE, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00},
+        {0x7f00ff00, TRUE,  TRUE,  0x00807f00, 0x00ff0000, 0x00807f00, 0x000000ff},
+        {0x7f00ff00, TRUE,  FALSE, 0x0000ff00, 0x00ff0000, 0x0000ff00, 0x000000ff},
+        {0x7f00ff00, FALSE, TRUE,  0x00807f00, 0x00807f00, 0x00807f00, 0x00807f00},
+        {0x7f00ff00, FALSE, FALSE, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00},
     };
 
     IDirectDrawSurface4 *surface;
@@ -1765,10 +1767,12 @@ static void test_ck_rgba(void)
 
         color = get_surface_color(rt, 320, 240);
         if (i == 2)
-            todo_wine ok(compare_color(color, tests[i].result1, 1), "Expected color 0x%08x for test %u, got 0x%08x.\n",
+            todo_wine ok(compare_color(color, tests[i].result1, 1) || compare_color(color, tests[i].result1_broken, 1),
+                    "Expected color 0x%08x for test %u, got 0x%08x.\n",
                     tests[i].result1, i, color);
         else
-            ok(compare_color(color, tests[i].result1, 1), "Expected color 0x%08x for test %u, got 0x%08x.\n",
+            ok(compare_color(color, tests[i].result1, 1) || compare_color(color, tests[i].result1_broken, 1),
+                    "Expected color 0x%08x for test %u, got 0x%08x.\n",
                     tests[i].result1, i, color);
 
         U5(fx).dwFillColor = 0xff0000ff;
@@ -1786,10 +1790,12 @@ static void test_ck_rgba(void)
          * discarded, instead of just fully transparent. */
         color = get_surface_color(rt, 320, 240);
         if (i == 2)
-            todo_wine ok(compare_color(color, tests[i].result2, 1), "Expected color 0x%08x for test %u, got 0x%08x.\n",
+            todo_wine ok(compare_color(color, tests[i].result2, 1) || compare_color(color, tests[i].result2_broken, 1),
+                    "Expected color 0x%08x for test %u, got 0x%08x.\n",
                     tests[i].result2, i, color);
         else
-            ok(compare_color(color, tests[i].result2, 1), "Expected color 0x%08x for test %u, got 0x%08x.\n",
+            ok(compare_color(color, tests[i].result2, 1) || compare_color(color, tests[i].result2_broken, 1),
+                    "Expected color 0x%08x for test %u, got 0x%08x.\n",
                     tests[i].result2, i, color);
     }
 
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 6a6c155..13eb004 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -1376,19 +1376,21 @@ static void test_ck_rgba(void)
         D3DCOLOR fill_color;
         BOOL color_key;
         BOOL blend;
-        D3DCOLOR result1;
-        D3DCOLOR result2;
+        D3DCOLOR result1, result1_broken;
+        D3DCOLOR result2, result2_broken;
     }
     tests[] =
     {
-        {0xff00ff00, TRUE,  TRUE,  0x00ff0000, 0x000000ff},
-        {0xff00ff00, TRUE,  FALSE, 0x00ff0000, 0x000000ff},
-        {0xff00ff00, FALSE, TRUE,  0x0000ff00, 0x0000ff00},
-        {0xff00ff00, FALSE, FALSE, 0x0000ff00, 0x0000ff00},
-        {0x7f00ff00, TRUE,  TRUE,  0x00807f00, 0x00807f00},
-        {0x7f00ff00, TRUE,  FALSE, 0x0000ff00, 0x0000ff00},
-        {0x7f00ff00, FALSE, TRUE,  0x00807f00, 0x00807f00},
-        {0x7f00ff00, FALSE, FALSE, 0x0000ff00, 0x0000ff00},
+        /* r200 on Windows doesn't check the alpha component when applying the color
+         * key, so the key matches on every texel. */
+        {0xff00ff00, TRUE,  TRUE,  0x00ff0000, 0x00ff0000, 0x000000ff, 0x000000ff},
+        {0xff00ff00, TRUE,  FALSE, 0x00ff0000, 0x00ff0000, 0x000000ff, 0x000000ff},
+        {0xff00ff00, FALSE, TRUE,  0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00},
+        {0xff00ff00, FALSE, FALSE, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00},
+        {0x7f00ff00, TRUE,  TRUE,  0x00807f00, 0x00ff0000, 0x00807f00, 0x000000ff},
+        {0x7f00ff00, TRUE,  FALSE, 0x0000ff00, 0x00ff0000, 0x0000ff00, 0x000000ff},
+        {0x7f00ff00, FALSE, TRUE,  0x00807f00, 0x00807f00, 0x00807f00, 0x00807f00},
+        {0x7f00ff00, FALSE, FALSE, 0x0000ff00, 0x0000ff00, 0x0000ff00, 0x0000ff00},
     };
 
     IDirectDrawSurface7 *texture;
@@ -1470,10 +1472,12 @@ static void test_ck_rgba(void)
 
         color = get_surface_color(rt, 320, 240);
         if (i == 2)
-            todo_wine ok(compare_color(color, tests[i].result1, 1), "Expected color 0x%08x for test %u, got 0x%08x.\n",
+            todo_wine ok(compare_color(color, tests[i].result1, 1) || compare_color(color, tests[i].result1_broken, 1),
+                    "Expected color 0x%08x for test %u, got 0x%08x.\n",
                     tests[i].result1, i, color);
         else
-            ok(compare_color(color, tests[i].result1, 1), "Expected color 0x%08x for test %u, got 0x%08x.\n",
+            ok(compare_color(color, tests[i].result1, 1) || compare_color(color, tests[i].result1_broken, 1),
+                    "Expected color 0x%08x for test %u, got 0x%08x.\n",
                     tests[i].result1, i, color);
 
         U5(fx).dwFillColor = 0xff0000ff;
@@ -1491,10 +1495,12 @@ static void test_ck_rgba(void)
          * discarded, instead of just fully transparent. */
         color = get_surface_color(rt, 320, 240);
         if (i == 2)
-            todo_wine ok(compare_color(color, tests[i].result2, 1), "Expected color 0x%08x for test %u, got 0x%08x.\n",
+            todo_wine ok(compare_color(color, tests[i].result2, 1) || compare_color(color, tests[i].result2_broken, 1),
+                    "Expected color 0x%08x for test %u, got 0x%08x.\n",
                     tests[i].result2, i, color);
         else
-            ok(compare_color(color, tests[i].result2, 1), "Expected color 0x%08x for test %u, got 0x%08x.\n",
+            ok(compare_color(color, tests[i].result2, 1) || compare_color(color, tests[i].result2_broken, 1),
+                    "Expected color 0x%08x for test %u, got 0x%08x.\n",
                     tests[i].result2, i, color);
     }
 
-- 
2.3.0




More information about the wine-patches mailing list