d3dx9/tests: Add effect parameter value SetMatrixPointerArray() test.
This commit is contained in:
parent
929c669b4f
commit
1ae494a9bb
|
@ -885,6 +885,7 @@ test_effect_parameter_value_data[] =
|
|||
|
||||
#undef ADD_PARAMETER_VALUE
|
||||
|
||||
/* Multiple of 16 to cover complete matrices */
|
||||
#define EFFECT_PARAMETER_VALUE_ARRAY_SIZE 48
|
||||
/* Constants for special INT/FLOAT conversation */
|
||||
#define INT_FLOAT_MULTI 255.0f
|
||||
|
@ -1640,7 +1641,8 @@ static void test_effect_parameter_value(IDirect3DDevice9 *device)
|
|||
FLOAT fvalue;
|
||||
DWORD input_value[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
|
||||
DWORD expected_value[EFFECT_PARAMETER_VALUE_ARRAY_SIZE];
|
||||
UINT l, element;
|
||||
UINT l, n, m, element;
|
||||
const D3DXMATRIX *matrix_pointer_array[sizeof(input_value)/sizeof(D3DXMATRIX)];
|
||||
|
||||
parameter = effect->lpVtbl->GetParameterByName(effect, NULL, res_full_name);
|
||||
ok(parameter != NULL, "%u - %s: GetParameterByName failed\n", i, res_full_name);
|
||||
|
@ -1693,6 +1695,7 @@ static void test_effect_parameter_value(IDirect3DDevice9 *device)
|
|||
* effect->lpVtbl->SetMatrix(effect, parameter, NULL);
|
||||
* effect->lpVtbl->GetMatrix(effect, parameter, NULL);
|
||||
* effect->lpVtbl->SetMatrixArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
|
||||
* effect->lpVtbl->SetMatrixPointerArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
|
||||
* effect->lpVtbl->SetMatrixTranspose(effect, parameter, NULL);
|
||||
* effect->lpVtbl->SetMatrixTransposeArray(effect, parameter, NULL, res_desc->Elements ? res_desc->Elements : 1);
|
||||
* effect->lpVtbl->GetValue(effect, parameter, NULL, res_desc->Bytes);
|
||||
|
@ -1814,6 +1817,14 @@ static void test_effect_parameter_value(IDirect3DDevice9 *device)
|
|||
ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixArray failed, got %#x, expected %#x\n",
|
||||
i, res_full_name, hr, D3DERR_INVALIDCALL);
|
||||
|
||||
hr = effect->lpVtbl->SetMatrixPointerArray(effect, NULL, matrix_pointer_array, res_desc->Elements ? res_desc->Elements : 1);
|
||||
ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
|
||||
i, res_full_name, hr, D3DERR_INVALIDCALL);
|
||||
|
||||
hr = effect->lpVtbl->SetMatrixPointerArray(effect, NULL, matrix_pointer_array, 0);
|
||||
ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
|
||||
i, res_full_name, hr, D3DERR_INVALIDCALL);
|
||||
|
||||
hr = effect->lpVtbl->SetMatrixTranspose(effect, NULL, (D3DXMATRIX *)input_value);
|
||||
ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixTranspose failed, got %#x, expected %#x\n",
|
||||
i, res_full_name, hr, D3DERR_INVALIDCALL);
|
||||
|
@ -2054,8 +2065,6 @@ static void test_effect_parameter_value(IDirect3DDevice9 *device)
|
|||
hr = effect->lpVtbl->SetVectorArray(effect, parameter, (D3DXVECTOR4 *)input_value, element);
|
||||
if (res_desc->Elements && res_desc->Class == D3DXPC_VECTOR && element <= res_desc->Elements)
|
||||
{
|
||||
UINT m;
|
||||
|
||||
for (m = 0; m < element; ++m)
|
||||
{
|
||||
for (l = 0; l < res_desc->Columns; ++l)
|
||||
|
@ -2087,8 +2096,6 @@ static void test_effect_parameter_value(IDirect3DDevice9 *device)
|
|||
{
|
||||
for (l = 0; l < 4; ++l)
|
||||
{
|
||||
UINT m;
|
||||
|
||||
for (m = 0; m < 4; ++m)
|
||||
{
|
||||
if (m < res_desc->Rows && l < res_desc->Columns)
|
||||
|
@ -2120,14 +2127,10 @@ static void test_effect_parameter_value(IDirect3DDevice9 *device)
|
|||
hr = effect->lpVtbl->SetMatrixArray(effect, parameter, (D3DXMATRIX *)input_value, element);
|
||||
if (res_desc->Class == D3DXPC_MATRIX_ROWS && element <= res_desc->Elements)
|
||||
{
|
||||
UINT n;
|
||||
|
||||
for (n = 0; n < element; ++n)
|
||||
{
|
||||
for (l = 0; l < 4; ++l)
|
||||
{
|
||||
UINT m;
|
||||
|
||||
for (m = 0; m < 4; ++m)
|
||||
{
|
||||
if (m < res_desc->Rows && l < res_desc->Columns)
|
||||
|
@ -2148,6 +2151,48 @@ static void test_effect_parameter_value(IDirect3DDevice9 *device)
|
|||
test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
|
||||
}
|
||||
|
||||
/* SetMatrixPointerArray */
|
||||
for (element = 0; element < res_desc->Elements + 1; ++element)
|
||||
{
|
||||
fvalue = 1.33;
|
||||
for (l = 0; l < EFFECT_PARAMETER_VALUE_ARRAY_SIZE; ++l)
|
||||
{
|
||||
*(input_value + l) = *(DWORD *)&fvalue;
|
||||
fvalue += 1.12;
|
||||
}
|
||||
memcpy(expected_value, &blob[res_value_offset], res_desc->Bytes);
|
||||
for (l = 0; l < element; ++l)
|
||||
{
|
||||
matrix_pointer_array[l] = (D3DXMATRIX *)&input_value[l * sizeof(**matrix_pointer_array) / sizeof(*matrix_pointer_array)];
|
||||
}
|
||||
hr = effect->lpVtbl->SetMatrixPointerArray(effect, parameter, matrix_pointer_array, element);
|
||||
if (res_desc->Class == D3DXPC_MATRIX_ROWS && res_desc->Elements >= element)
|
||||
{
|
||||
for (n = 0; n < element; ++n)
|
||||
{
|
||||
for (l = 0; l < 4; ++l)
|
||||
{
|
||||
for (m = 0; m < 4; ++m)
|
||||
{
|
||||
if (m < res_desc->Rows && l < res_desc->Columns)
|
||||
set_number(expected_value + l + m * res_desc->Columns + n * res_desc->Columns * res_desc->Rows,
|
||||
res_desc->Type, input_value + l + m * 4 + n * 16, D3DXPT_FLOAT);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
ok(hr == D3D_OK, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
|
||||
i, res_full_name, hr, D3D_OK);
|
||||
}
|
||||
else
|
||||
{
|
||||
ok(hr == D3DERR_INVALIDCALL, "%u - %s: SetMatrixPointerArray failed, got %#x, expected %#x\n",
|
||||
i, res_full_name, hr, D3DERR_INVALIDCALL);
|
||||
}
|
||||
test_effect_parameter_value_GetTestGroup(&res[k], effect, expected_value, parameter, i);
|
||||
test_effect_parameter_value_ResetValue(&res[k], effect, &blob[res_value_offset], parameter, i);
|
||||
}
|
||||
|
||||
/* SetMatrixTranspose */
|
||||
fvalue = 1.33;
|
||||
for (l = 0; l < 16; ++l)
|
||||
|
@ -2161,8 +2206,6 @@ static void test_effect_parameter_value(IDirect3DDevice9 *device)
|
|||
{
|
||||
for (l = 0; l < 4; ++l)
|
||||
{
|
||||
UINT m;
|
||||
|
||||
for (m = 0; m < 4; ++m)
|
||||
{
|
||||
if (m < res_desc->Rows && l < res_desc->Columns)
|
||||
|
@ -2194,14 +2237,10 @@ static void test_effect_parameter_value(IDirect3DDevice9 *device)
|
|||
hr = effect->lpVtbl->SetMatrixTransposeArray(effect, parameter, (D3DXMATRIX *)input_value, element);
|
||||
if (res_desc->Class == D3DXPC_MATRIX_ROWS && element <= res_desc->Elements)
|
||||
{
|
||||
UINT n;
|
||||
|
||||
for (n = 0; n < element; ++n)
|
||||
{
|
||||
for (l = 0; l < 4; ++l)
|
||||
{
|
||||
UINT m;
|
||||
|
||||
for (m = 0; m < 4; ++m)
|
||||
{
|
||||
if (m < res_desc->Rows && l < res_desc->Columns)
|
||||
|
|
Loading…
Reference in New Issue