From 24187d5397867ffffef46a59543021f19358cce5 Mon Sep 17 00:00:00 2001 From: =?utf8?q?Stefan=20D=C3=B6singer?= Date: Mon, 7 Apr 2014 22:27:30 +0200 Subject: [PATCH] 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 857882ac832..c5caff3f9f3 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 36845fea75a..921abbda063 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 bd2cf17edd2..716dc439300 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 8aab7918d88..31d552de29b 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); } } -- 2.11.4.GIT