d3d: D3DDECLTYPE_UNUSED is not valid in vertex declarations.
This commit is contained in:
parent
b127647b96
commit
b554cdbb5a
|
@ -786,6 +786,60 @@ static void test_vertex_declaration_alignment(
|
|||
}
|
||||
}
|
||||
|
||||
static void test_unused_type(
|
||||
IDirect3DDevice9* device) {
|
||||
|
||||
HRESULT hr;
|
||||
IDirect3DVertexDeclaration9* result_decl = NULL;
|
||||
int i;
|
||||
|
||||
static const D3DVERTEXELEMENT9 test_elements[][3] =
|
||||
{
|
||||
{
|
||||
{ 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_POSITION, 0 },
|
||||
{ 0, 16, D3DDECLTYPE_UNUSED, 0, D3DDECLUSAGE_COLOR , 0 },
|
||||
D3DDECL_END()
|
||||
},
|
||||
{
|
||||
{ 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_POSITION, 0 },
|
||||
{ 0, 16, D3DDECLTYPE_UNUSED, 0, D3DDECLUSAGE_TEXCOORD, 0 },
|
||||
D3DDECL_END()
|
||||
},
|
||||
{
|
||||
{ 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_POSITION, 0 },
|
||||
{ 0, 16, D3DDECLTYPE_UNUSED, 0, D3DDECLUSAGE_TEXCOORD, 1 },
|
||||
D3DDECL_END()
|
||||
},
|
||||
{
|
||||
{ 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_POSITION, 0 },
|
||||
{ 0, 16, D3DDECLTYPE_UNUSED, 0, D3DDECLUSAGE_TEXCOORD, 12},
|
||||
D3DDECL_END()
|
||||
},
|
||||
{
|
||||
{ 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_POSITION, 0 },
|
||||
{ 1, 16, D3DDECLTYPE_UNUSED, 0, D3DDECLUSAGE_TEXCOORD, 12},
|
||||
D3DDECL_END()
|
||||
},
|
||||
{
|
||||
{ 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_POSITION, 0 },
|
||||
{ 0, 16, D3DDECLTYPE_UNUSED, 0, D3DDECLUSAGE_NORMAL, 0 },
|
||||
D3DDECL_END()
|
||||
},
|
||||
{
|
||||
{ 0, 0, D3DDECLTYPE_FLOAT3, 0, D3DDECLUSAGE_POSITION, 0 },
|
||||
{ 1, 16, D3DDECLTYPE_UNUSED, 0, D3DDECLUSAGE_NORMAL, 0 },
|
||||
D3DDECL_END()
|
||||
},
|
||||
};
|
||||
|
||||
for(i = 0; i < sizeof(test_elements) / sizeof(test_elements[0]); i++) {
|
||||
result_decl = NULL;
|
||||
hr = IDirect3DDevice9_CreateVertexDeclaration(device, test_elements[i], &result_decl);
|
||||
ok(hr == E_FAIL, "CreateVertexDeclaration for declaration %d returned %#x, expected E_FAIL(%#x)\n",
|
||||
i, hr, E_FAIL);
|
||||
if(result_decl) IDirect3DVertexDeclaration9_Release(result_decl);
|
||||
}
|
||||
}
|
||||
START_TEST(vertexdeclaration)
|
||||
{
|
||||
static D3DVERTEXELEMENT9 simple_decl[] = {
|
||||
|
@ -821,4 +875,5 @@ START_TEST(vertexdeclaration)
|
|||
test_fvf_decl_conversion(device_ptr);
|
||||
test_fvf_decl_management(device_ptr);
|
||||
test_vertex_declaration_alignment(device_ptr);
|
||||
test_unused_type(device_ptr);
|
||||
}
|
||||
|
|
|
@ -159,6 +159,12 @@ static HRESULT WINAPI IWineD3DVertexDeclarationImpl_SetDeclaration(IWineD3DVerte
|
|||
*/
|
||||
if(This->pDeclarationWine[i].Stream >= MAX_STREAMS) continue;
|
||||
|
||||
if(This->pDeclarationWine[i].Type == WINED3DDECLTYPE_UNUSED) {
|
||||
WARN("The application tries to use WINED3DDECLTYPE_UNUSED, returning E_FAIL\n");
|
||||
/* The caller will release the vdecl, which will free This->pDeclarationWine */
|
||||
return E_FAIL;
|
||||
}
|
||||
|
||||
if(This->pDeclarationWine[i].Offset & 0x3) {
|
||||
WARN("Declaration element %d is not 4 byte aligned(%d), returning E_FAIL\n", i, This->pDeclarationWine[i].Offset);
|
||||
HeapFree(GetProcessHeap(), 0, This->pDeclarationWine);
|
||||
|
|
Loading…
Reference in New Issue