=?UTF-8?Q?Stefan=20D=C3=B6singer=20?=: ddraw/tests: Nvidia has an off-by-one rectangle handling bug.

Alexandre Julliard julliard at winehq.org
Tue Apr 8 14:02:51 CDT 2014


Module: wine
Branch: master
Commit: 24187d5397867ffffef46a59543021f19358cce5
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=24187d5397867ffffef46a59543021f19358cce5

Author: Stefan Dösinger <stefan at codeweavers.com>
Date:   Mon Apr  7 22:27:30 2014 +0200

ddraw/tests: Nvidia has an off-by-one rectangle handling bug.

---

 dlls/ddraw/tests/ddraw1.c |   18 +++++++++++++++++-
 dlls/ddraw/tests/ddraw2.c |   18 +++++++++++++++++-
 dlls/ddraw/tests/ddraw4.c |   18 +++++++++++++++++-
 dlls/ddraw/tests/ddraw7.c |   18 +++++++++++++++++-
 4 files changed, 68 insertions(+), 4 deletions(-)

diff --git a/dlls/ddraw/tests/ddraw1.c b/dlls/ddraw/tests/ddraw1.c
index 857882a..c5caff3 100644
--- a/dlls/ddraw/tests/ddraw1.c
+++ b/dlls/ddraw/tests/ddraw1.c
@@ -556,6 +556,21 @@ static void test_clipper_blt(void)
         0x00000000, 0x00000000, 0x00ff0000, 0x00ffffff,
         0x00000000, 0x00000000, 0x00ff0000, 0x00ffffff,
     };
+    /* Nvidia on Windows seems to have an off-by-one error
+     * when processing source rectangles. Our left = 1 and
+     * right = 5 input reads from x = {1, 2, 3}. x = 4 is
+     * read as well, but only for the edge pixels on the
+     * output image. The bug happens on the y axis as well,
+     * but we only read one row there, and all source rows
+     * contain the same data. This bug is not dependent on
+     * the presence of a clipper. */
+    static const D3DCOLOR expected1_broken[] =
+    {
+        0x000000ff, 0x000000ff, 0x00000000, 0x00000000,
+        0x000000ff, 0x000000ff, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00ff0000, 0x00ff0000,
+        0x00000000, 0x00000000, 0x0000ff00, 0x00ff0000,
+    };
     static const D3DCOLOR expected2[] =
     {
         0x000000ff, 0x000000ff, 0x00000000, 0x00000000,
@@ -669,7 +684,8 @@ static void test_clipper_blt(void)
             x = 80 * ((2 * j) + 1);
             y = 60 * ((2 * i) + 1);
             color = get_surface_color(dst_surface, x, y);
-            ok(compare_color(color, expected1[i * 4 + j], 1),
+            ok(compare_color(color, expected1[i * 4 + j], 1)
+                    || broken(compare_color(color, expected1_broken[i * 4 + j], 1)),
                     "Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected1[i * 4 + j], x, y, color);
         }
     }
diff --git a/dlls/ddraw/tests/ddraw2.c b/dlls/ddraw/tests/ddraw2.c
index 36845fe..921abbd 100644
--- a/dlls/ddraw/tests/ddraw2.c
+++ b/dlls/ddraw/tests/ddraw2.c
@@ -504,6 +504,21 @@ static void test_clipper_blt(void)
         0x00000000, 0x00000000, 0x00ff0000, 0x00ffffff,
         0x00000000, 0x00000000, 0x00ff0000, 0x00ffffff,
     };
