d3dx9: Fix ID3DXConstantTable::GetConstantElement() for structs.

This commit is contained in:
Rico Schüller 2012-09-04 09:44:28 +02:00 committed by Alexandre Julliard
parent c5a72379a1
commit b999ab16b3
2 changed files with 7 additions and 1 deletions

View File

@ -1009,7 +1009,7 @@ static D3DXHANDLE WINAPI ID3DXConstantTableImpl_GetConstantElement(ID3DXConstant
if (c && index < c->desc.Elements)
{
if (c->constants) c = &c->constants[index];
if (c->desc.Elements > 1) c = &c->constants[index];
TRACE("Returning constant %p\n", c);
return handle_from_constant(c);
}

View File

@ -1848,6 +1848,12 @@ static void test_get_shader_constant_variables(void)
element = ID3DXConstantTable_GetConstantByName(ctable, "s_2[0]", "invalid");
ok(element == NULL, "GetConstantByName failed\n");
constant = ID3DXConstantTable_GetConstantByName(ctable, NULL, "s_2[0]");
ok(constant != NULL, "GetConstantByName failed\n");
element = ID3DXConstantTable_GetConstantElement(ctable, "s_2[0]", 0);
ok(constant == element, "GetConstantByName failed, got %p, expected %p\n", element, constant);
count = ID3DXConstantTable_Release(ctable);
ok(count == 0, "Release failed, got %u, expected %u\n", count, 0);
}