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

d3dx9/tests: Add effect parameter value GetMatrix() test.

parent a8f32acf
......@@ -920,6 +920,54 @@ static void test_effect_parameter_value_GetVectorArray(const struct test_effect_
}
}
static void test_effect_parameter_value_GetMatrix(const struct test_effect_parameter_value_result *res,
ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i)
{
const D3DXPARAMETER_DESC *res_desc = &res->desc;
LPCSTR res_full_name = res->full_name;
HRESULT hr;
DWORD cmp = 0xabababab;
FLOAT fvalue[16];
UINT l, k;
memset(fvalue, 0xab, sizeof(fvalue));
hr = effect->lpVtbl->GetMatrix(effect, parameter, (D3DXMATRIX *)&fvalue);
if (!res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS)
{
ok(hr == D3D_OK, "%u - %s: GetMatrix failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
for (k = 0; k < 4; ++k)
{
for (l = 0; l < 4; ++l)
{
if (k < res_desc->Columns && l < res_desc->Rows)
{
ok(compare_float(fvalue[l * 4 + k], get_float(res_desc->Type, &res_value[l * res_desc->Columns + k]), 512),
"%u - %s: GetMatrix fvalue[%u] failed, got %f, expected %f\n",
i, res_full_name, l * 4 + k, fvalue[l * 4 + k],
get_float(res_desc->Type, &res_value[l * res_desc->Columns + k]));
}
else
{
ok(fvalue[l * 4 + k] == 0.0f, "%u - %s: GetMatrix fvalue[%u] failed, got %f, expected %f\n",
i, res_full_name, l * 4 + k, fvalue[l * 4 + k], 0.0f);
}
}
}
}
else
{
ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrix failed, got %#x, expected %#x\n",
i, res_full_name, hr, D3DERR_INVALIDCALL);
for (l = 0; l < sizeof(fvalue) / sizeof(*fvalue); ++l)
{
ok(fvalue[l] == *(FLOAT *)&cmp, "%u - %s: GetMatrix fvalue[%u] failed, got %f, expected %f\n",
i, res_full_name, l, fvalue[l], *(FLOAT *)&cmp);
}
}
}
static void test_effect_parameter_value(IDirect3DDevice9 *device)
{
UINT i;
......@@ -998,6 +1046,7 @@ static void test_effect_parameter_value(IDirect3DDevice9 *device)
test_effect_parameter_value_GetFloatArray(&res[k], effect, &blob[res_value_offset], parameter, i);
test_effect_parameter_value_GetVector(&res[k], effect, &blob[res_value_offset], parameter, i);
test_effect_parameter_value_GetVectorArray(&res[k], effect, &blob[res_value_offset], parameter, i);
test_effect_parameter_value_GetMatrix(&res[k], effect, &blob[res_value_offset], parameter, i);
}
count = effect->lpVtbl->Release(effect);
......
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