Dylan Smith : d3dx9: D3DXCreateMesh rejects declarations with non-zero streams.
Alexandre Julliard
julliard at winehq.org
Thu Apr 28 12:18:52 CDT 2011
Module: wine
Branch: master
Commit: 96d5d06f2bbe39e189a183f22298ec6c0474ff35
URL: http://source.winehq.org/git/wine.git/?a=commit;h=96d5d06f2bbe39e189a183f22298ec6c0474ff35
Author: Dylan Smith <dylan.ah.smith at gmail.com>
Date: Wed Apr 27 18:11:48 2011 -0400
d3dx9: D3DXCreateMesh rejects declarations with non-zero streams.
---
dlls/d3dx9_36/mesh.c | 4 ++++
dlls/d3dx9_36/tests/mesh.c | 10 ++++++++++
2 files changed, 14 insertions(+), 0 deletions(-)
diff --git a/dlls/d3dx9_36/mesh.c b/dlls/d3dx9_36/mesh.c
index abcdcc8..432db1d 100644
--- a/dlls/d3dx9_36/mesh.c
+++ b/dlls/d3dx9_36/mesh.c
@@ -1132,6 +1132,7 @@ HRESULT WINAPI D3DXCreateMesh(DWORD numfaces, DWORD numvertices, DWORD options,
D3DFORMAT index_format = D3DFMT_INDEX16;
DWORD vertex_usage = 0;
D3DPOOL vertex_pool = D3DPOOL_DEFAULT;
+ int i;
TRACE("(%d, %d, %x, %p, %p, %p)\n", numfaces, numvertices, options, declaration, device, mesh);
@@ -1141,6 +1142,9 @@ HRESULT WINAPI D3DXCreateMesh(DWORD numfaces, DWORD numvertices, DWORD options,
{
return D3DERR_INVALIDCALL;
}
+ for (i = 0; declaration[i].Stream != 0xff; i++)
+ if (declaration[i].Stream != 0)
+ return D3DERR_INVALIDCALL;
if (options & D3DXMESH_32BIT)
index_format = D3DFMT_INDEX32;
diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c
index 570e186..88ac59c 100644
--- a/dlls/d3dx9_36/tests/mesh.c
+++ b/dlls/d3dx9_36/tests/mesh.c
@@ -1036,6 +1036,12 @@ static void D3DXCreateMeshTest(void)
D3DDECL_END(),
};
+ static const D3DVERTEXELEMENT9 decl3[] = {
+ {0, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
+ {1, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_NORMAL, 0},
+ D3DDECL_END(),
+ };
+
hr = D3DXCreateMesh(0, 0, 0, NULL, NULL, NULL);
ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
@@ -1213,6 +1219,10 @@ static void D3DXCreateMeshTest(void)
d3dxmesh->lpVtbl->Release(d3dxmesh);
}
+ /* Test a declaration with multiple streams. */
+ hr = D3DXCreateMesh(1, 3, D3DXMESH_MANAGED, decl3, device, &d3dxmesh);
+ ok(hr == D3DERR_INVALIDCALL, "Got result %x, expected %x (D3DERR_INVALIDCALL)\n", hr, D3DERR_INVALIDCALL);
+
IDirect3DDevice9_Release(device);
IDirect3D9_Release(d3d);
DestroyWindow(wnd);
More information about the wine-cvs
mailing list