Dylan Smith : d3dx9: Implement GetNumBytesPerVertex using the vertex declaration.

Alexandre Julliard julliard at winehq.org
Thu Apr 28 12:18:53 CDT 2011


Module: wine
Branch: master
Commit: b2dac1df27a773ab4d63f92aa3248b97e1e56076
URL:    http://source.winehq.org/git/wine.git/?a=commit;h=b2dac1df27a773ab4d63f92aa3248b97e1e56076

Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date:   Wed Apr 27 18:11:58 2011 -0400

d3dx9: Implement GetNumBytesPerVertex using the vertex declaration.

If a declaration without a corresponding FVF is used to create the mesh,
then its declaration must be used to get the vertex size.

---

 dlls/d3dx9_36/mesh.c       |    7 ++++++-
 dlls/d3dx9_36/tests/mesh.c |    3 +++
 2 files changed, 9 insertions(+), 1 deletions(-)

diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c
index 432db1d..404f447 100644
--- a/dlls/d3dx9_36/mesh.c
+++ b/dlls/d3dx9_36/mesh.c
@@ -157,10 +157,15 @@ static HRESULT WINAPI ID3DXMeshImpl_GetDeclaration(ID3DXMesh *iface, D3DVERTEXEL
 static DWORD WINAPI ID3DXMeshImpl_GetNumBytesPerVertex(ID3DXMesh *iface)
 {
     ID3DXMeshImpl *This = impl_from_ID3DXMesh(iface);
+    UINT numelements;
+    D3DVERTEXELEMENT9 declaration[MAX_FVF_DECL_SIZE] = { D3DDECL_END() };
 
     TRACE("iface (%p)\n", This);
 
-    return D3DXGetFVFVertexSize(This->fvf);
+    IDirect3DVertexDeclaration9_GetDeclaration(This->vertex_declaration,
+                                               declaration,
+                                               &numelements);
+    return D3DXGetDeclVertexSize(declaration, 0);
 }
 
 static DWORD WINAPI ID3DXMeshImpl_GetOptions(ID3DXMesh *iface)
diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c
index 88ac59c..bde8595 100644
--- a/dlls/d3dx9_36/tests/mesh.c
+++ b/dlls/d3dx9_36/tests/mesh.c
@@ -1216,6 +1216,9 @@ static void D3DXCreateMeshTest(void)
             free_mesh(&mesh);
         }
 
+        mesh.vertex_size = d3dxmesh->lpVtbl->GetNumBytesPerVertex(d3dxmesh);
+        ok(mesh.vertex_size == 60, "Got vertex size %u, expected %u\n", mesh.vertex_size, 60);
+
         d3dxmesh->lpVtbl->Release(d3dxmesh);
     }
 




More information about the wine-cvs mailing list