diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c index a13dc708726..ea90299f936 100644 --- a/dlls/d3dx9_36/tests/effect.c +++ b/dlls/d3dx9_36/tests/effect.c @@ -1475,16 +1475,16 @@ static void test_effect_parameter_value_GetMatrixPointerArray(const struct test_ float f[sizeof(D3DXMATRIX) / sizeof(float)]; D3DXMATRIX m; } fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE * sizeof(float) / sizeof(D3DXMATRIX)]; + D3DXMATRIX *matrix_pointer_array[ARRAY_SIZE(fvalue)]; const D3DXPARAMETER_DESC *res_desc = &res->desc; const char *res_full_name = res->full_name; - HRESULT hr; - D3DXMATRIX *matrix_pointer_array[ARRAY_SIZE(fvalue)]; UINT l, k, m, element, err = 0; union { DWORD d; float f; } cmp = {0xabababab}; + HRESULT hr; for (element = 0; element <= res_desc->Elements + 1; ++element) { @@ -1670,20 +1670,28 @@ static void test_effect_parameter_value_GetMatrixTransposeArray(const struct tes static void test_effect_parameter_value_GetMatrixTransposePointerArray(const struct test_effect_parameter_value_result *res, ID3DXEffect *effect, const DWORD *res_value, D3DXHANDLE parameter, UINT i) { + union + { + float f[sizeof(D3DXMATRIX) / sizeof(float)]; + D3DXMATRIX m; + } fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE * sizeof(float) / sizeof(D3DXMATRIX)]; + D3DXMATRIX *matrix_pointer_array[sizeof(fvalue)]; const D3DXPARAMETER_DESC *res_desc = &res->desc; const char *res_full_name = res->full_name; - HRESULT hr; - DWORD cmp = 0xabababab; - FLOAT fvalue[EFFECT_PARAMETER_VALUE_ARRAY_SIZE]; - D3DXMATRIX *matrix_pointer_array[sizeof(fvalue)/sizeof(D3DXMATRIX)]; UINT l, k, m, element, err = 0; + union + { + DWORD d; + float f; + } cmp = {0xabababab}; + HRESULT hr; for (element = 0; element <= res_desc->Elements + 1; ++element) { memset(fvalue, 0xab, sizeof(fvalue)); for (l = 0; l < element; ++l) { - matrix_pointer_array[l] = (D3DXMATRIX *)&fvalue[l * sizeof(**matrix_pointer_array) / sizeof(FLOAT)]; + matrix_pointer_array[l] = &fvalue[l].m; } hr = effect->lpVtbl->GetMatrixTransposePointerArray(effect, parameter, matrix_pointer_array, element); if (!element) @@ -1691,7 +1699,10 @@ static void test_effect_parameter_value_GetMatrixTransposePointerArray(const str ok(hr == D3D_OK, "%u - %s[%u]: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n", i, res_full_name, element, hr, D3D_OK); - for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err; + for (m = 0; m < ARRAY_SIZE(fvalue); ++m) + for (l = 0; l < ARRAY_SIZE(fvalue[m].f); ++l) + if (fvalue[m].f[l] != cmp.f) + ++err; } else if (element <= res_desc->Elements && res_desc->Class == D3DXPC_MATRIX_ROWS) { @@ -1706,23 +1717,30 @@ static void test_effect_parameter_value_GetMatrixTransposePointerArray(const str { if (k < res_desc->Columns && l < res_desc->Rows) { - if (!compare_float(fvalue[m * 16 + l + k * 4], get_float(res_desc->Type, + if (!compare_float(fvalue[m].m.m[k][l], get_float(res_desc->Type, &res_value[m * res_desc->Columns * res_desc->Rows + l * res_desc->Columns + k]), 512)) ++err; } - else if (fvalue[m * 16 + l + k * 4] != 0.0f) ++err; + else if (fvalue[m].m.m[k][l] != 0.0f) + ++err; } } } - for (l = element * 16; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err; + for (m = element; m < ARRAY_SIZE(fvalue); ++m) + for (l = 0; l < ARRAY_SIZE(fvalue[m].f); ++l) + if (fvalue[m].f[l] != cmp.f) + ++err; } else { ok(hr == D3DERR_INVALIDCALL, "%u - %s[%u]: GetMatrixTransposePointerArray failed, got %#x, expected %#x\n", i, res_full_name, element, hr, D3DERR_INVALIDCALL); - for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err; + for (m = 0; m < ARRAY_SIZE(fvalue); ++m) + for (l = 0; l < ARRAY_SIZE(fvalue[m].f); ++l) + if (fvalue[m].f[l] != cmp.f) + ++err; } ok(!err, "%u - %s[%u]: GetMatrixTransposePointerArray failed with %u errors\n", i, res_full_name, element, err); }