>From 03180708b36aab9efd566c8971da7b60924500bf Mon Sep 17 00:00:00 2001 From: Misha Koshelev Date: Wed, 7 Jul 2010 09:59:52 -0500 Subject: d3dx9: Test number of vertices for D3DXCreateSphere, retrieve vertex buffer. To: wine-patches Reply-To: wine-devel --- dlls/d3dx9_36/tests/mesh.c | 22 ++++++++++++++++++++++ 1 files changed, 22 insertions(+), 0 deletions(-) diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c index f3a629d..b747761 100644 --- a/dlls/d3dx9_36/tests/mesh.c +++ b/dlls/d3dx9_36/tests/mesh.c @@ -487,6 +487,9 @@ static void D3DXCreateSphereTest(void) IDirect3DDevice9* device; D3DPRESENT_PARAMETERS d3dpp; ID3DXMesh* sphere = NULL; + DWORD number_of_vertices; + IDirect3DVertexBuffer9* vertex_buffer = NULL; + BYTE* vertex_data = NULL; hr = D3DXCreateSphere(NULL, 0.0f, 0, 0, NULL, NULL); todo_wine ok( hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n",hr,D3DERR_INVALIDCALL); @@ -533,7 +536,26 @@ static void D3DXCreateSphereTest(void) todo_wine ok( hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n",hr); if (sphere) + { + number_of_vertices = sphere->lpVtbl->GetNumVertices(sphere); + todo_wine ok( number_of_vertices == 4, "Got result %u, expected 4\n",number_of_vertices); + + hr = sphere->lpVtbl->GetVertexBuffer(sphere, &vertex_buffer); + todo_wine ok( hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n",hr); + + if (vertex_buffer) + { + /* Specify offset and size to avoid potential overruns */ + hr = IDirect3DVertexBuffer9_Lock(vertex_buffer, 0, number_of_vertices * sizeof(D3DXVECTOR3) * 2, (LPVOID *)&vertex_data, D3DLOCK_DISCARD); + todo_wine ok( hr == D3D_OK, "Got result %x, expected 0 (D3D_OK)\n",hr); + + IDirect3DVertexBuffer9_Unlock(vertex_buffer); + + IDirect3DVertexBuffer9_Release(vertex_buffer); + } + sphere->lpVtbl->Release(sphere); + } IDirect3DDevice9_Release(device); IDirect3D9_Release(d3d); -- 1.7.1