diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c index 3fd5d9d9d55..24bcb829ebb 100644 --- a/dlls/d3dx9_36/tests/mesh.c +++ b/dlls/d3dx9_36/tests/mesh.c @@ -6449,11 +6449,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; @@ -6481,7 +6476,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); @@ -6576,10 +6570,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[] = @@ -7443,34 +7437,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 DWORD adjacency27[] = {-1, 1, -1, -1, -1, 0}; - const struct vertex_color_float4 exp_vertices27[] = + const D3DXWELDEPSILONS epsilons27 = { - {{ 0.0f, 3.0f, 0.f}, zero_float4}, - {{ 2.0f, 3.0f, 0.f}, zero_float4}, - {{ 0.0f, 0.0f, 0.f}, zero_float4}, + 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 exp_vertices27[] = + { + {{ 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}; @@ -8064,8 +8062,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, @@ -8144,7 +8142,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;