Commit b999ab16 authored by Rico Schüller's avatar Rico Schüller Committed by Alexandre Julliard

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

parent c5a72379
......@@ -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);
}
......
......@@ -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);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment