[PATCH 5/5] d3dx9/tests: Replace a test giving inconsistent results on Windows.

Matteo Bruni mbruni at codeweavers.com
Mon Mar 3 09:28:13 CST 2014


---
 dlls/d3dx9_36/tests/mesh.c | 54 ++++++++++++++++++++++------------------------
 1 file changed, 26 insertions(+), 28 deletions(-)

diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c
index 1c3748f..8486393 100644
--- a/dlls/d3dx9_36/tests/mesh.c
+++ b/dlls/d3dx9_36/tests/mesh.c
@@ -6368,11 +6368,6 @@ static void test_weld_vertices(void)
         D3DXVECTOR3 position;
         SHORT normal[4];
     };
-    struct vertex_color_float4
-    {
-        D3DXVECTOR3 position;
-        D3DXVECTOR4 color;
-    };
     struct vertex_texcoord_float16_2
     {
         D3DXVECTOR3 position;
@@ -6400,7 +6395,6 @@ static void test_weld_vertices(void)
     UINT vertex_size_color_ubyte4 = sizeof(struct vertex_color_ubyte4);
     UINT vertex_size_texcoord_short2 = sizeof(struct vertex_texcoord_short2);
     UINT vertex_size_normal_short4 = sizeof(struct vertex_normal_short4);
-    UINT vertex_size_color_float4 = sizeof(struct vertex_color_float4);
     UINT vertex_size_texcoord_float16_2 = sizeof(struct vertex_texcoord_float16_2);
     UINT vertex_size_texcoord_float16_4 = sizeof(struct vertex_texcoord_float16_4);
     UINT vertex_size_normal_udec3 = sizeof(struct vertex_normal_udec3);
@@ -6495,10 +6489,10 @@ static void test_weld_vertices(void)
         {0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 2},
         D3DDECL_END()
     };
-    D3DVERTEXELEMENT9 declaration_color2_float4[] =
+    D3DVERTEXELEMENT9 declaration_color1[] =
     {
         {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
-        {0, 12, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 2},
+        {0, 12, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_COLOR, 1},
         D3DDECL_END()
     };
     D3DVERTEXELEMENT9 declaration_texcoord_float16_2[] =
@@ -7362,34 +7356,38 @@ static void test_weld_vertices(void)
     const DWORD exp_face_remap26[] = {0, 1};
     const DWORD exp_vertex_remap26[] = {0, 1, 2, 3, 4, 5};
     const DWORD exp_new_num_vertices26 = ARRAY_SIZE(exp_vertices26);
-    /* Test 27. Weld color with usage index larger than 1. Check that the
-     * default epsilon of 1e-6f is used. */
-    D3DXVECTOR4 zero_float4 = {0.0f, 0.0f, 0.0f, 0.0f};
-    D3DXVECTOR4 almost_zero_float4 = {0.0f + FLT_EPSILON, 0.0f + FLT_EPSILON, 0.0f + FLT_EPSILON, 0.0f + FLT_EPSILON};
-    const struct vertex_color_float4 vertices27[] =
+    /* Test 27. Weld color with usage index 1 (specular). */
+    /* Previously this test used float color values and index > 1 but that case
+     * appears to be effectively unhandled in native so the test gave
+     * inconsistent results. */
+    const struct vertex_color vertices27[] =
     {
-        {{ 0.0f,  3.0f,  0.f}, zero_float4},
-        {{ 2.0f,  3.0f,  0.f}, zero_float4},
-        {{ 0.0f,  0.0f,  0.f}, zero_float4},
+        {{ 0.0f,  3.0f,  0.0f}, 0x00000000},
+        {{ 2.0f,  3.0f,  0.0f}, 0x10203040},
+        {{ 0.0f,  0.0f,  0.0f}, 0x50607080},
 
-        {{ 3.0f,  3.0f,  0.f}, almost_zero_float4},
-        {{ 3.0f,  0.0f,  0.f}, zero_float4},
-        {{ 1.0f,  0.0f,  0.f}, almost_zero_float4},
+        {{ 3.0f,  3.0f,  0.0f}, 0x11213141},
+        {{ 3.0f,  0.0f,  0.0f}, 0xffffffff},
+        {{ 1.0f,  0.0f,  0.0f}, 0x51617181},
     };
     const DWORD indices27[] = {0, 1, 2, 3, 4, 5};
     const DWORD attributes27[] = {0, 0};
     const UINT num_vertices27 = ARRAY_SIZE(vertices27);
     const UINT num_faces27 = ARRAY_SIZE(indices27) / VERTS_PER_FACE;
     DWORD flags27 = D3DXWELDEPSILONS_WELDPARTIALMATCHES;
-    const D3DXWELDEPSILONS epsilons27 = {1.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, 0.0f, 0.0f, 0.0f};
+    const D3DXWELDEPSILONS epsilons27 =
+    {
+        1.1f, 0.0f, 0.0f, 0.0f, 2.0f / 255.0f, 0.0f,
+        {0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f}, 0.0f, 0.0f, 0.0f
+    };
     const DWORD adjacency27[] = {-1, 1, -1, -1, -1, 0};
-    const struct vertex_color_float4 exp_vertices27[] =
+    const struct vertex_color exp_vertices27[] =
     {
-        {{ 0.0f,  3.0f,  0.f}, zero_float4},
-        {{ 2.0f,  3.0f,  0.f}, zero_float4},
-        {{ 0.0f,  0.0f,  0.f}, zero_float4},
+        {{ 0.0f,  3.0f,  0.0f}, 0x00000000},
+        {{ 2.0f,  3.0f,  0.0f}, 0x10203040},
+        {{ 0.0f,  0.0f,  0.0f}, 0x50607080},
 
-        {{ 3.0f,  0.0f,  0.f}, zero_float4},
+        {{ 3.0f,  0.0f,  0.0f}, 0xffffffff},
     };
     const DWORD exp_indices27[] = {0, 1, 2, 1, 3, 2};
     const DWORD exp_face_remap27[] = {0, 1};
@@ -7983,8 +7981,8 @@ static void test_weld_vertices(void)
             num_vertices27,
             num_faces27,
             options,
-            declaration_color2_float4,
-            vertex_size_color_float4,
+            declaration_color1,
+            vertex_size_color,
             flags27,
             &epsilons27,
             adjacency27,
@@ -8063,7 +8061,7 @@ static void test_weld_vertices(void)
             goto cleanup;
         }
         face_remap = HeapAlloc(GetProcessHeap(), 0, tc[i].num_faces * sizeof(*face_remap));
-        if (!adjacency_out)
+        if (!face_remap)
         {
             skip("Couldn't allocate face_remap array.\n");
             goto cleanup;
-- 
1.8.3.2




More information about the wine-patches mailing list