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

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

parent 47ae7db1
......@@ -757,6 +757,50 @@ static void test_effect_parameter_value_GetFloat(const struct test_effect_parame
}
}
static void test_effect_parameter_value_GetFloatArray(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;
FLOAT favalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
HRESULT hr;
UINT l;
DWORD cmp = 0xabababab;
memset(favalue, 0xab, sizeof(favalue));
hr = effect->lpVtbl->GetFloatArray(effect, parameter, favalue, res_desc->Bytes / sizeof(*favalue));
if (res_desc->Class == D3DXPC_SCALAR
|| res_desc->Class == D3DXPC_VECTOR
|| res_desc->Class == D3DXPC_MATRIX_ROWS)
{
ok(hr == D3D_OK, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n", i, res_full_name, hr, D3D_OK);
for (l = 0; l < res_desc->Bytes / sizeof(*favalue); ++l)
{
ok(compare_float(favalue[l], get_float(res_desc->Type, &res_value[l]), 512),
"%u - %s: GetFloatArray favalue[%u] failed, got %f, expected %f\n",
i, res_full_name, l, favalue[l], get_float(res_desc->Type, &res_value[l]));
}
for (l = res_desc->Bytes / sizeof(*favalue); l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
{
ok(favalue[l] == *(FLOAT *)&cmp, "%u - %s: GetFloatArray favalue[%u] failed, got %f, expected %f\n",
i, res_full_name, l, favalue[l], *(FLOAT *)&cmp);
}
}
else
{
ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetFloatArray failed, got %#x, expected %#x\n",
i, res_full_name, hr, D3DERR_INVALIDCALL);
for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
{
ok(favalue[l] == *(FLOAT *)&cmp, "%u - %s: GetFloatArray favalue[%u] failed, got %f, expected %f\n",
i, res_full_name, l, favalue[l], *(FLOAT *)&cmp);
}
}
}
static void test_effect_parameter_value(IDirect3DDevice9 *device)
{
UINT i;
......@@ -832,6 +876,7 @@ static void test_effect_parameter_value(IDirect3DDevice9 *device)
test_effect_parameter_value_GetInt(&res[k], effect, &blob[res_value_offset], parameter, i);
test_effect_parameter_value_GetIntArray(&res[k], effect, &blob[res_value_offset], parameter, i);
test_effect_parameter_value_GetFloat(&res[k], effect, &blob[res_value_offset], parameter, i);
test_effect_parameter_value_GetFloatArray(&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