d3d10/tests: Add some tests for trigonometric functions.

This commit is contained in:
Nikolay Sivov 2023-03-29 17:04:30 +02:00 committed by Alexandre Julliard
parent ec47f9855e
commit a98d9dd9e9

View file

@ -8209,13 +8209,29 @@ technique10 tech
{
SetBlendState( NULL, g_var4.x + g_var4.y, 0 );
}
pass p15
{
SetBlendState( NULL, asin(g_var.x), 0 );
}
pass p16
{
SetBlendState( NULL, acos(g_var.x), 0 );
}
pass p17
{
SetBlendState( NULL, atan(g_var.x), 0 );
}
pass p18
{
SetBlendState( NULL, atan2(g_var.x, g_var.y), 0 );
}
}
#endif
static DWORD fx_test_value_expression[] =
{
0x43425844, 0x42b9e7ac, 0xf8ca37f6, 0x483b59c1, 0x9cf9e2e6, 0x00000001, 0x00001e9c, 0x00000001,
0x00000024, 0x30315846, 0x00001e70, 0xfeff1001, 0x00000001, 0x00000004, 0x00000001, 0x00000000,
0x00000000, 0x00000000, 0x00000001, 0x000019e4, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
0x43425844, 0x0e217d1d, 0x094ea593, 0x2f3d1951, 0x04709409, 0x00000001, 0x0000256c, 0x00000001,
0x00000024, 0x30315846, 0x00002540, 0xfeff1001, 0x00000001, 0x00000004, 0x00000001, 0x00000000,
0x00000000, 0x00000000, 0x00000001, 0x00001fc4, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x6f6c4724,
0x736c6162, 0x6f6c6600, 0x00347461, 0x0000000d, 0x00000001, 0x00000000, 0x00000010, 0x00000010,
0x00000010, 0x0000210a, 0x61765f67, 0x5f670072, 0x32726176, 0x746e6900, 0x003d0034, 0x00010000,
@ -8423,13 +8439,60 @@ static DWORD fx_test_value_expression[] =
0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x13100001, 0x00000001,
0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000004, 0x00000002, 0x13100001, 0x00000001,
0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000004, 0x00000003, 0xf0f0f0f0, 0x0f0f0f0f,
0x0000ffff, 0x00000001, 0x00000002, 0x00000000, 0x00000001, 0x00000002, 0x00000000, 0x00353170,
0x0000014c, 0x43425844, 0x858202fa, 0x6eea0ef1, 0x035697d7, 0x8937d809, 0x00000001, 0x0000014c,
0x00000003, 0x0000002c, 0x000000a8, 0x000000b4, 0x42415443, 0x00000074, 0x0000001c, 0x0000004b,
0x46580400, 0x00000001, 0x0000001c, 0x00000100, 0x00000048, 0x00000030, 0x00000002, 0x00000001,
0x00000038, 0x00000000, 0x61765f67, 0xabab0072, 0x00030001, 0x00040001, 0x00000001, 0x00000000,
0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320,
0x656c6970, 0x30312072, 0xab00312e, 0x34494c43, 0x00000004, 0x00000000, 0x434c5846, 0x00000090,
0x00000004, 0x10a00001, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004,
0x00000000, 0x10a00001, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004,
0x00000001, 0x10a00001, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004,
0x00000002, 0x10a00001, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004,
0x00000003, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000001, 0x00000002, 0x00000000, 0x00000001,
0x00000002, 0x00000000, 0x00363170, 0x0000014c, 0x43425844, 0x27003e76, 0x45cf2121, 0x9b3336ae,
0xca07856b, 0x00000001, 0x0000014c, 0x00000003, 0x0000002c, 0x000000a8, 0x000000b4, 0x42415443,
0x00000074, 0x0000001c, 0x0000004b, 0x46580400, 0x00000001, 0x0000001c, 0x00000100, 0x00000048,
0x00000030, 0x00000002, 0x00000001, 0x00000038, 0x00000000, 0x61765f67, 0xabab0072, 0x00030001,
0x00040001, 0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820,
0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x34494c43, 0x00000004,
0x00000000, 0x434c5846, 0x00000090, 0x00000004, 0x10b00001, 0x00000001, 0x00000000, 0x00000002,
0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x10b00001, 0x00000001, 0x00000000, 0x00000002,
0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x10b00001, 0x00000001, 0x00000000, 0x00000002,
0x00000000, 0x00000000, 0x00000004, 0x00000002, 0x10b00001, 0x00000001, 0x00000000, 0x00000002,
0x00000000, 0x00000000, 0x00000004, 0x00000003, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000001,
0x00000002, 0x00000000, 0x00000001, 0x00000002, 0x00000000, 0x00373170, 0x0000014c, 0x43425844,
0x7a9aaef0, 0xcc3049d9, 0x1c45c020, 0xa01af792, 0x00000001, 0x0000014c, 0x00000003, 0x0000002c,
0x000000a8, 0x000000b4, 0x42415443, 0x00000074, 0x0000001c, 0x0000004b, 0x46580400, 0x00000001,
0x0000001c, 0x00000100, 0x00000048, 0x00000030, 0x00000002, 0x00000001, 0x00000038, 0x00000000,
0x61765f67, 0xabab0072, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x4d007874, 0x6f726369,
0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072,
0xab00312e, 0x34494c43, 0x00000004, 0x00000000, 0x434c5846, 0x00000090, 0x00000004, 0x10c00001,
0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0x10c00001,
0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000001, 0x10c00001,
0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000002, 0x10c00001,
0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000004, 0x00000003, 0xf0f0f0f0,
0x0f0f0f0f, 0x0000ffff, 0x00000001, 0x00000002, 0x00000000, 0x00000001, 0x00000002, 0x00000000,
0x00383170, 0x0000017c, 0x43425844, 0xb9755ca9, 0x574af4c2, 0x92daa707, 0xdab0053b, 0x00000001,
0x0000017c, 0x00000003, 0x0000002c, 0x000000a8, 0x000000b4, 0x42415443, 0x00000074, 0x0000001c,
0x0000004b, 0x46580400, 0x00000001, 0x0000001c, 0x00000100, 0x00000048, 0x00000030, 0x00000002,
0x00000001, 0x00000038, 0x00000000, 0x61765f67, 0xabab0072, 0x00030001, 0x00040001, 0x00000001,
0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461,
0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x34494c43, 0x00000004, 0x00000000, 0x434c5846,
0x000000c0, 0x00000004, 0x20600001, 0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000,
0x00000002, 0x00000001, 0x00000000, 0x00000004, 0x00000000, 0x20600001, 0x00000002, 0x00000000,
0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000004, 0x00000001,
0x20600001, 0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000001,
0x00000000, 0x00000004, 0x00000002, 0x20600001, 0x00000002, 0x00000000, 0x00000002, 0x00000000,
0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000004, 0x00000003, 0xf0f0f0f0, 0x0f0f0f0f,
0x0000ffff, 0x00000001, 0x00000002, 0x00000000, 0x00000001, 0x00000002, 0x00000000, 0x00000004,
0x00000040, 0x00000000, 0x00000004, 0xffffffff, 0x00000000, 0x00000030, 0x00000014, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000036, 0x00000014, 0x00000000, 0x00000010,
0x00000000, 0x00000000, 0x00000000, 0x0000005e, 0x00000042, 0x00000000, 0x00000020, 0x00000000,
0x00000000, 0x00000000, 0x00000087, 0x0000006b, 0x00000000, 0x00000030, 0x00000000, 0x00000000,
0x00000000, 0x000000bc, 0x000000a0, 0x00000000, 0xffffffff, 0x00000001, 0x00000019, 0x00000000,
0x00000006, 0x000000c5, 0x00000000, 0x000001b5, 0x0000000f, 0x00000000, 0x000001ba, 0x00000003,
0x00000006, 0x000000c5, 0x00000000, 0x000001b5, 0x00000013, 0x00000000, 0x000001ba, 0x00000003,
0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x000001bd, 0x0000000b, 0x00000000, 0x00000001,
0x00000405, 0x00000002, 0x00000000, 0x00000001, 0x00000411, 0x0000041d, 0x00000003, 0x00000000,
0x0000000a, 0x00000000, 0x00000006, 0x00000420, 0x0000000b, 0x00000000, 0x00000001, 0x00000574,
@ -8457,7 +8520,15 @@ static DWORD fx_test_value_expression[] =
0x000016a8, 0x000016b4, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x000016b8,
0x0000000b, 0x00000000, 0x00000001, 0x00001834, 0x00000002, 0x00000000, 0x00000001, 0x00001840,
0x0000184c, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x00001850, 0x0000000b,
0x00000000, 0x00000001, 0x000019cc, 0x00000002, 0x00000000, 0x00000001, 0x000019d8,
0x00000000, 0x00000001, 0x000019cc, 0x00000002, 0x00000000, 0x00000001, 0x000019d8, 0x000019e4,
0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x000019e8, 0x0000000b, 0x00000000,
0x00000001, 0x00001b38, 0x00000002, 0x00000000, 0x00000001, 0x00001b44, 0x00001b50, 0x00000003,
0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x00001b54, 0x0000000b, 0x00000000, 0x00000001,
0x00001ca4, 0x00000002, 0x00000000, 0x00000001, 0x00001cb0, 0x00001cbc, 0x00000003, 0x00000000,
0x0000000a, 0x00000000, 0x00000006, 0x00001cc0, 0x0000000b, 0x00000000, 0x00000001, 0x00001e10,
0x00000002, 0x00000000, 0x00000001, 0x00001e1c, 0x00001e28, 0x00000003, 0x00000000, 0x0000000a,
0x00000000, 0x00000006, 0x00001e2c, 0x0000000b, 0x00000000, 0x00000001, 0x00001fac, 0x00000002,
0x00000000, 0x00000001, 0x00001fb8,
};
static float get_frc(float v)
@ -8802,6 +8873,63 @@ static void test_effect_value_expression(void)
ok(blend_factor[3] == 8.0f, "Got unexpected blend_factor[3] %.8e.\n", blend_factor[3]);
ok(!sample_mask, "Got unexpected sample_mask %#x.\n", sample_mask);
/* asin */
pass = t->lpVtbl->GetPassByName(t, "p15");
ok(pass->lpVtbl->IsValid(pass), "Expected valid pass.\n");
f[0] = 0.1234567f;
hr = g_var->lpVtbl->SetFloatVector(g_var, f);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = pass->lpVtbl->Apply(pass, 0);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
ID3D10Device_OMGetBlendState(device, &blend_state, blend_factor, &sample_mask);
ok(blend_factor[0] == asinf(f[0]), "Got unexpected blend_factor[0] %.8e.\n", blend_factor[0]);
/* acos */
pass = t->lpVtbl->GetPassByName(t, "p16");
ok(pass->lpVtbl->IsValid(pass), "Expected valid pass.\n");
f[0] = 0.1234567f;
hr = g_var->lpVtbl->SetFloatVector(g_var, f);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = pass->lpVtbl->Apply(pass, 0);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
ID3D10Device_OMGetBlendState(device, &blend_state, blend_factor, &sample_mask);
ok(blend_factor[0] == acosf(f[0]), "Got unexpected blend_factor[0] %.8e.\n", blend_factor[0]);
/* atan */
pass = t->lpVtbl->GetPassByName(t, "p17");
ok(pass->lpVtbl->IsValid(pass), "Expected valid pass.\n");
f[0] = 0.1234567f;
hr = g_var->lpVtbl->SetFloatVector(g_var, f);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = pass->lpVtbl->Apply(pass, 0);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
ID3D10Device_OMGetBlendState(device, &blend_state, blend_factor, &sample_mask);
ok(blend_factor[0] == atanf(f[0]), "Got unexpected blend_factor[0] %.8e.\n", blend_factor[0]);
/* atan2 */
pass = t->lpVtbl->GetPassByName(t, "p18");
ok(pass->lpVtbl->IsValid(pass), "Expected valid pass.\n");
f[0] = 0.1234567f;
f[1] = 0.7654321f;
hr = g_var->lpVtbl->SetFloatVector(g_var, f);
ok(hr == S_OK, "Unexpected hr %#lx.\n", hr);
hr = pass->lpVtbl->Apply(pass, 0);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
ID3D10Device_OMGetBlendState(device, &blend_state, blend_factor, &sample_mask);
ok(blend_factor[0] == atan2f(f[0], f[1]), "Got unexpected blend_factor[0] %.8e.\n", blend_factor[0]);
effect->lpVtbl->Release(effect);
refcount = ID3D10Device_Release(device);