Commit c59efbed authored by Nozomi Kodama's avatar Nozomi Kodama Committed by Alexandre Julliard

d3dx9_36: Add tests for D3DXSHRotateZ.

parent ffa7ac73
......@@ -2784,49 +2784,111 @@ static void test_D3DXSHRotate(void)
static void test_D3DXSHRotateZ(void)
{
unsigned int i, j, order, square;
FLOAT angle[] = { D3DX_PI / 3.0f, -D3DX_PI / 3.0f, 4.0f * D3DX_PI / 3.0f, }, expected, in[49], out[49], *received_ptr, table[] =
{ /* Angle = D3DX_PI / 3.0f */
1.01f, 4.477762f, 3.010000f, 0.264289f, 5.297888f, 9.941864f, 7.010000f, -1.199813f,
-8.843789f, -10.010002f, 7.494040f, 18.138016f, 13.010000, -3.395966f, -17.039942f,
-16.009998f, -30.164297f, -18.010004f, 10.422242f, 29.066219f, 21.010000f, -6.324171f,
-27.968145f, -24.009998f, 2.226099f, -18.180565, -43.824551f, -28.010004f, 14.082493f,
42.726471f, 31.010000f, -9.984426f, -41.628399f, -34.009995f, 5.886358f, 40.530331f,
/* Angle = D3DX_PI / 3.0f */
1.01f, -2.467762f, 3.010000f, 3.745711f, -10.307890f, -3.931864f, 7.010000f, 9.209813f,
-0.166214f, -10.010002f, -18.504044f, -6.128017f, 13.010000f, 17.405966f, 2.029938f,
-16.009998f, 13.154303f, -18.010004f, -29.432247f, -9.056221f, 21.010000f, 28.334169f,
4.958139f, -24.010002f, -27.236092f, 44.190582f, 16.814558f, -28.009996f, -43.092499f,
-12.716474f, 31.010000f, 41.994423f, 8.618393f, -34.010002f, -40.896347f, -4.520310f,
/* Angle = 4.0f * D3DX_PI / 3.0f */
1.01f, -4.477762f, 3.010000f, -0.264289f, 5.297887f, -9.941864f, 7.010000f, 1.199814f,
-8.843788f, 10.010004f, 7.494038f, -18.138016f, 13.010000f, 3.395967f, -17.039940f,
16.009996f, -30.164293f, 18.010006f, 10.422239f, -29.066219f, 21.010000f, 6.324172f,
-27.968143f, 24.009993f, 2.226105f, 18.180552f, -43.824543f, 28.010008f, 14.082489f,
-42.726471f, 31.010000f, 9.984427f, -41.628399f, 34.009987f, 5.886366f, -40.530327, };
unsigned int end, i, j, l, order, square;
FLOAT expected, in[49], out[49], *out_temp, *received_ptr;
const FLOAT angle[] = { D3DX_PI / 3.0f, -D3DX_PI / 3.0f, 4.0f * D3DX_PI / 3.0f, }, table[] =
{ /* Angle = D3DX_PI / 3.0f */
1.01f, 4.477762f, 3.010000f, 0.264289f, 5.297888f, 9.941864f,
7.010000f, -1.199813f, -8.843789f, -10.010002f, 7.494040f, 18.138016f,
13.010000, -3.395966f, -17.039942f, -16.009998f, -30.164297f, -18.010004f,
10.422242f, 29.066219f, 21.010000f, -6.324171f, -27.968145f, -24.009998f,
2.226099f, -18.180565, -43.824551f, -28.010004f, 14.082493f, 42.726471f,
31.010000f, -9.984426f, -41.628399f, -34.009995f, 5.886358f, 40.530331f,
1.01f, 4.477762f, 0.0f, -5.816784f, 5.297888f, 6.936864f,
0.0f, -9.011250f, -2.294052f, -10.010002f, 12.999042f, 12.133017f,
0.0f, -15.761250f, -5.628748f, 0.0f, -30.164297f, 0.0f,
19.927244f, 19.061220f, 0.0f, -24.761251f, -8.628748f, 0.0f,
-13.061530f, -18.180565f, -30.319553f, 0.0f, 28.587496f, 27.721474f,
0.0f, -36.011253f, -12.378746f, 0.0f, -13.128758f, -23.617250f,
1.010000f, 3.977762f, 3.977762f, 1.114195f, 7.245791f, 10.559759f,
10.559759f, -0.995160f, -0.467341f, 0.467339f, 12.765371f, 18.515701f,
18.515701f, -1.797287f, 0.493916f, -0.493916f, -21.412342f, 21.412338f,
9.221072f, 23.671757f, 23.671757f, 3.850195f, -20.468727f, 20.468723f,
-10.662103f, -36.516628f, -12.061245f, 12.061240f, 22.556875f, 38.999908f,
38.999908f, -0.034875f, -10.427902f, 10.427900f, -36.838284f, -27.652803f,
/* Angle = -D3DX_PI / 3.0f */
1.01f, -2.467762f, 3.010000f, 3.745711f, -10.307890f, -3.931864f,
7.010000f, 9.209813f, -0.166214f, -10.010002f, -18.504044f, -6.128017f,
13.010000f, 17.405966f, 2.029938f, -16.009998f, 13.154303f, -18.010004f,
-29.432247f, -9.056221f, 21.010000f, 28.334169f, 4.958139f, -24.010002f,
-27.236092f, 44.190582f, 16.814558f, -28.009996f, -43.092499f, -12.716474f,
31.010000f, 41.994423f, 8.618393f, -34.010002f, -40.896347f, -4.520310f,
1.01f, -2.467762f, 0.0f, -3.205718f, -10.307890f, -6.936864f,
0.0f, -9.011250f, -4.463446f, -10.009998f, -12.999042f, -12.133017f,
0.0f, -15.761250f, -5.628748f, 0.0f, 13.154303f, 0.0f,
-19.927244f, -19.061220f, 0.0f, -24.761251f, -8.628748f, 0.0f,
-5.695983f, 44.190582f, 30.319553f, 0.0f, -28.587496f, -27.721474f,
0.0f, -36.011253f, -12.378746f, 0.0f, -13.128758f, -57.405258f,
1.010000f, -2.967762f, -2.967762f, -0.609195f, -7.498291f, -10.686009f,
-10.686009f, -11.836716f, 5.390780f, -5.390779f, -10.303651f, -17.284842f,
-17.284842f, -17.565643f, 4.114273f, -4.114273f, 23.716436f, -23.716433f,
-8.069025f, -23.095732f, -23.095732f, -18.535847f, -11.271107f, 11.271104f,
-2.072484f, 30.149330f, 15.244893f, -15.244888f, -20.965050f, -38.203999f,
-38.203999f, -37.258266f, 5.426677f, -5.426679f, -23.396751f, -9.903559f,
/* Angle = 4.0f * D3DX_PI / 3.0f */
1.01f, -4.477762f, 3.010000f, -0.264289f, 5.297887f, -9.941864f,
7.010000f, 1.199814f, -8.843788f, 10.010004f, 7.494038f, -18.138016f,
13.010000f, 3.395967f, -17.039940f, 16.009996f, -30.164293f, 18.010006f,
10.422239f, -29.066219f, 21.010000f, 6.324172f, -27.968143f, 24.009993f,
2.226105f, 18.180552f, -43.824543f, 28.010008f, 14.082489f, -42.726471f,
31.010000f, 9.984427f, -41.628399f, 34.009987f, 5.886366f, -40.530327f,
1.01f, -4.477762f, 0.0f, -1.938928f, 5.297887f, -6.936864f,
0.0f, -3.003751f, -2.294051f, 10.010004f, 12.999040f, -12.133017f,
0.0f, -5.253751f, -5.628747f, 0.0f, -30.164293f, 0.0f,
19.927242f, -19.061220f, 0.0f, -8.253753f, -8.628746f, 0.0f,
-13.061535f, 18.180552f, -30.319553f, 0.0f, 28.587492f, -27.721474f,
0.0f, -12.003753f, -12.378742f, 0.0f, -13.128765f, -7.872400f,
1.010000f, -3.977762f, -3.977762f, 2.863566f, 6.371104f, -10.122416f,
-10.122416f, 10.578746f, -7.769295f, -7.769290f, 16.883686f, -20.574858f,
-20.574858f, 24.909130f, -5.726166f, -5.726164f, -18.796221f, -18.796211f,
29.325350f, -33.723892f, -33.723892f, 42.258442f, -4.851232f, -4.851226f,
-2.533393f, 32.452259f, -46.545670f, -46.545654f, 51.860325f, -53.651630f,
-53.651630f, 71.738174f, 4.440616f, 4.440629f, 25.884174f, -10.748116f, };
for (l = 0; l < 3; l++)
{
if (l == 0)
out_temp = out;
else
out_temp = &in[l - 1];
for (i = 0; i < 49; i++)
in[i] = i + 1.01f;
if (l < 2)
end = 49;
else
end = 48;
for (j = 0; j < 3; j++)
{
for (order = 0; order <= D3DXSH_MAXORDER + 1; order++)
for (j = 0; j < 3; j++)
{
for (i = 0; i < 49; i++)
out[i] = ( i + 1.0f ) * ( i + 1.0f );
for (order = 0; order <= D3DXSH_MAXORDER + 1; order++)
{
for (i = 0; i < 49; i++)
{
out[i] = ( i + 1.0f ) * ( i + 1.0f );
in[i] = i + 1.01f;
}
received_ptr = D3DXSHRotateZ(out, order, angle[j], in);
ok(received_ptr == out, "angle %f, order %u, Expected %p, received %p\n", angle[j], order, out, received_ptr);
received_ptr = D3DXSHRotateZ(out_temp, order, angle[j], in);
ok(received_ptr == out_temp, "angle %f, order %u, expected %p, received %p\n", angle[j], order, out_temp, received_ptr);
for (i = 0; i < 49; i++)
{
/* order = 0 or order = 1 behaves like order = D3DXSH_MINORDER */
square = ( order <= D3DXSH_MINORDER ) ? D3DXSH_MINORDER * D3DXSH_MINORDER : order * order;
if ( i >= square || ( (order >= D3DXSH_MAXORDER) && ( i >= D3DXSH_MAXORDER * D3DXSH_MAXORDER ) ) )
expected = ( i + 1.0f ) * ( i + 1.0f );
else
expected = table[36 * j + i];
ok(relative_error(out[i], expected) < admitted_error, "angle %f, order %u index %u, Expected %f, received %f\n", angle[j], order, i, expected, out[i]);
for (i = 0; i < end; i++)
{
/* order = 0 or order = 1 behaves like order = D3DXSH_MINORDER */
square = (order <= D3DXSH_MINORDER) ? D3DXSH_MINORDER * D3DXSH_MINORDER : order * order;
if (i >= square || ((order >= D3DXSH_MAXORDER) && (i >= D3DXSH_MAXORDER * D3DXSH_MAXORDER)))
if (l > 0)
expected = i + l + 0.01f;
else
expected = ( i + 1.0f ) * ( i + 1.0f );
else
expected = table[36 * (l + 3 * j) + i];
ok(relative_error(expected, out_temp[i]) < admitted_error, "angle %f, order %u index %u, expected %f, received %f\n", angle[j], order, i, expected, out_temp[i]);
}
}
}
}
......
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