d3d10/effect: Implement 'mov' opcode for expressions.

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
This commit is contained in:
Nikolay Sivov 2023-09-15 17:04:16 +02:00 committed by Alexandre Julliard
parent 5626be6bb8
commit 0fac6c11f2
2 changed files with 65 additions and 17 deletions

View file

@ -207,6 +207,15 @@ struct preshader_instr
typedef void (*pres_op_func)(float **args, unsigned int n, const struct preshader_instr *instr);
static void pres_mov(float **args, unsigned int n, const struct preshader_instr *instr)
{
float *retval = args[1];
unsigned int i;
for (i = 0; i < instr->comp_count; ++i)
retval[i] = args[0][i];
}
static void pres_neg(float **args, unsigned int n, const struct preshader_instr *instr)
{
float *retval = args[1];
@ -487,6 +496,7 @@ struct preshader_op_info
static const struct preshader_op_info preshader_ops[] =
{
{ 0x100, "mov", pres_mov },
{ 0x101, "neg", pres_neg },
{ 0x103, "rcp", pres_rcp },
{ 0x104, "frc", pres_frc },

View file

@ -7761,13 +7761,17 @@ technique10 tech
SetBlendState(NULL, fv1_a[1], i2_a[1]);
SetDepthStencilState(NULL, i1_a[1]);
}
pass P2
{
SetBlendState(NULL, f1, 0);
}
}
#endif
static DWORD fx_test_effect_dynamic_numeric_field[] =
{
0x43425844, 0xc53c7634, 0x9d90c190, 0x5a0b43ea, 0x77aab553, 0x00000001, 0x000003af, 0x00000001,
0x00000024, 0x30315846, 0x00000383, 0xfeff1001, 0x00000001, 0x00000007, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000001, 0x00000197, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x43425844, 0xec585518, 0x7c866383, 0xf6e767fd, 0x019e1f41, 0x00000001, 0x00000562, 0x00000001,
0x00000024, 0x30315846, 0x00000536, 0xfeff1001, 0x00000001, 0x00000007, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000001, 0x0000030e, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x6f6c4724,
0x736c6162, 0x6e697500, 0x000d0074, 0x00010000, 0x00000000, 0x00040000, 0x00100000, 0x00040000,
0x09190000, 0x31690000, 0x00000d00, 0x00000100, 0x00000200, 0x00001400, 0x00001000, 0x00000800,
@ -7781,20 +7785,34 @@ static DWORD fx_test_effect_dynamic_numeric_field[] =
0x00000000, 0x00000400, 0x00001000, 0x00000400, 0x00090900, 0x00316600, 0x3e99999a, 0x68636574,
0x00305000, 0x00000001, 0x00000002, 0x00000000, 0x00000001, 0x00000002, 0x00000000, 0xa5003150,
0x04000000, 0x0e000000, 0x04000001, 0x01000000, 0x02000000, 0x00000000, 0x4d000000, 0x04000000,
0x01000000, 0x02000000, 0x00000000, 0x04000000, 0x90000000, 0x00000000, 0x07000000, 0xff000000,
0x00ffffff, 0x2e000000, 0x12000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000,
0x4d000000, 0x31000000, 0x00000000, 0x10000000, 0x00000000, 0x00000000, 0x00000000, 0x75000000,
0x59000000, 0x00000000, 0x30000000, 0x79000000, 0x00000000, 0x00000000, 0xa5000000, 0x89000000,
0x00000000, 0x40000000, 0xab000000, 0x00000000, 0x00000000, 0xeb000000, 0xcf000000, 0x00000000,
0x60000000, 0xee000000, 0x00000000, 0x00000000, 0x0e000000, 0xf2000001, 0x00000000, 0x70000000,
0x13000000, 0x00000001, 0x00000000, 0x3d000000, 0x21000001, 0x00000001, 0x84000000, 0x40000000,
0x00000001, 0x00000000, 0x44000000, 0x02000001, 0x00000000, 0x49000000, 0x05000001, 0x00000000,
0x0a000000, 0x00000000, 0x02000000, 0x75000000, 0x0b000000, 0x00000000, 0x02000000, 0xeb000000,
0x02000000, 0x00000000, 0x01000000, 0x4c000000, 0x09000001, 0x00000000, 0x02000000, 0x2e000000,
0x01000000, 0x00000000, 0x01000000, 0x58000000, 0x64000001, 0x05000001, 0x00000000, 0x0a000000,
0x00000000, 0x03000000, 0x67000000, 0x0b000001, 0x00000000, 0x03000000, 0x6f000000, 0x02000001,
0x00000000, 0x01000000, 0x77000000, 0x09000001, 0x00000000, 0x03000000, 0x83000000, 0x01000001,
0x00000000, 0x01000000, 0x8b000000, 0x00000001,
0x01000000, 0x02000000, 0x00000000, 0x50000000, 0x01580032, 0x58440000, 0x4df04342, 0xad7a0608,
0xb4963c34, 0xe74c5ab9, 0x000151a3, 0x01580000, 0x00030000, 0x002c0000, 0x00b40000, 0x00c00000,
0x54430000, 0x00804241, 0x001c0000, 0x00570000, 0x04000000, 0x00014658, 0x001c0000, 0x01000000,
0x00540000, 0x00300000, 0x00020000, 0x00010000, 0x00340000, 0x00440000, 0x31660000, 0x0000ab00,
0x00010003, 0x00010001, 0x00000000, 0x999a0000, 0x00003e99, 0x00000000, 0x00000000, 0x78740000,
0x63694d00, 0x6f736f72, 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f,
0x2072656c, 0x312e3031, 0x4c43ab00, 0x00043449, 0x00000000, 0x58460000, 0x0090434c, 0x00040000,
0x00010000, 0x00011000, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00040000, 0x00000000,
0x00010000, 0x00011000, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00040000, 0x00010000,
0x00010000, 0x00011000, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00040000, 0x00020000,
0x00010000, 0x00011000, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00040000, 0x00030000,
0xf0f00000, 0x0f0ff0f0, 0xffff0f0f, 0x00010000, 0x00020000, 0x00000000, 0x00010000, 0x00020000,
0x00000000, 0x00040000, 0x00900000, 0x00000000, 0x00070000, 0xffff0000, 0x0000ffff, 0x002e0000,
0x00120000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x004d0000, 0x00310000,
0x00000000, 0x00100000, 0x00000000, 0x00000000, 0x00000000, 0x00750000, 0x00590000, 0x00000000,
0x00300000, 0x00790000, 0x00000000, 0x00000000, 0x00a50000, 0x00890000, 0x00000000, 0x00400000,
0x00ab0000, 0x00000000, 0x00000000, 0x00eb0000, 0x00cf0000, 0x00000000, 0x00600000, 0x00ee0000,
0x00000000, 0x00000000, 0x010e0000, 0x00f20000, 0x00000000, 0x00700000, 0x01130000, 0x00000000,
0x00000000, 0x013d0000, 0x01210000, 0x00000000, 0x00840000, 0x01400000, 0x00000000, 0x00000000,
0x01440000, 0x00030000, 0x00000000, 0x01490000, 0x00050000, 0x00000000, 0x000a0000, 0x00000000,
0x00020000, 0x00750000, 0x000b0000, 0x00000000, 0x00020000, 0x00eb0000, 0x00020000, 0x00000000,
0x00010000, 0x014c0000, 0x00090000, 0x00000000, 0x00020000, 0x002e0000, 0x00010000, 0x00000000,
0x00010000, 0x01580000, 0x01640000, 0x00050000, 0x00000000, 0x000a0000, 0x00000000, 0x00030000,
0x01670000, 0x000b0000, 0x00000000, 0x00030000, 0x016f0000, 0x00020000, 0x00000000, 0x00010000,
0x01770000, 0x00090000, 0x00000000, 0x00030000, 0x01830000, 0x00010000, 0x00000000, 0x00010000,
0x018b0000, 0x01970000, 0x00030000, 0x00000000, 0x000a0000, 0x00000000, 0x00060000, 0x019a0000,
0x000b0000, 0x00000000, 0x00010000, 0x02f60000, 0x00020000, 0x00000000, 0x00010000, 0x03020000,
0x00000000,
};
static void test_effect_dynamic_numeric_field(void)
@ -7882,6 +7900,26 @@ static void test_effect_dynamic_numeric_field(void)
ok(blend_factor[3] == 0.4f, "Got unexpected blend_factor[3] %.8e.\n", blend_factor[3]);
ok(sample_mask == 0x2, "Unexpected sample mask %#x.\n", sample_mask);
pass = tech->lpVtbl->GetPassByName(tech, "P2");
v = effect->lpVtbl->GetVariableByName(effect, "f1");
scalar = v->lpVtbl->AsScalar(v);
hr = scalar->lpVtbl->SetFloat(scalar, 0.123f);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
memset(blend_factor, 0, sizeof(blend_factor));
ID3D10Device_OMSetBlendState(device, NULL, blend_factor, 0);
hr = pass->lpVtbl->Apply(pass, 0);
ok(hr == S_OK, "Got unexpected hr %#lx.\n", hr);
ID3D10Device_OMGetDepthStencilState(device, &ds_state, &stencil_ref);
ok(stencil_ref == 0x4, "Unexpected stencil ref value %#x.\n", stencil_ref);
ID3D10Device_OMGetBlendState(device, &blend_state, blend_factor, &sample_mask);
ok(blend_factor[0] == 0.123f, "Got unexpected blend_factor[0] %.8e.\n", blend_factor[0]);
ok(blend_factor[1] == 0.123f, "Got unexpected blend_factor[1] %.8e.\n", blend_factor[1]);
ok(blend_factor[2] == 0.123f, "Got unexpected blend_factor[2] %.8e.\n", blend_factor[2]);
ok(blend_factor[3] == 0.123f, "Got unexpected blend_factor[3] %.8e.\n", blend_factor[3]);
ok(!sample_mask, "Unexpected sample mask %#x.\n", sample_mask);
effect->lpVtbl->Release(effect);
refcount = ID3D10Device_Release(device);