diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c index f596daf0110..c77f89173bc 100644 --- a/dlls/d3dx9_36/tests/mesh.c +++ b/dlls/d3dx9_36/tests/mesh.c @@ -9267,6 +9267,17 @@ static void test_clone_mesh(void) {{ 1.0f, 0.0f, 0.f}, {0.099976f, 0.199951f, 0.099976f, 0.199951f}}, }; const UINT exp_vertex_size35 = sizeof(*exp_vertices35); + /* Test 36. Check that vertex buffer sharing is ok. */ + const struct vertex_pn vertices36[] = + { + {{ 0.0f, 3.0f, 0.f}, up}, + {{ 2.0f, 3.0f, 0.f}, up}, + {{ 0.0f, 0.0f, 0.f}, up}, + }; + const UINT num_vertices36 = ARRAY_SIZE(vertices36); + const UINT num_faces36 = ARRAY_SIZE(vertices36) / VERTS_PER_FACE; + const UINT vertex_size36 = sizeof(*vertices36); + const DWORD clone_options36 = options | D3DXMESH_VB_SHARE; /* Common mesh data */ ID3DXMesh *mesh = NULL; ID3DXMesh *mesh_clone = NULL; @@ -9278,7 +9289,8 @@ static void test_clone_mesh(void) const UINT num_vertices; const UINT num_faces; const UINT vertex_size; - const DWORD options; + const DWORD create_options; + const DWORD clone_options; D3DVERTEXELEMENT9 *declaration; D3DVERTEXELEMENT9 *new_declaration; const BYTE *exp_vertices; @@ -9294,6 +9306,7 @@ static void test_clone_mesh(void) num_faces0, vertex_size0, options, + options, declaration_pn, declaration_pn, (BYTE*)vertices0, @@ -9307,6 +9320,7 @@ static void test_clone_mesh(void) num_faces0, vertex_size0, options_16bit, + options_16bit, declaration_pn, declaration_pn, (BYTE*)vertices0, @@ -9320,6 +9334,7 @@ static void test_clone_mesh(void) num_faces0, vertex_size0, options, + options, declaration_pn, declaration_pntc, (BYTE*)exp_vertices2, @@ -9333,6 +9348,7 @@ static void test_clone_mesh(void) num_faces0, vertex_size0, options, + options, declaration_pn, declaration_ptcn, (BYTE*)exp_vertices3, @@ -9346,6 +9362,7 @@ static void test_clone_mesh(void) num_faces4, vertex_size4, options, + options, declaration_ptc, declaration_ptc_float16_2, (BYTE*)exp_vertices4, @@ -9359,6 +9376,7 @@ static void test_clone_mesh(void) num_faces5, vertex_size5, options, + options, declaration_ptc, declaration_ptc_float16_4, (BYTE*)exp_vertices5, @@ -9372,6 +9390,7 @@ static void test_clone_mesh(void) num_faces6, vertex_size6, options, + options, declaration_ptc, declaration_ptc_float1, (BYTE*)exp_vertices6, @@ -9385,6 +9404,7 @@ static void test_clone_mesh(void) num_faces7, vertex_size7, options, + options, declaration_ptc, declaration_ptc_float3, (BYTE*)exp_vertices7, @@ -9398,6 +9418,7 @@ static void test_clone_mesh(void) num_faces8, vertex_size8, options, + options, declaration_ptc, declaration_ptc_float4, (BYTE*)exp_vertices8, @@ -9411,6 +9432,7 @@ static void test_clone_mesh(void) num_faces9, vertex_size9, options, + options, declaration_ptc, declaration_ptc_d3dcolor, (BYTE*)exp_vertices9, @@ -9424,6 +9446,7 @@ static void test_clone_mesh(void) num_faces10, vertex_size10, options, + options, declaration_ptc, declaration_ptc_ubyte4, (BYTE*)exp_vertices10, @@ -9437,6 +9460,7 @@ static void test_clone_mesh(void) num_faces11, vertex_size11, options, + options, declaration_ptc, declaration_ptc_short2, (BYTE*)exp_vertices11, @@ -9450,6 +9474,7 @@ static void test_clone_mesh(void) num_faces12, vertex_size12, options, + options, declaration_ptc, declaration_ptc_short4, (BYTE*)exp_vertices12, @@ -9463,6 +9488,7 @@ static void test_clone_mesh(void) num_faces13, vertex_size13, options, + options, declaration_ptc, declaration_ptc_ubyte4n, (BYTE*)exp_vertices13, @@ -9476,6 +9502,7 @@ static void test_clone_mesh(void) num_faces14, vertex_size14, options, + options, declaration_ptc, declaration_ptc_short2n, (BYTE*)exp_vertices14, @@ -9489,6 +9516,7 @@ static void test_clone_mesh(void) num_faces15, vertex_size15, options, + options, declaration_ptc, declaration_ptc_short4n, (BYTE*)exp_vertices15, @@ -9502,6 +9530,7 @@ static void test_clone_mesh(void) num_faces16, vertex_size16, options, + options, declaration_ptc, declaration_ptc_ushort2n, (BYTE*)exp_vertices16, @@ -9515,6 +9544,7 @@ static void test_clone_mesh(void) num_faces17, vertex_size17, options, + options, declaration_ptc, declaration_ptc_ushort4n, (BYTE*)exp_vertices17, @@ -9528,6 +9558,7 @@ static void test_clone_mesh(void) num_faces18, vertex_size18, options, + options, declaration_ptc, declaration_ptc_float16_2_partialu, (BYTE*)exp_vertices18, @@ -9541,6 +9572,7 @@ static void test_clone_mesh(void) num_faces19, vertex_size19, options, + options, declaration_pntc, declaration_pntc1, (BYTE*)exp_vertices19, @@ -9554,6 +9586,7 @@ static void test_clone_mesh(void) num_faces20, vertex_size20, options, + options, declaration_pntc1, declaration_pntc, (BYTE*)exp_vertices20, @@ -9567,6 +9600,7 @@ static void test_clone_mesh(void) num_faces21, vertex_size21, options, + options, declaration_ptc_float1, declaration_ptc, (BYTE*)exp_vertices21, @@ -9580,6 +9614,7 @@ static void test_clone_mesh(void) num_faces22, vertex_size22, options, + options, declaration_ptc_float1, declaration_ptc_float3, (BYTE*)exp_vertices22, @@ -9593,6 +9628,7 @@ static void test_clone_mesh(void) num_faces23, vertex_size23, options, + options, declaration_ptc_float1, declaration_ptc_float4, (BYTE*)exp_vertices23, @@ -9606,6 +9642,7 @@ static void test_clone_mesh(void) num_faces24, vertex_size24, options, + options, declaration_ptc_float1, declaration_ptc_d3dcolor, (BYTE*)exp_vertices24, @@ -9619,6 +9656,7 @@ static void test_clone_mesh(void) num_faces25, vertex_size25, options, + options, declaration_ptc_float1, declaration_ptc_ubyte4, (BYTE*)exp_vertices25, @@ -9632,6 +9670,7 @@ static void test_clone_mesh(void) num_faces26, vertex_size26, options, + options, declaration_ptc_float4, declaration_ptc_d3dcolor, (BYTE*)exp_vertices26, @@ -9645,6 +9684,7 @@ static void test_clone_mesh(void) num_faces27, vertex_size27, options, + options, declaration_ptc_d3dcolor, declaration_ptc_float4, (BYTE*)exp_vertices27, @@ -9658,6 +9698,7 @@ static void test_clone_mesh(void) num_faces28, vertex_size28, options, + options, declaration_ptc_ubyte4, declaration_ptc_float4, (BYTE*)exp_vertices28, @@ -9671,6 +9712,7 @@ static void test_clone_mesh(void) num_faces29, vertex_size29, options, + options, declaration_ptc_short2, declaration_ptc_float4, (BYTE*)exp_vertices29, @@ -9684,6 +9726,7 @@ static void test_clone_mesh(void) num_faces30, vertex_size30, options, + options, declaration_ptc_short4, declaration_ptc_float4, (BYTE*)exp_vertices30, @@ -9697,6 +9740,7 @@ static void test_clone_mesh(void) num_faces31, vertex_size31, options, + options, declaration_ptc_ubyte4n, declaration_ptc_float4, (BYTE*)exp_vertices31, @@ -9710,6 +9754,7 @@ static void test_clone_mesh(void) num_faces32, vertex_size32, options, + options, declaration_ptc_short2n, declaration_ptc_float4, (BYTE*)exp_vertices32, @@ -9723,6 +9768,7 @@ static void test_clone_mesh(void) num_faces33, vertex_size33, options, + options, declaration_ptc_short4n, declaration_ptc_float4, (BYTE*)exp_vertices33, @@ -9736,6 +9782,7 @@ static void test_clone_mesh(void) num_faces34, vertex_size34, options, + options, declaration_ptc_float16_2, declaration_ptc_float4, (BYTE*)exp_vertices34, @@ -9749,11 +9796,26 @@ static void test_clone_mesh(void) num_faces35, vertex_size35, options, + options, declaration_ptc_float16_4, declaration_ptc_float4, (BYTE*)exp_vertices35, exp_vertex_size35 }, + { + (BYTE*)vertices36, + NULL, + NULL, + num_vertices36, + num_faces36, + vertex_size36, + options, + clone_options36, + declaration_pn, + declaration_pn, + (BYTE*)vertices36, + vertex_size36 + }, }; test_context = new_test_context(); @@ -9771,7 +9833,7 @@ static void test_clone_mesh(void) UINT exp_new_decl_size, new_decl_size; hr = init_test_mesh(tc[i].num_faces, tc[i].num_vertices, - tc[i].options, + tc[i].create_options, tc[i].declaration, test_context->device, &mesh, tc[i].vertices, tc[i].vertex_size, @@ -9782,7 +9844,7 @@ static void test_clone_mesh(void) goto cleanup; } - hr = mesh->lpVtbl->CloneMesh(mesh, tc[i].options, tc[i].new_declaration, + hr = mesh->lpVtbl->CloneMesh(mesh, tc[i].clone_options, tc[i].new_declaration, test_context->device, &mesh_clone); ok(hr == D3D_OK, "CloneMesh test case %d failed. Got %x\n, expected D3D_OK\n", i, hr);