[2/5] d3dx9: Implement GetNumBytesPerVertex using the vertex declaration.
Dylan Smith
dylan.ah.smith at gmail.com
Wed Apr 27 17:11:58 CDT 2011
If a declaration without a corresponding FVF is used to create the mesh,
then its declaration must be used to get the vertex size. Previously 0
was returned in this case, which the included test confirms is not the
native behaviour.
---
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);
}
--
1.7.2.5
More information about the wine-patches
mailing list