d3dx9: D3DXCreateMesh rejects declarations with non-zero streams.
This commit is contained in:
parent
c5baf8f237
commit
96d5d06f2b
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in New Issue