+    /* Nvidia on Windows seems to have an off-by-one error
+     * when processing source rectangles. Our left = 1 and
+     * right = 5 input reads from x = {1, 2, 3}. x = 4 is
+     * read as well, but only for the edge pixels on the
+     * output image. The bug happens on the y axis as well,
+     * but we only read one row there, and all source rows
+     * contain the same data. This bug is not dependent on
+     * the presence of a clipper. */
+    static const D3DCOLOR expected1_broken[] =
+    {
+        0x000000ff, 0x000000ff, 0x00000000, 0x00000000,
+        0x000000ff, 0x000000ff, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00ff0000, 0x00ff0000,
+        0x00000000, 0x00000000, 0x0000ff00, 0x00ff0000,
+    };
     static const D3DCOLOR expected2[] =
     {
         0x000000ff, 0x000000ff, 0x00000000, 0x00000000,
@@ -617,7 +632,8 @@ static void test_clipper_blt(void)
             x = 80 * ((2 * j) + 1);
             y = 60 * ((2 * i) + 1);
             color = get_surface_color(dst_surface, x, y);
-            ok(compare_color(color, expected1[i * 4 + j], 1),
+            ok(compare_color(color, expected1[i * 4 + j], 1)
+                    || broken(compare_color(color, expected1_broken[i * 4 + j], 1)),
                     "Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected1[i * 4 + j], x, y, color);
         }
     }
diff --git a/dlls/ddraw/tests/ddraw4.c b/dlls/ddraw/tests/ddraw4.c
index bd2cf17..716dc43 100644
--- a/dlls/ddraw/tests/ddraw4.c
+++ b/dlls/ddraw/tests/ddraw4.c
@@ -696,6 +696,21 @@ static void test_clipper_blt(void)
         0x00000000, 0x00000000, 0x00ff0000, 0x00ffffff,
         0x00000000, 0x00000000, 0x00ff0000, 0x00ffffff,
     };
+    /* Nvidia on Windows seems to have an off-by-one error
+     * when processing source rectangles. Our left = 1 and
+     * right = 5 input reads from x = {1, 2, 3}. x = 4 is
+     * read as well, but only for the edge pixels on the
+     * output image. The bug happens on the y axis as well,
+     * but we only read one row there, and all source rows
+     * contain the same data. This bug is not dependent on
+     * the presence of a clipper. */
+    static const D3DCOLOR expected1_broken[] =
+    {
+        0x000000ff, 0x000000ff, 0x00000000, 0x00000000,
+        0x000000ff, 0x000000ff, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00ff0000, 0x00ff0000,
+        0x00000000, 0x00000000, 0x0000ff00, 0x00ff0000,
+    };
     static const D3DCOLOR expected2[] =
     {
         0x000000ff, 0x000000ff, 0x00000000, 0x00000000,
@@ -809,7 +824,8 @@ static void test_clipper_blt(void)
             x = 80 * ((2 * j) + 1);
             y = 60 * ((2 * i) + 1);
             color = get_surface_color(dst_surface, x, y);
-            ok(compare_color(color, expected1[i * 4 + j], 1),
+            ok(compare_color(color, expected1[i * 4 + j], 1)
+                    || broken(compare_color(color, expected1_broken[i * 4 + j], 1)),
                     "Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected1[i * 4 + j], x, y, color);
         }
     }
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 8aab791..31d552d 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -670,6 +670,21 @@ static void test_clipper_blt(void)
         0x00000000, 0x00000000, 0x00ff0000, 0x00ffffff,
         0x00000000, 0x00000000, 0x00ff0000, 0x00ffffff,
     };
+    /* Nvidia on Windows seems to have an off-by-one error
+     * when processing source rectangles. Our left = 1 and
+     * right = 5 input reads from x = {1, 2, 3}. x = 4 is
+     * read as well, but only for the edge pixels on the
+     * output image. The bug happens on the y axis as well,
+     * but we only read one row there, and all source rows
+     * contain the same data. This bug is not dependent on
+     * the presence of a clipper. */
+    static const D3DCOLOR expected1_broken[] =
+    {
+        0x000000ff, 0x000000ff, 0x00000000, 0x00000000,
+        0x000000ff, 0x000000ff, 0x00000000, 0x00000000,
+        0x00000000, 0x00000000, 0x00ff0000, 0x00ff0000,
+        0x00000000, 0x00000000, 0x0000ff00, 0x00ff0000,
+    };
     static const D3DCOLOR expected2[] =
     {
         0x000000ff, 0x000000ff, 0x00000000, 0x00000000,
@@ -783,7 +798,8 @@ static void test_clipper_blt(void)
             x = 80 * ((2 * j) + 1);
             y = 60 * ((2 * i) + 1);
             color = get_surface_color(dst_surface, x, y);
-            ok(compare_color(color, expected1[i * 4 + j], 1),
+            ok(compare_color(color, expected1[i * 4 + j], 1)
+                    || broken(compare_color(color, expected1_broken[i * 4 + j], 1)),
                     "Expected color 0x%08x at %u,%u, got 0x%08x.\n", expected1[i * 4 + j], x, y, color);
         }
     }




More information about the wine-cvs mailing list