[PATCH] d3d/tests: Geforce8+ GPUs abs() table fog.

Stefan Dösinger stefan at codeweavers.com
Fri Feb 13 03:51:38 CST 2015


I'm not changing our implementation behavior because calculating the
absolute would mean additional shader instructions. Furthermore we'd
have to test if the abs() in this situation is done per vertex or per
fragment.

Note that the deviation of r200's behavior is different from the
geforce8+ one.
---
 dlls/d3d8/tests/visual.c  | 23 ++++++++++++++---------
 dlls/d3d9/tests/visual.c  | 23 ++++++++++++++---------
 dlls/ddraw/tests/ddraw7.c | 28 +++++++++++++++++++---------
 3 files changed, 47 insertions(+), 27 deletions(-)

diff --git a/dlls/d3d8/tests/visual.c b/dlls/d3d8/tests/visual.c
index 40bbc59..c095463 100644
--- a/dlls/d3d8/tests/visual.c
+++ b/dlls/d3d8/tests/visual.c
@@ -5458,26 +5458,30 @@ static void test_negative_fixedfunction_fog(void)
             DWORD d;
         } start, end;
         D3DFOGMODE vfog, tfog;
-        DWORD color, color_broken;
+        DWORD color, color_broken, color_broken2;
     }
     tests[] =
     {
-        /* Run the XYZRHW tests first. Depth clamping is broken after RHW draws on the testbot. */
+        /* Run the XYZRHW tests first. Depth clamping is broken after RHW draws on the testbot.
+         *
+         * Geforce8+ GPUs on Windows abs() table fog, everything else does not. */
         {D3DFVF_XYZRHW, tquad,  sizeof(*tquad), &identity, { 0.0f}, {1.0f},
-                D3DFOG_NONE,   D3DFOG_LINEAR, 0x00ff0000, 0x00ff0000},
+                D3DFOG_NONE,   D3DFOG_LINEAR, 0x00ff0000, 0x00808000, 0x00808000},
         /* r200 GPUs and presumably all d3d8 and older HW clamp the fog
          * parameters to 0.0 and 1.0 in the table fog case. */
         {D3DFVF_XYZRHW, tquad,  sizeof(*tquad), &identity, {-1.0f}, {0.0f},
-                D3DFOG_NONE,   D3DFOG_LINEAR, 0x00808000, 0x00ff0000},
+                D3DFOG_NONE,   D3DFOG_LINEAR, 0x00808000, 0x00ff0000, 0x0000ff00},
         /* test_fog_interpolation shows that vertex fog evaluates the fog
          * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows
-         * that the abs happens before the fog equation is evaluated. */
+         * that the abs happens before the fog equation is evaluated.
+         *
+         * Vertex fog abs() behavior is the same on all GPUs. */
         {D3DFVF_XYZ,    quad,   sizeof(*quad),  &zero,     { 0.0f}, {1.0f},
-                D3DFOG_LINEAR, D3DFOG_NONE,   0x00808000, 0x00808000},
+                D3DFOG_LINEAR, D3DFOG_NONE,   0x00808000, 0x00808000, 0x00808000},
         {D3DFVF_XYZ,    quad,   sizeof(*quad),  &zero,     {-1.0f}, {0.0f},
-                D3DFOG_LINEAR, D3DFOG_NONE,   0x0000ff00, 0x0000ff00},
+                D3DFOG_LINEAR, D3DFOG_NONE,   0x0000ff00, 0x0000ff00, 0x0000ff00},
         {D3DFVF_XYZ,    quad,   sizeof(*quad),  &zero,     { 0.0f}, {1.0f},
-                D3DFOG_EXP,    D3DFOG_NONE,   0x009b6400, 0x009b6400},
+                D3DFOG_EXP,    D3DFOG_NONE,   0x009b6400, 0x009b6400, 0x009b6400},
     };
     D3DCAPS8 caps;
 
@@ -5539,7 +5543,8 @@ static void test_negative_fixedfunction_fog(void)
         ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
 
         color = getPixelColor(device, 320, 240);
