From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 23 +++++++++++++++++++- dlls/d3d10/tests/effect.c | 45 ++++++++++++++++++++++++++++++--------- 2 files changed, 57 insertions(+), 11 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 38dd1c874ae..00a3b1b4c79 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -219,6 +219,24 @@ static void pres_ftou(float **args, unsigned int n, const struct preshader_instr } }
+static void pres_min(float **args, unsigned int n, const struct preshader_instr *instr) +{ + float *retval = args[2]; + unsigned int i; + + for (i = 0; i < instr->comp_count; ++i) + retval[i] = min(args[0][i], args[1][i]); +} + +static void pres_max(float **args, unsigned int n, const struct preshader_instr *instr) +{ + float *retval = args[2]; + unsigned int i; + + for (i = 0; i < instr->comp_count; ++i) + retval[i] = max(args[0][i], args[1][i]); +} + static void pres_add(float **args, unsigned int n, const struct preshader_instr *instr) { float *retval = args[2]; @@ -238,6 +256,8 @@ struct preshader_op_info static const struct preshader_op_info preshader_ops[] = { { 0x133, "ftou", pres_ftou }, + { 0x200, "min", pres_min }, + { 0x201, "max", pres_max }, { 0x204, "add", pres_add }, };
@@ -2111,7 +2131,8 @@ static HRESULT parse_fx10_preshader_instr(struct d3d10_preshader_parse_context * return E_FAIL; }
- TRACE("Opcode %#x (%s), input count %u.\n", ins.opcode, op_info->name, input_count); + TRACE("Opcode %#x (%s) (%u,%u), input count %u.\n", ins.opcode, op_info->name, + ins.comp_count, ins.scalar, input_count);
/* Inputs + one output */ param_count = input_count + 1; diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 25ac2d673ce..e318083d899 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -8148,13 +8148,17 @@ technique10 tech { SetBlendState( NULL, g_var.x + g_var2 + g_var.y, 0 ); } + pass p2 + { + SetBlendState( NULL, min(g_var.x, g_var2.x) + max(g_var.y, g_var2.y) + min(g_var, g_var2) + max(g_var, g_var2), 0 ); + } } #endif static DWORD fx_test_value_expression[] = { - 0x43425844, 0xe517f17c, 0xe44eaede, 0xe4fd1240, 0xc67d5084, 0x00000001, 0x0000047c, 0x00000001, - 0x00000024, 0x30315846, 0x00000450, 0xfeff1001, 0x00000001, 0x00000002, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000330, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x43425844, 0x998fdf90, 0xbfa437be, 0x8d71413d, 0xe31c8b21, 0x00000001, 0x00000703, 0x00000001, + 0x00000024, 0x30315846, 0x000006d7, 0xfeff1001, 0x00000001, 0x00000002, 0x00000000, 0x00000000, + 0x00000000, 0x00000000, 0x00000001, 0x0000057b, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x6f6c4724, 0x736c6162, 0x6f6c6600, 0x00347461, 0x0000000d, 0x00000001, 0x00000000, 0x00000010, 0x00000010, 0x00000010, 0x0000210a, 0x61765f67, 0x5f670072, 0x32726176, 0x63657400, 0x30700068, 0x00016000, @@ -8181,13 +8185,34 @@ static DWORD fx_test_value_expression[] = 0x00000000, 0x00000002, 0x00000004, 0x00000000, 0x00000007, 0x00000000, 0xa0400004, 0x00000002, 0x00000000, 0x00000002, 0x00000001, 0x00000000, 0x00000007, 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000001, 0x00000002, 0x00000000, 0x00000001, - 0x00000002, 0x00000000, 0x00000004, 0x00000020, 0x00000000, 0x00000002, 0xffffffff, 0x00000000, - 0x00000030, 0x00000014, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000036, - 0x00000014, 0x00000000, 0x00000010, 0x00000000, 0x00000000, 0x00000000, 0x0000003d, 0x00000002, - 0x00000000, 0x00000042, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x00000045, - 0x0000000b, 0x00000000, 0x00000001, 0x000001a9, 0x00000002, 0x00000000, 0x00000001, 0x000001b5, - 0x000001c1, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x000001c4, 0x0000000b, - 0x00000000, 0x00000001, 0x00000318, 0x00000002, 0x00000000, 0x00000001, 0x00000324, + 0x00000002, 0x00000000, 0x2c003270, 0x44000002, 0x9e434258, 0xfae994e0, 0xb641b826, 0x0bac8f3a, + 0x019d4eb7, 0x2c000000, 0x03000002, 0x2c000000, 0xd4000000, 0xe0000000, 0x43000000, 0xa0424154, + 0x1c000000, 0x77000000, 0x00000000, 0x02465804, 0x1c000000, 0x00000000, 0x74000001, 0x44000000, + 0x02000000, 0x01000000, 0x4c000000, 0x00000000, 0x5c000000, 0x02000000, 0x01000100, 0x64000000, + 0x00000000, 0x67000000, 0x7261765f, 0x01abab00, 0x01000300, 0x01000400, 0x00000000, 0x67000000, + 0x7261765f, 0x01ab0032, 0x01000300, 0x01000400, 0x00000000, 0x74000000, 0x694d0078, 0x736f7263, + 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, 0x20726564, 0x706d6f43, 0x72656c69, 0x2e303120, + 0x43ab0031, 0x0434494c, 0x00000000, 0x46000000, 0x44434c58, 0x07000001, 0x01000000, 0x02200000, + 0x00000000, 0x02000000, 0x00000000, 0x00000000, 0x02000000, 0x04000000, 0x00000000, 0x07000000, + 0x00000000, 0x01000000, 0x02201000, 0x00000000, 0x02000000, 0x01000000, 0x00000000, 0x02000000, + 0x05000000, 0x00000000, 0x07000000, 0x01000000, 0x01000000, 0x02204000, 0x00000000, 0x07000000, + 0x01000000, 0x00000000, 0x07000000, 0x00000000, 0x00000000, 0x07000000, 0x04000000, 0x04000000, + 0x02200000, 0x00000000, 0x02000000, 0x00000000, 0x00000000, 0x02000000, 0x04000000, 0x00000000, + 0x07000000, 0x00000000, 0x04000000, 0x02a04000, 0x00000000, 0x07000000, 0x04000000, 0x00000000, + 0x07000000, 0x00000000, 0x00000000, 0x07000000, 0x08000000, 0x04000000, 0x02201000, 0x00000000, + 0x02000000, 0x00000000, 0x00000000, 0x02000000, 0x04000000, 0x00000000, 0x07000000, 0x00000000, + 0x04000000, 0x02204000, 0x00000000, 0x07000000, 0x00000000, 0x00000000, 0x07000000, 0x08000000, + 0x00000000, 0x04000000, 0x00000000, 0xf0000000, 0x0ff0f0f0, 0xff0f0f0f, 0x010000ff, 0x02000000, + 0x00000000, 0x01000000, 0x02000000, 0x00000000, 0x04000000, 0x20000000, 0x00000000, 0x02000000, + 0xff000000, 0x00ffffff, 0x30000000, 0x14000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x36000000, 0x14000000, 0x00000000, 0x10000000, 0x00000000, 0x00000000, 0x00000000, + 0x3d000000, 0x03000000, 0x00000000, 0x42000000, 0x03000000, 0x00000000, 0x0a000000, 0x00000000, + 0x06000000, 0x45000000, 0x0b000000, 0x00000000, 0x01000000, 0xa9000000, 0x02000001, 0x00000000, + 0x01000000, 0xb5000000, 0xc1000001, 0x03000001, 0x00000000, 0x0a000000, 0x00000000, 0x06000000, + 0xc4000000, 0x0b000001, 0x00000000, 0x01000000, 0x18000000, 0x02000003, 0x00000000, 0x01000000, + 0x24000000, 0x30000003, 0x03000003, 0x00000000, 0x0a000000, 0x00000000, 0x06000000, 0x33000000, + 0x0b000003, 0x00000000, 0x01000000, 0x63000000, 0x02000005, 0x00000000, 0x01000000, 0x6f000000, + 0x00000005, };
static void test_effect_value_expression(void)