[PATCH 01/10] d3dx9: Test number of vertices for D3DXCreateSphere, retrieve vertex buffer. (try 2)

Misha Koshelev misha680 at gmail.com
Sat Jul 17 14:13:24 CDT 2010


Sorry for resend - caught minor error.

Apparently 0.0f dimensions _are_ allowed for D3DXCreateBox.

Misha
---
 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







More information about the wine-patches mailing list