-        ok(color_match(color, tests[i].color, 2) || broken(color_match(color, tests[i].color_broken, 2)),
+        ok(color_match(color, tests[i].color, 2) || broken(color_match(color, tests[i].color_broken, 2))
+                || broken(color_match(color, tests[i].color_broken2, 2)),
                 "Got unexpected color 0x%08x, case %u.\n", color, i);
         hr = IDirect3DDevice8_Present(device, NULL, NULL, NULL, NULL);
         ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index b4df9c4..a8cf55f 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -17057,26 +17057,30 @@ static void test_negative_fixedfunction_fog(void)
             DWORD d;
         } start, end;
         D3DFOGMODE vfog, tfog;
-        DWORD color, color_broken;
+        DWORD color, color_broken, color_broken2;
     }
     tests[] =
     {
-        /* Run the XYZRHW tests first. Depth clamping is broken after RHW draws on the testbot. */
+        /* Run the XYZRHW tests first. Depth clamping is broken after RHW draws on the testbot.
+         *
+         * Geforce8+ GPUs on Windows abs() table fog, everything else does not. */
         {D3DFVF_XYZRHW, tquad,  sizeof(*tquad), &identity, { 0.0f}, {1.0f},
-                D3DFOG_NONE,   D3DFOG_LINEAR, 0x00ff0000, 0x00ff0000},
+                D3DFOG_NONE,   D3DFOG_LINEAR, 0x00ff0000, 0x00808000, 0x00808000},
         /* r200 GPUs and presumably all d3d8 and older HW clamp the fog
          * parameters to 0.0 and 1.0 in the table fog case. */
         {D3DFVF_XYZRHW, tquad,  sizeof(*tquad), &identity, {-1.0f}, {0.0f},
-                D3DFOG_NONE,   D3DFOG_LINEAR, 0x00808000, 0x00ff0000},
+                D3DFOG_NONE,   D3DFOG_LINEAR, 0x00808000, 0x00ff0000, 0x0000ff00},
         /* test_fog_interpolation shows that vertex fog evaluates the fog
          * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows
-         * that the abs happens before the fog equation is evaluated. */
+         * that the abs happens before the fog equation is evaluated.
+         *
+         * Vertex fog abs() behavior is the same on all GPUs. */
         {D3DFVF_XYZ,    quad,   sizeof(*quad),  &zero,     { 0.0f}, {1.0f},
-                D3DFOG_LINEAR, D3DFOG_NONE,   0x00808000, 0x00808000},
+                D3DFOG_LINEAR, D3DFOG_NONE,   0x00808000, 0x00808000, 0x00808000},
         {D3DFVF_XYZ,    quad,   sizeof(*quad),  &zero,     {-1.0f}, {0.0f},
-                D3DFOG_LINEAR, D3DFOG_NONE,   0x0000ff00, 0x0000ff00},
+                D3DFOG_LINEAR, D3DFOG_NONE,   0x0000ff00, 0x0000ff00, 0x0000ff00},
         {D3DFVF_XYZ,    quad,   sizeof(*quad),  &zero,     { 0.0f}, {1.0f},
-                D3DFOG_EXP,    D3DFOG_NONE,   0x009b6400, 0x009b6400},
+                D3DFOG_EXP,    D3DFOG_NONE,   0x009b6400, 0x009b6400, 0x009b6400},
     };
     D3DCAPS9 caps;
 
@@ -17138,7 +17142,8 @@ static void test_negative_fixedfunction_fog(void)
         ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
 
         color = getPixelColor(device, 320, 240);
-        ok(color_match(color, tests[i].color, 2) || broken(color_match(color, tests[i].color_broken, 2)),
+        ok(color_match(color, tests[i].color, 2) || broken(color_match(color, tests[i].color_broken, 2))
+                || broken(color_match(color, tests[i].color_broken2, 2)),
                 "Got unexpected color 0x%08x, case %u.\n", color, i);
         hr = IDirect3DDevice9_Present(device, NULL, NULL, NULL, NULL);
         ok(SUCCEEDED(hr), "Failed to present, hr %#x.\n", hr);
diff --git a/dlls/ddraw/tests/ddraw7.c b/dlls/ddraw/tests/ddraw7.c
index 01d0fcb..90ea739 100644
--- a/dlls/ddraw/tests/ddraw7.c
+++ b/dlls/ddraw/tests/ddraw7.c
@@ -8097,21 +8097,30 @@ static void test_negative_fixedfunction_fog(void)
             DWORD d;
         } start, end;
         D3DFOGMODE vfog, tfog;
