d3dx9_36: Implement D3DXGetDeclLength with tests.
This commit is contained in:
parent
c6f876f4a6
commit
fffe37aa00
|
@ -147,7 +147,7 @@
|
|||
@ stub D3DXGatherFragmentsFromResourceW
|
||||
@ stub D3DXGenerateOutputDecl
|
||||
@ stub D3DXGeneratePMesh
|
||||
@ stub D3DXGetDeclLength
|
||||
@ stdcall D3DXGetDeclLength(ptr)
|
||||
@ stdcall D3DXGetDeclVertexSize(ptr long)
|
||||
@ stdcall D3DXGetDriverLevel(ptr)
|
||||
@ stdcall D3DXGetFVFVertexSize(long)
|
||||
|
|
|
@ -520,6 +520,22 @@ UINT WINAPI D3DXGetDeclVertexSize(const D3DVERTEXELEMENT9 *decl, DWORD stream_id
|
|||
return size;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* D3DXGetDeclLength
|
||||
*/
|
||||
UINT WINAPI D3DXGetDeclLength(const D3DVERTEXELEMENT9 *decl)
|
||||
{
|
||||
const D3DVERTEXELEMENT9 *element;
|
||||
|
||||
TRACE("decl %p\n", decl);
|
||||
|
||||
/* null decl results in exception on Windows XP */
|
||||
|
||||
for (element = decl; element->Stream != 0xff; ++element);
|
||||
|
||||
return element - decl;
|
||||
}
|
||||
|
||||
/*************************************************************************
|
||||
* D3DXIntersectTri
|
||||
*/
|
||||
|
|
|
@ -1407,6 +1407,56 @@ static void D3DXCreateSphereTest(void)
|
|||
DestroyWindow(wnd);
|
||||
}
|
||||
|
||||
static void test_get_decl_length(void)
|
||||
{
|
||||
static const D3DVERTEXELEMENT9 declaration1[] =
|
||||
{
|
||||
{0, 0, D3DDECLTYPE_FLOAT1, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{1, 0, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{2, 0, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{3, 0, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{4, 0, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{5, 0, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{6, 0, D3DDECLTYPE_SHORT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{7, 0, D3DDECLTYPE_SHORT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{8, 0, D3DDECLTYPE_UBYTE4N, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{9, 0, D3DDECLTYPE_SHORT2N, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{10, 0, D3DDECLTYPE_SHORT4N, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{11, 0, D3DDECLTYPE_UDEC3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{12, 0, D3DDECLTYPE_DEC3N, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{13, 0, D3DDECLTYPE_FLOAT16_2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{14, 0, D3DDECLTYPE_FLOAT16_4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
D3DDECL_END(),
|
||||
};
|
||||
static const D3DVERTEXELEMENT9 declaration2[] =
|
||||
{
|
||||
{0, 8, D3DDECLTYPE_FLOAT1, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{1, 8, D3DDECLTYPE_FLOAT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{2, 8, D3DDECLTYPE_FLOAT3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{3, 8, D3DDECLTYPE_FLOAT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{4, 8, D3DDECLTYPE_D3DCOLOR, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{5, 8, D3DDECLTYPE_UBYTE4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{6, 8, D3DDECLTYPE_SHORT2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{7, 8, D3DDECLTYPE_SHORT4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{0, 8, D3DDECLTYPE_UBYTE4N, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{1, 8, D3DDECLTYPE_SHORT2N, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{2, 8, D3DDECLTYPE_SHORT4N, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{3, 8, D3DDECLTYPE_UDEC3, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{4, 8, D3DDECLTYPE_DEC3N, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{5, 8, D3DDECLTYPE_FLOAT16_2, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{6, 8, D3DDECLTYPE_FLOAT16_4, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
{7, 8, D3DDECLTYPE_FLOAT1, D3DDECLMETHOD_DEFAULT, D3DDECLUSAGE_POSITION, 0},
|
||||
D3DDECL_END(),
|
||||
};
|
||||
UINT size;
|
||||
|
||||
size = D3DXGetDeclLength(declaration1);
|
||||
ok(size == 15, "Got size %u, expected 15.\n", size);
|
||||
|
||||
size = D3DXGetDeclLength(declaration2);
|
||||
ok(size == 16, "Got size %u, expected 16.\n", size);
|
||||
}
|
||||
|
||||
static void test_get_decl_vertex_size(void)
|
||||
{
|
||||
static const D3DVERTEXELEMENT9 declaration1[] =
|
||||
|
@ -1488,6 +1538,7 @@ START_TEST(mesh)
|
|||
D3DXIntersectTriTest();
|
||||
D3DXCreateMeshTest();
|
||||
D3DXCreateSphereTest();
|
||||
test_get_decl_length();
|
||||
test_get_decl_vertex_size();
|
||||
test_fvf_decl_conversion();
|
||||
}
|
||||
|
|
|
@ -152,6 +152,7 @@ extern "C" {
|
|||
|
||||
HRESULT WINAPI D3DXCreateMesh(DWORD, DWORD, DWORD, CONST D3DVERTEXELEMENT9 *, LPDIRECT3DDEVICE9, LPD3DXMESH *);
|
||||
HRESULT WINAPI D3DXCreateBuffer(DWORD, LPD3DXBUFFER*);
|
||||
UINT WINAPI D3DXGetDeclLength(const D3DVERTEXELEMENT9 *decl);
|
||||
UINT WINAPI D3DXGetDeclVertexSize(const D3DVERTEXELEMENT9 *decl, DWORD stream_idx);
|
||||
UINT WINAPI D3DXGetFVFVertexSize(DWORD);
|
||||
BOOL WINAPI D3DXBoxBoundProbe(CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *, CONST D3DXVECTOR3 *);
|
||||
|
|
Loading…
Reference in New Issue