[PATCH 3/5] d3d9/tests: Relax the fog range test a bit.

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


The difference between range fog and Z fog is quite big in this setup.
Moving the fog start a bit away from the geometry avoids a false
positive on r200 that was caused by its poor fog precision.

Yes, I made sure the test still fails if we use use range fog with table
fog.
---
 dlls/d3d9/tests/visual.c | 23 ++++++++++-------------
 1 file changed, 10 insertions(+), 13 deletions(-)

diff --git a/dlls/d3d9/tests/visual.c b/dlls/d3d9/tests/visual.c
index 63c0db6..f2c5884 100644
--- a/dlls/d3d9/tests/visual.c
+++ b/dlls/d3d9/tests/visual.c
@@ -1148,10 +1148,10 @@ static void fog_test(void)
     },
     untransformed_3[] =
     {
-        {-1.0f, -1.0f, 0.4999f, 0xffff0000, 0xff000000},
-        {-1.0f,  1.0f, 0.4999f, 0xffff0000, 0xff000000},
-        { 1.0f, -1.0f, 0.4999f, 0xffff0000, 0xff000000},
-        { 1.0f,  1.0f, 0.4999f, 0xffff0000, 0xff000000},
+        {-1.0f, -1.0f, 0.5f,    0xffff0000, 0xff000000},
+        {-1.0f,  1.0f, 0.5f,    0xffff0000, 0xff000000},
+        { 1.0f, -1.0f, 0.5f,    0xffff0000, 0xff000000},
+        { 1.0f,  1.0f, 0.5f,    0xffff0000, 0xff000000},
     },
     far_quad1[] =
     {
@@ -1568,15 +1568,12 @@ static void fog_test(void)
         hr = IDirect3DDevice9_SetRenderState(device, D3DRS_RANGEFOGENABLE, TRUE);
         ok(SUCCEEDED(hr), "IDirect3DDevice9_SetRenderState failed, hr %#x.\n", hr);
 
-        /* z=0.4999, set the fogstart to 0.5 and fogend slightly higher. If range fog
-         * is not used, the fog coordinate will be equal to fogstart and the quad not
-         * fogged. If range fog is used the fog coordinate will be slightly higher and
-         * the fog coordinate will be > fogend, so we get a fully fogged quad. The fog
-         * is calculated per vertex and interpolated, so even the center of the screen
-         * where the difference doesn't matter will be fogged, but check the corners in
-         * case a d3d/gl implementation decides to calculate the fog factor per fragment */
-        start = 0.5f;
-        end = 0.50001f;
+        /* z=0.5, x = +/- 1.0, y = +/- 1.0. In case of z fog the fog coordinate is
+         * 0.5. With range fog it is sqrt(x*x + y*y + z*z) = 1.5 for all vertices.
+         * Note that the fog coordinate is interpolated linearly across the vertices,
+         * so the different eye distance at the screen center should not matter. */
+        start = 0.75f;
+        end = 0.75001f;
         hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGSTART, *((DWORD *) &start));
         ok(SUCCEEDED(hr), "IDirect3DDevice9_SetRenderState failed, hr %#x.\n", hr);
         hr = IDirect3DDevice9_SetRenderState(device, D3DRS_FOGEND, *((DWORD *) &end));
-- 
2.3.0




More information about the wine-patches mailing list