-        DWORD color, color_broken;
+        DWORD color, color_broken, color_broken2;
     }
     tests[] =
     {
-        /* Run the XYZRHW tests first. Depth clamping is broken after RHW draws on the testbot. */
-        {D3DFVF_XYZRHW, tquad,  &identity, { 0.0f}, {1.0f}, D3DFOG_NONE,   D3DFOG_LINEAR, 0x00ff0000, 0x00ff0000},
+        /* Run the XYZRHW tests first. Depth clamping is broken after RHW draws on the testbot.
+         *
+         * Geforce8+ GPUs on Windows abs() table fog, everything else does not. */
+        {D3DFVF_XYZRHW, tquad,  &identity, { 0.0f}, {1.0f}, D3DFOG_NONE,   D3DFOG_LINEAR,
+                0x00ff0000, 0x00808000, 0x00808000},
         /* r200 GPUs and presumably all d3d8 and older HW clamp the fog
          * parameters to 0.0 and 1.0 in the table fog case. */
-        {D3DFVF_XYZRHW, tquad,  &identity, {-1.0f}, {0.0f}, D3DFOG_NONE,   D3DFOG_LINEAR, 0x00808000, 0x00ff0000},
+        {D3DFVF_XYZRHW, tquad,  &identity, {-1.0f}, {0.0f}, D3DFOG_NONE,   D3DFOG_LINEAR,
+                0x00808000, 0x00ff0000, 0x0000ff00},
         /* test_fog_interpolation shows that vertex fog evaluates the fog
          * equation in the vertex pipeline. Start = -1.0 && end = 0.0 shows
-         * that the abs happens before the fog equation is evaluated. */
-        {D3DFVF_XYZ,    quad,   &zero,     { 0.0f}, {1.0f}, D3DFOG_LINEAR, D3DFOG_NONE,   0x00808000, 0x00808000},
-        {D3DFVF_XYZ,    quad,   &zero,     {-1.0f}, {0.0f}, D3DFOG_LINEAR, D3DFOG_NONE,   0x0000ff00, 0x0000ff00},
-        {D3DFVF_XYZ,    quad,   &zero,     { 0.0f}, {1.0f}, D3DFOG_EXP,    D3DFOG_NONE,   0x009b6400, 0x009b6400},
+         * that the abs happens before the fog equation is evaluated.
+         *
+         * Vertex fog abs() behavior is the same on all GPUs. */
+        {D3DFVF_XYZ,    quad,   &zero,     { 0.0f}, {1.0f}, D3DFOG_LINEAR, D3DFOG_NONE,
+                0x00808000, 0x00808000, 0x00808000},
+        {D3DFVF_XYZ,    quad,   &zero,     {-1.0f}, {0.0f}, D3DFOG_LINEAR, D3DFOG_NONE,
+                0x0000ff00, 0x0000ff00, 0x0000ff00},
+        {D3DFVF_XYZ,    quad,   &zero,     { 0.0f}, {1.0f}, D3DFOG_EXP,    D3DFOG_NONE,
+                0x009b6400, 0x009b6400, 0x009b6400},
     };
     D3DDEVICEDESC7 caps;
 
@@ -8170,7 +8179,8 @@ static void test_negative_fixedfunction_fog(void)
         ok(SUCCEEDED(hr), "Failed to end scene, hr %#x.\n", hr);
 
         color = get_surface_color(rt, 0, 240);
-        ok(compare_color(color, tests[i].color, 2) || broken(compare_color(color, tests[i].color_broken, 2)),
+        ok(compare_color(color, tests[i].color, 2) || broken(compare_color(color, tests[i].color_broken, 2))
+                || broken(compare_color(color, tests[i].color_broken2, 2)),
                 "Got unexpected color 0x%08x, case %u.\n", color, i);
     }
 
-- 
2.3.0




More information about the wine-patches mailing list