[PATCH v2 0/2] MR3896: d3d10/effect: Implement instructions used for signed integer division.
Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> -- v2: d3d10/effect: Add signed integer compare instructions for expressions. d3d10/effect: Implement instructions used for signed integer division. https://gitlab.winehq.org/wine/wine/-/merge_requests/3896
From: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/d3d10/effect.c | 30 ++++++++ dlls/d3d10/tests/effect.c | 141 +++++++++++++++++++++++++------------- 2 files changed, 125 insertions(+), 46 deletions(-) diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 1d6acf53162..a4e099d79be 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -477,6 +477,34 @@ static void pres_umax(float **args, unsigned int n, const struct preshader_instr } } +static void pres_and(float **args, unsigned int n, const struct preshader_instr *instr) +{ + unsigned int *arg1 = (unsigned int *)args[0]; + unsigned int *arg2 = (unsigned int *)args[1]; + float *retval = args[2]; + unsigned int i; + + for (i = 0; i < instr->comp_count; ++i) + { + unsigned int v = arg1[instr->scalar ? 0 : i] & arg2[i]; + retval[i] = *(float *)&v; + } +} + +static void pres_xor(float **args, unsigned int n, const struct preshader_instr *instr) +{ + unsigned int *arg1 = (unsigned int *)args[0]; + unsigned int *arg2 = (unsigned int *)args[1]; + float *retval = args[2]; + unsigned int i; + + for (i = 0; i < instr->comp_count; ++i) + { + unsigned int v = arg1[instr->scalar ? 0 : i] ^ arg2[i]; + retval[i] = *(float *)&v; + } +} + static void pres_movc(float **args, unsigned int n, const struct preshader_instr *instr) { float *arg1 = args[0], *arg2 = args[1], *arg3 = args[2]; @@ -522,6 +550,8 @@ static const struct preshader_op_info preshader_ops[] = { 0x21e, "imax", pres_imax }, { 0x21f, "umin", pres_umin }, { 0x220, "umax", pres_umax }, + { 0x230, "and", pres_and }, + { 0x233, "xor", pres_xor }, { 0x301, "movc", pres_movc }, }; diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index b1fdc357f7d..4a9e3e26752 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -8263,13 +8263,17 @@ technique10 tech { SetBlendState( NULL, atan2(g_var.x, g_var.y), 0 ); } + pass p19 + { + SetBlendState( NULL, g_var3.x / g_var3.y, 0 ); + } } #endif static DWORD fx_test_value_expression[] = { - 0x43425844, 0x0e217d1d, 0x094ea593, 0x2f3d1951, 0x04709409, 0x00000001, 0x0000256c, 0x00000001, - 0x00000024, 0x30315846, 0x00002540, 0xfeff1001, 0x00000001, 0x00000004, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00001fc4, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x43425844, 0x2f343430, 0x7bdca8e3, 0x8bdb9976, 0xddfe53fd, 0x00000001, 0x00002898, 0x00000001, + 0x00000024, 0x30315846, 0x0000286c, 0xfeff1001, 0x00000001, 0x00000004, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000001, 0x000022b4, 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, @@ -8524,49 +8528,74 @@ static DWORD fx_test_value_expression[] = 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, 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, - 0x00000002, 0x00000000, 0x00000001, 0x00000580, 0x0000058c, 0x00000003, 0x00000000, 0x0000000a, - 0x00000000, 0x00000006, 0x0000058f, 0x0000000b, 0x00000000, 0x00000001, 0x000007bf, 0x00000002, - 0x00000000, 0x00000001, 0x000007cb, 0x000007d7, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, - 0x00000006, 0x000007da, 0x0000000b, 0x00000000, 0x00000001, 0x00000902, 0x00000002, 0x00000000, - 0x00000001, 0x0000090e, 0x0000091a, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, - 0x0000091d, 0x0000000b, 0x00000000, 0x00000001, 0x00000a45, 0x00000002, 0x00000000, 0x00000001, - 0x00000a51, 0x00000a5d, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x00000a60, - 0x0000000b, 0x00000000, 0x00000001, 0x00000b5c, 0x00000002, 0x00000000, 0x00000001, 0x00000b68, - 0x00000b74, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x00000b77, 0x0000000b, - 0x00000000, 0x00000001, 0x00000cc7, 0x00000002, 0x00000000, 0x00000001, 0x00000cd3, 0x00000cdf, - 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x00000ce2, 0x0000000b, 0x00000000, - 0x00000001, 0x00000dd2, 0x00000002, 0x00000000, 0x00000001, 0x00000dde, 0x00000dea, 0x00000003, - 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x00000ded, 0x0000000b, 0x00000000, 0x00000001, - 0x00000fe9, 0x00000002, 0x00000000, 0x00000001, 0x00000ff5, 0x00001001, 0x00000003, 0x00000000, - 0x0000000a, 0x00000000, 0x00000006, 0x00001004, 0x0000000b, 0x00000000, 0x00000001, 0x00001180, - 0x00000002, 0x00000000, 0x00000001, 0x0000118c, 0x00001198, 0x00000003, 0x00000000, 0x0000000a, - 0x00000000, 0x00000006, 0x0000119c, 0x0000000b, 0x00000000, 0x00000001, 0x0000136c, 0x00000002, - 0x00000000, 0x00000001, 0x00001378, 0x00001384, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, - 0x00000006, 0x00001388, 0x0000000b, 0x00000000, 0x00000001, 0x00001504, 0x00000002, 0x00000000, - 0x00000001, 0x00001510, 0x0000151c, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, - 0x00001520, 0x0000000b, 0x00000000, 0x00000001, 0x0000169c, 0x00000002, 0x00000000, 0x00000001, - 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, 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, + 0x0000ffff, 0x00000001, 0x00000002, 0x00000000, 0x00000001, 0x00000002, 0x00000000, 0x00393170, + 0x000002d0, 0x43425844, 0xca0a64ed, 0x1e48bebb, 0x50b61480, 0x81af66f1, 0x00000001, 0x000002d0, + 0x00000003, 0x0000002c, 0x000000a8, 0x000000c4, 0x42415443, 0x00000074, 0x0000001c, 0x0000004b, + 0x46580400, 0x00000001, 0x0000001c, 0x00000100, 0x00000048, 0x00000030, 0x00000002, 0x00000001, + 0x00000038, 0x00000000, 0x61765f67, 0xab003372, 0x00020001, 0x00040001, 0x00000001, 0x00000000, + 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, + 0x656c6970, 0x30312072, 0xab00312e, 0x34494c43, 0x00000014, 0x00000004, 0x80000000, 0x00000000, + 0x00000000, 0x00000000, 0x434c5846, 0x00000204, 0x0000000d, 0x12000001, 0x00000001, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000007, 0x00000000, 0x21e00001, 0x00000002, 0x00000000, + 0x00000007, 0x00000000, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000007, 0x00000004, + 0x12000001, 0x00000001, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000007, 0x00000000, + 0x21e00001, 0x00000002, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000002, 0x00000001, + 0x00000000, 0x00000007, 0x00000005, 0x21a00001, 0x00000002, 0x00000000, 0x00000007, 0x00000004, + 0x00000000, 0x00000007, 0x00000005, 0x00000000, 0x00000007, 0x00000000, 0x12000001, 0x00000001, + 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000007, 0x00000004, 0x23300001, 0x00000002, + 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000007, + 0x00000001, 0x23000001, 0x00000002, 0x00000000, 0x00000007, 0x00000001, 0x00000000, 0x00000001, + 0x00000000, 0x00000000, 0x00000007, 0x00000005, 0x30100001, 0x00000003, 0x00000000, 0x00000007, + 0x00000005, 0x00000000, 0x00000007, 0x00000004, 0x00000000, 0x00000007, 0x00000000, 0x00000000, + 0x00000007, 0x00000008, 0x13000001, 0x00000001, 0x00000000, 0x00000007, 0x00000008, 0x00000000, + 0x00000004, 0x00000000, 0x13000001, 0x00000001, 0x00000000, 0x00000007, 0x00000008, 0x00000000, + 0x00000004, 0x00000001, 0x13000001, 0x00000001, 0x00000000, 0x00000007, 0x00000008, 0x00000000, + 0x00000004, 0x00000002, 0x13000001, 0x00000001, 0x00000000, 0x00000007, 0x00000008, 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, + 0x00000014, 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, 0x00000002, 0x00000000, 0x00000001, 0x00000580, + 0x0000058c, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x0000058f, 0x0000000b, + 0x00000000, 0x00000001, 0x000007bf, 0x00000002, 0x00000000, 0x00000001, 0x000007cb, 0x000007d7, + 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x000007da, 0x0000000b, 0x00000000, + 0x00000001, 0x00000902, 0x00000002, 0x00000000, 0x00000001, 0x0000090e, 0x0000091a, 0x00000003, + 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x0000091d, 0x0000000b, 0x00000000, 0x00000001, + 0x00000a45, 0x00000002, 0x00000000, 0x00000001, 0x00000a51, 0x00000a5d, 0x00000003, 0x00000000, + 0x0000000a, 0x00000000, 0x00000006, 0x00000a60, 0x0000000b, 0x00000000, 0x00000001, 0x00000b5c, + 0x00000002, 0x00000000, 0x00000001, 0x00000b68, 0x00000b74, 0x00000003, 0x00000000, 0x0000000a, + 0x00000000, 0x00000006, 0x00000b77, 0x0000000b, 0x00000000, 0x00000001, 0x00000cc7, 0x00000002, + 0x00000000, 0x00000001, 0x00000cd3, 0x00000cdf, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, + 0x00000006, 0x00000ce2, 0x0000000b, 0x00000000, 0x00000001, 0x00000dd2, 0x00000002, 0x00000000, + 0x00000001, 0x00000dde, 0x00000dea, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, + 0x00000ded, 0x0000000b, 0x00000000, 0x00000001, 0x00000fe9, 0x00000002, 0x00000000, 0x00000001, + 0x00000ff5, 0x00001001, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x00001004, + 0x0000000b, 0x00000000, 0x00000001, 0x00001180, 0x00000002, 0x00000000, 0x00000001, 0x0000118c, + 0x00001198, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x0000119c, 0x0000000b, + 0x00000000, 0x00000001, 0x0000136c, 0x00000002, 0x00000000, 0x00000001, 0x00001378, 0x00001384, + 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x00001388, 0x0000000b, 0x00000000, + 0x00000001, 0x00001504, 0x00000002, 0x00000000, 0x00000001, 0x00001510, 0x0000151c, 0x00000003, + 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x00001520, 0x0000000b, 0x00000000, 0x00000001, + 0x0000169c, 0x00000002, 0x00000000, 0x00000001, 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, 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, 0x00001fc4, + 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x00001fc8, 0x0000000b, 0x00000000, + 0x00000001, 0x0000229c, 0x00000002, 0x00000000, 0x00000001, 0x000022a8, }; static float get_frc(float v) @@ -8968,6 +8997,26 @@ static void test_effect_value_expression(void) 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]); + /* Integer division */ + pass = t->lpVtbl->GetPassByName(t, "p19"); + ok(pass->lpVtbl->IsValid(pass), "Expected valid pass.\n"); + + i[0] = 10; + i[1] = 5; + hr = g_var3->lpVtbl->SetIntVector(g_var3, i); + 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_state, "Unexpected blend state %p.\n", blend_state); + ok(blend_factor[0] == 2.0f, "Got unexpected blend_factor[0] %.8e.\n", blend_factor[0]); + ok(blend_factor[1] == 2.0f, "Got unexpected blend_factor[1] %.8e.\n", blend_factor[1]); + ok(blend_factor[2] == 2.0f, "Got unexpected blend_factor[2] %.8e.\n", blend_factor[2]); + ok(blend_factor[3] == 2.0f, "Got unexpected blend_factor[3] %.8e.\n", blend_factor[3]); + ok(!sample_mask, "Got unexpected sample_mask %#x.\n", sample_mask); + effect->lpVtbl->Release(effect); refcount = ID3D10Device_Release(device); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3896
From: Nikolay Sivov <nsivov(a)codeweavers.com> Signed-off-by: Nikolay Sivov <nsivov(a)codeweavers.com> --- dlls/d3d10/effect.c | 60 +++++++++++++++++++++++++++++ dlls/d3d10/tests/effect.c | 81 ++++++++++++++++++++++++++++++++++++--- 2 files changed, 136 insertions(+), 5 deletions(-) diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index a4e099d79be..ab3b9e47594 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -411,6 +411,62 @@ static void pres_iadd(float **args, unsigned int n, const struct preshader_instr } } +static void pres_bilt(float **args, unsigned int n, const struct preshader_instr *instr) +{ + int *arg1 = (int *)args[0]; + int *arg2 = (int *)args[1]; + float *retval = args[2]; + unsigned int i; + + for (i = 0; i < instr->comp_count; ++i) + { + unsigned int v = arg1[instr->scalar ? 0 : i] < arg2[i] ? ~0u : 0; + retval[i] = *(float *)&v; + } +} + +static void pres_bige(float **args, unsigned int n, const struct preshader_instr *instr) +{ + int *arg1 = (int *)args[0]; + int *arg2 = (int *)args[1]; + float *retval = args[2]; + unsigned int i; + + for (i = 0; i < instr->comp_count; ++i) + { + unsigned int v = arg1[instr->scalar ? 0 : i] >= arg2[i] ? ~0u : 0; + retval[i] = *(float *)&v; + } +} + +static void pres_bieq(float **args, unsigned int n, const struct preshader_instr *instr) +{ + int *arg1 = (int *)args[0]; + int *arg2 = (int *)args[1]; + float *retval = args[2]; + unsigned int i; + + for (i = 0; i < instr->comp_count; ++i) + { + unsigned int v = arg1[instr->scalar ? 0 : i] == arg2[i] ? ~0u : 0; + retval[i] = *(float *)&v; + } +} + +static void pres_bine(float **args, unsigned int n, const struct preshader_instr *instr) +{ + int *arg1 = (int *)args[0]; + int *arg2 = (int *)args[1]; + float *retval = args[2]; + unsigned int i; + + for (i = 0; i < instr->comp_count; ++i) + { + unsigned int v = arg1[instr->scalar ? 0 : i] != arg2[i] ? ~0u : 0; + retval[i] = *(float *)&v; + } +} + static void pres_udiv(float **args, unsigned int n, const struct preshader_instr *instr) { unsigned int *arg1 = (unsigned int *)args[0]; @@ -544,6 +600,10 @@ static const struct preshader_op_info preshader_ops[] = { 0x205, "mul", pres_mul }, { 0x206, "atan2",pres_atan2}, { 0x208, "div", pres_div }, + { 0x210, "bilt", pres_bilt }, + { 0x211, "bige", pres_bige }, + { 0x212, "bieq", pres_bieq }, + { 0x213, "bine", pres_bine }, { 0x216, "iadd", pres_iadd }, { 0x21a, "udiv", pres_udiv }, { 0x21d, "imin", pres_imin }, diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 4a9e3e26752..5f6e0c6808b 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -8267,13 +8267,18 @@ technique10 tech { SetBlendState( NULL, g_var3.x / g_var3.y, 0 ); } + pass p20 + { + SetBlendState( NULL, g_var3.x < g_var3.y ? (g_var3.x >= g_var3.z ? 0 : 1 ) : + (g_var3.x != g_var3.z ? g_var3.z == g_var3.w : 2), 0 ); + } } #endif static DWORD fx_test_value_expression[] = { - 0x43425844, 0x2f343430, 0x7bdca8e3, 0x8bdb9976, 0xddfe53fd, 0x00000001, 0x00002898, 0x00000001, - 0x00000024, 0x30315846, 0x0000286c, 0xfeff1001, 0x00000001, 0x00000004, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x000022b4, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x43425844, 0x0665faf3, 0x70ffa2d0, 0x6f046007, 0x12b30760, 0x00000001, 0x00002bd4, 0x00000001, + 0x00000024, 0x30315846, 0x00002ba8, 0xfeff1001, 0x00000001, 0x00000004, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000001, 0x000025b4, 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, @@ -8552,13 +8557,37 @@ static DWORD fx_test_value_expression[] = 0x00000004, 0x00000001, 0x13000001, 0x00000001, 0x00000000, 0x00000007, 0x00000008, 0x00000000, 0x00000004, 0x00000002, 0x13000001, 0x00000001, 0x00000000, 0x00000007, 0x00000008, 0x00000000, 0x00000004, 0x00000003, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000001, 0x00000002, 0x00000000, + 0x00000001, 0x00000002, 0x00000000, 0x00303270, 0x000002e0, 0x43425844, 0x561ee53c, 0x9807d928, + 0x8a3e8c4e, 0x78f7bcb7, 0x00000001, 0x000002e0, 0x00000003, 0x0000002c, 0x000000a8, 0x000000c4, + 0x42415443, 0x00000074, 0x0000001c, 0x0000004b, 0x46580400, 0x00000001, 0x0000001c, 0x00000100, + 0x00000048, 0x00000030, 0x00000002, 0x00000001, 0x00000038, 0x00000000, 0x61765f67, 0xab003372, + 0x00020001, 0x00040001, 0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, + 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x34494c43, + 0x00000014, 0x00000004, 0x00000000, 0x00000001, 0x00000002, 0x00000000, 0x434c5846, 0x00000214, + 0x0000000c, 0x21200001, 0x00000002, 0x00000000, 0x00000002, 0x00000003, 0x00000000, 0x00000002, + 0x00000002, 0x00000000, 0x00000007, 0x00000000, 0x23000001, 0x00000002, 0x00000000, 0x00000007, + 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000007, 0x00000004, 0x21300001, + 0x00000002, 0x00000000, 0x00000002, 0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000, + 0x00000007, 0x00000000, 0x30100001, 0x00000003, 0x00000000, 0x00000007, 0x00000000, 0x00000000, + 0x00000007, 0x00000004, 0x00000000, 0x00000001, 0x00000002, 0x00000000, 0x00000007, 0x00000008, + 0x21100001, 0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000002, + 0x00000000, 0x00000007, 0x00000000, 0x30100001, 0x00000003, 0x00000000, 0x00000007, 0x00000000, + 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000001, 0x00000001, 0x00000000, 0x00000007, + 0x00000004, 0x21000001, 0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, + 0x00000001, 0x00000000, 0x00000007, 0x00000000, 0x30100001, 0x00000003, 0x00000000, 0x00000007, + 0x00000000, 0x00000000, 0x00000007, 0x00000004, 0x00000000, 0x00000007, 0x00000008, 0x00000000, + 0x00000007, 0x0000000c, 0x13000001, 0x00000001, 0x00000000, 0x00000007, 0x0000000c, 0x00000000, + 0x00000004, 0x00000000, 0x13000001, 0x00000001, 0x00000000, 0x00000007, 0x0000000c, 0x00000000, + 0x00000004, 0x00000001, 0x13000001, 0x00000001, 0x00000000, 0x00000007, 0x0000000c, 0x00000000, + 0x00000004, 0x00000002, 0x13000001, 0x00000001, 0x00000000, 0x00000007, 0x0000000c, 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, - 0x00000014, 0x00000000, 0x000001ba, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, + 0x00000015, 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, 0x00000002, 0x00000000, 0x00000001, 0x00000580, @@ -8595,7 +8624,9 @@ static DWORD fx_test_value_expression[] = 0x00001e28, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x00001e2c, 0x0000000b, 0x00000000, 0x00000001, 0x00001fac, 0x00000002, 0x00000000, 0x00000001, 0x00001fb8, 0x00001fc4, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x00001fc8, 0x0000000b, 0x00000000, - 0x00000001, 0x0000229c, 0x00000002, 0x00000000, 0x00000001, 0x000022a8, + 0x00000001, 0x0000229c, 0x00000002, 0x00000000, 0x00000001, 0x000022a8, 0x000022b4, 0x00000003, + 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x000022b8, 0x0000000b, 0x00000000, 0x00000001, + 0x0000259c, 0x00000002, 0x00000000, 0x00000001, 0x000025a8, }; static float get_frc(float v) @@ -9017,6 +9048,46 @@ static void test_effect_value_expression(void) ok(blend_factor[3] == 2.0f, "Got unexpected blend_factor[3] %.8e.\n", blend_factor[3]); ok(!sample_mask, "Got unexpected sample_mask %#x.\n", sample_mask); + /* Integer comparison */ + pass = t->lpVtbl->GetPassByName(t, "p20"); + ok(pass->lpVtbl->IsValid(pass), "Expected valid pass.\n"); + + i[0] = 1; + i[1] = 5; + i[2] = 6; + i[3] = 5; + hr = g_var3->lpVtbl->SetIntVector(g_var3, i); + 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_state, "Unexpected blend state %p.\n", blend_state); + ok(blend_factor[0] == 1.0f, "Got unexpected blend_factor[0] %.8e.\n", blend_factor[0]); + ok(blend_factor[1] == 1.0f, "Got unexpected blend_factor[1] %.8e.\n", blend_factor[1]); + ok(blend_factor[2] == 1.0f, "Got unexpected blend_factor[2] %.8e.\n", blend_factor[2]); + ok(blend_factor[3] == 1.0f, "Got unexpected blend_factor[3] %.8e.\n", blend_factor[3]); + ok(!sample_mask, "Got unexpected sample_mask %#x.\n", sample_mask); + + i[0] = 2; + i[1] = 1; + i[2] = 2; + i[3] = 5; + hr = g_var3->lpVtbl->SetIntVector(g_var3, i); + 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_state, "Unexpected blend state %p.\n", blend_state); + ok(blend_factor[0] == 2.0f, "Got unexpected blend_factor[0] %.8e.\n", blend_factor[0]); + ok(blend_factor[1] == 2.0f, "Got unexpected blend_factor[1] %.8e.\n", blend_factor[1]); + ok(blend_factor[2] == 2.0f, "Got unexpected blend_factor[2] %.8e.\n", blend_factor[2]); + ok(blend_factor[3] == 2.0f, "Got unexpected blend_factor[3] %.8e.\n", blend_factor[3]); + ok(!sample_mask, "Got unexpected sample_mask %#x.\n", sample_mask); + effect->lpVtbl->Release(effect); refcount = ID3D10Device_Release(device); -- GitLab https://gitlab.winehq.org/wine/wine/-/merge_requests/3896
Matteo Bruni (@Mystral) commented about dlls/d3d10_1/tests/d3d10_1.c:
*/
#define COBJMACROS -#include "d3d10_1.h" -#include "initguid.h" Thanks for this :smile:
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3896#note_46258
Matteo Bruni (@Mystral) commented about dlls/d3d10_1/tests/d3d10_1.c:
+ * Don't use sizeof(data), use data[6] as size, + * because the DWORD data[] has only complete DWORDs and + * so it could happen that there are padded bytes at the end. + * + * The fx size (data[6]) could be up to 3 BYTEs smaller + * than the sizeof(data). + */ + return D3D10CreateEffectFromMemory(data, data[6], flags, (ID3D10Device *)device, effect_pool, effect); +} + +#if 0 +BlendState blend_state +{ + srcblend = one; + srcblend[0] = zero; +}; This doesn't quite show what happens with the blend state descriptor because BlendEnable defaults to false, which in turn overrides the individual blend settings to their default values. That's probably the reason why the values from the backing store don't match those you get from the blend state object (and makes that part of the test somewhat unclear).
-- https://gitlab.winehq.org/wine/wine/-/merge_requests/3896#note_46259
This merge request was approved by Matteo Bruni. -- https://gitlab.winehq.org/wine/wine/-/merge_requests/3896
participants (3)
-
Matteo Bruni (@Mystral) -
Nikolay Sivov -
Nikolay Sivov (@nsivov)