Commit c336ce73 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

d3d10/effect: Add 'rcp' instruction support for expressions.

parent 6cb65804
......@@ -216,6 +216,15 @@ static void pres_neg(float **args, unsigned int n, const struct preshader_instr
retval[i] = -args[0][i];
}
static void pres_rcp(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] = 1.0f / args[0][i];
}
static void pres_sin(float **args, unsigned int n, const struct preshader_instr *instr)
{
float *retval = args[1];
......@@ -313,6 +322,7 @@ struct preshader_op_info
static const struct preshader_op_info preshader_ops[] =
{
{ 0x101, "neg", pres_neg },
{ 0x103, "rcp", pres_rcp },
{ 0x108, "sin", pres_sin },
{ 0x109, "cos", pres_cos },
{ 0x133, "ftou", pres_ftou },
......
......@@ -8171,13 +8171,17 @@ technique10 tech
{
SetBlendState( NULL, g_var.x / g_var, 0 );
}
pass p6
{
SetBlendState( NULL, 1.0f / g_var, 0 );
}
}
#endif
static DWORD fx_test_value_expression[] =
{
0x43425844, 0xb3aa52e8, 0x866f7138, 0xbdef210c, 0xdf2ba297, 0x00000001, 0x00000d87, 0x00000001,
0x00000024, 0x30315846, 0x00000d5b, 0xfeff1001, 0x00000001, 0x00000002, 0x00000001, 0x00000000,
0x00000000, 0x00000000, 0x00000001, 0x00000b23, 0x00000000, 0x00000000, 0x00000001, 0x00000000,
0x43425844, 0xd2081c75, 0x0e089a32, 0xcda030e3, 0xc28f5c06, 0x00000001, 0x00000f2e, 0x00000001,
0x00000024, 0x30315846, 0x00000f02, 0xfeff1001, 0x00000001, 0x00000002, 0x00000001, 0x00000000,
0x00000000, 0x00000000, 0x00000001, 0x00000c8e, 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, 0x70654400, 0x74536874, 0x69636e65,
......@@ -8267,23 +8271,36 @@ static DWORD fx_test_value_expression[] =
0x20726564, 0x706d6f43, 0x72656c69, 0x2e303120, 0x43ab0031, 0x0434494c, 0x00000000, 0x46000000,
0x3c434c58, 0x01000000, 0x04000000, 0x02a08000, 0x00000000, 0x02000000, 0x00000000, 0x00000000,
0x02000000, 0x00000000, 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, 0x6b000000, 0x4f000000, 0x00000000, 0xff000000, 0x01ffffff, 0x19000000,
0x00000000, 0x06000000, 0x74000000, 0x00000000, 0x64000000, 0x06000001, 0x00000000, 0x69000000,
0x03000001, 0x00000000, 0x0a000000, 0x00000000, 0x06000000, 0x6c000000, 0x0b000001, 0x00000000,
0x01000000, 0xb4000000, 0x02000003, 0x00000000, 0x01000000, 0xc0000000, 0xcc000003, 0x03000003,
0x00000000, 0x0a000000, 0x00000000, 0x06000000, 0xcf000000, 0x0b000003, 0x00000000, 0x01000000,
0x23000000, 0x02000005, 0x00000000, 0x01000000, 0x2f000000, 0x3b000005, 0x03000005, 0x00000000,
0x0a000000, 0x00000000, 0x06000000, 0x3e000000, 0x0b000005, 0x00000000, 0x01000000, 0x6e000000,
0x02000007, 0x00000000, 0x01000000, 0x7a000000, 0x86000007, 0x03000007, 0x00000000, 0x0a000000,
0x00000000, 0x06000000, 0x89000000, 0x0b000007, 0x00000000, 0x01000000, 0xb1000000, 0x02000008,
0x00000000, 0x01000000, 0xbd000000, 0xc9000008, 0x03000008, 0x00000000, 0x0a000000, 0x00000000,
0x06000000, 0xcc000000, 0x0b000008, 0x00000000, 0x01000000, 0xf4000000, 0x02000009, 0x00000000,
0x01000000, 0x00000000, 0x0c00000a, 0x0300000a, 0x00000000, 0x0a000000, 0x00000000, 0x06000000,
0x0f000000, 0x0b00000a, 0x00000000, 0x01000000, 0x0b000000, 0x0200000b, 0x00000000, 0x01000000,
0x17000000, 0x0000000b,
0x010000ff, 0x02000000, 0x00000000, 0x01000000, 0x02000000, 0x00000000, 0x70000000, 0x014c0036,
0x58440000, 0xb50f4342, 0xfed38746, 0x4134bf74, 0x029d0616, 0x0001dbbd, 0x014c0000, 0x00030000,
0x002c0000, 0x00a80000, 0x00b40000, 0x54430000, 0x00744241, 0x001c0000, 0x004b0000, 0x04000000,
0x00014658, 0x001c0000, 0x01000000, 0x00480000, 0x00300000, 0x00020000, 0x00010000, 0x00380000,
0x00000000, 0x5f670000, 0x00726176, 0x0001abab, 0x00010003, 0x00010004, 0x00000000, 0x78740000,
0x63694d00, 0x6f736f72, 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, 0x69706d6f,
0x2072656c, 0x312e3031, 0x4c43ab00, 0x00043449, 0x00000000, 0x58460000, 0x0090434c, 0x00040000,
0x00010000, 0x00011030, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00040000, 0x00000000,
0x00010000, 0x00011030, 0x00000000, 0x00020000, 0x00010000, 0x00000000, 0x00040000, 0x00010000,
0x00010000, 0x00011030, 0x00000000, 0x00020000, 0x00020000, 0x00000000, 0x00040000, 0x00020000,
0x00010000, 0x00011030, 0x00000000, 0x00020000, 0x00030000, 0x00000000, 0x00040000, 0x00030000,
0xf0f00000, 0x0f0ff0f0, 0xffff0f0f, 0x00010000, 0x00020000, 0x00000000, 0x00010000, 0x00020000,
0x00000000, 0x00040000, 0x00200000, 0x00000000, 0x00020000, 0xffff0000, 0x0000ffff, 0x00300000,
0x00140000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00360000, 0x00140000,
0x00000000, 0x00100000, 0x00000000, 0x00000000, 0x00000000, 0x006b0000, 0x004f0000, 0x00000000,
0xffff0000, 0x0001ffff, 0x00190000, 0x00000000, 0x00060000, 0x00740000, 0x00000000, 0x01640000,
0x00070000, 0x00000000, 0x01690000, 0x00030000, 0x00000000, 0x000a0000, 0x00000000, 0x00060000,
0x016c0000, 0x000b0000, 0x00000000, 0x00010000, 0x03b40000, 0x00020000, 0x00000000, 0x00010000,
0x03c00000, 0x03cc0000, 0x00030000, 0x00000000, 0x000a0000, 0x00000000, 0x00060000, 0x03cf0000,
0x000b0000, 0x00000000, 0x00010000, 0x05230000, 0x00020000, 0x00000000, 0x00010000, 0x052f0000,
0x053b0000, 0x00030000, 0x00000000, 0x000a0000, 0x00000000, 0x00060000, 0x053e0000, 0x000b0000,
0x00000000, 0x00010000, 0x076e0000, 0x00020000, 0x00000000, 0x00010000, 0x077a0000, 0x07860000,
0x00030000, 0x00000000, 0x000a0000, 0x00000000, 0x00060000, 0x07890000, 0x000b0000, 0x00000000,
0x00010000, 0x08b10000, 0x00020000, 0x00000000, 0x00010000, 0x08bd0000, 0x08c90000, 0x00030000,
0x00000000, 0x000a0000, 0x00000000, 0x00060000, 0x08cc0000, 0x000b0000, 0x00000000, 0x00010000,
0x09f40000, 0x00020000, 0x00000000, 0x00010000, 0x0a000000, 0x0a0c0000, 0x00030000, 0x00000000,
0x000a0000, 0x00000000, 0x00060000, 0x0a0f0000, 0x000b0000, 0x00000000, 0x00010000, 0x0b0b0000,
0x00020000, 0x00000000, 0x00010000, 0x0b170000, 0x0b230000, 0x00030000, 0x00000000, 0x000a0000,
0x00000000, 0x00060000, 0x0b260000, 0x000b0000, 0x00000000, 0x00010000, 0x0c760000, 0x00020000,
0x00000000, 0x00010000, 0x0c820000, 0x00000000,
};
static void test_effect_value_expression(void)
......@@ -8387,6 +8404,25 @@ static void test_effect_value_expression(void)
ok(blend_factor[3] == 1.0f / 4.0f, "Got unexpected blend_factor[3] %.8e.\n", blend_factor[3]);
ok(!sample_mask, "Got unexpected sample_mask %#x.\n", sample_mask);
/* rcp */
pass = t->lpVtbl->GetPassByName(t, "p6");
ok(pass->lpVtbl->IsValid(pass), "Expected valid pass.\n");
f[0] = 2.0f; f[1] = 3.0f; f[2] = 4.0f; f[3] = 5.0f;
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_state, "Unexpected blend state %p.\n", blend_state);
ok(blend_factor[0] == 1.0f / 2.0f, "Got unexpected blend_factor[0] %.8e.\n", blend_factor[0]);
ok(blend_factor[1] == 1.0f / 3.0f, "Got unexpected blend_factor[1] %.8e.\n", blend_factor[1]);
ok(blend_factor[2] == 1.0f / 4.0f, "Got unexpected blend_factor[2] %.8e.\n", blend_factor[2]);
ok(blend_factor[3] == 1.0f / 5.0f, "Got unexpected blend_factor[3] %.8e.\n", blend_factor[3]);
ok(!sample_mask, "Got unexpected sample_mask %#x.\n", sample_mask);
/* Mutable state objects. */
v = effect->lpVtbl->GetVariableByName(effect, "ds_state");
ds = v->lpVtbl->AsDepthStencil(v);
......
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