Signed-off-by: Nikolay Sivov nsivov@codeweavers.com
-- v2: d3d10/effect: Add 'frc' instruction support for expressions. d3d10/effect: Add 'rcp' instruction support for expressions. d3d10/effect: Add 'div' instruction support for expressions. d3d10/effect: Add 'ftob' instruction support for expressions. d3d10/effect: Partially implement updates through value expressions.
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 29 +++++++++++++++++++++++++++++ dlls/d3d10/tests/effect.c | 6 ------ 2 files changed, 29 insertions(+), 6 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 857e3bea70d..1b4f3ee5a36 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -800,6 +800,7 @@ static void d3d10_effect_update_dependent_props(struct d3d10_effect_prop_depende struct d3d10_effect_prop_dependency *d; unsigned int i, j, count, variable_idx; struct d3d10_effect_variable *v; + struct d3d10_reg_table *table; unsigned int *dst_index; uint32_t value; HRESULT hr; @@ -864,6 +865,34 @@ static void d3d10_effect_update_dependent_props(struct d3d10_effect_prop_depende } break;
+ case D3D10_EOO_VALUE_EXPRESSION: + + if ((property_info->container_type != D3D10_C_PASS) + || ((property_info->type != D3D10_SVT_UINT) && (property_info->type != D3D10_SVT_FLOAT))) + { + FIXME("Unimplemented for property %s.\n", property_info->name); + return; + } + + if (FAILED(hr = d3d10_effect_preshader_eval(&d->value_expr.value))) + { + WARN("Failed to evaluate value expression, hr %#lx.\n", hr); + return; + } + + table = &d->value_expr.value.reg_tables[D3D10_REG_TABLE_RESULT]; + + if (property_info->size != table->count) + { + WARN("Unexpected value expression output size %u, property size %u.\n", + table->count, property_info->size); + return; + } + + memcpy(dst, table->f, property_info->size * sizeof(float)); + + break; + default: FIXME("Unsupported property update for %u.\n", d->operation); } diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index ddaf72de2fa..11aa313f8d4 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -8314,13 +8314,10 @@ static void test_effect_value_expression(void)
ID3D10Device_OMGetBlendState(device, &blend_state, blend_factor, &sample_mask); ok(!blend_state, "Unexpected blend state %p.\n", blend_state); - todo_wine - { 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] == 0.1f, "Got unexpected blend_factor[2] %.8e.\n", blend_factor[2]); ok(blend_factor[3] == -3.0f, "Got unexpected blend_factor[3] %.8e.\n", blend_factor[3]); - } ok(!sample_mask, "Got unexpected sample_mask %#x.\n", sample_mask);
pass = t->lpVtbl->GetPassByName(t, "p4"); @@ -8331,13 +8328,10 @@ static void test_effect_value_expression(void)
ID3D10Device_OMGetBlendState(device, &blend_state, blend_factor, &sample_mask); ok(!blend_state, "Unexpected blend state %p.\n", blend_state); - todo_wine - { ok(blend_factor[0] == 2.0f, "Got unexpected blend_factor[0] %.8e.\n", blend_factor[0]); ok(blend_factor[1] == 1.1f, "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);
effect->lpVtbl->Release(effect);
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 20 +++- dlls/d3d10/tests/effect.c | 221 +++++++++++++++++++++++--------------- 2 files changed, 155 insertions(+), 86 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 1b4f3ee5a36..cd11ae34074 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -246,6 +246,18 @@ static void pres_ftou(float **args, unsigned int n, const struct preshader_instr } }
+static void pres_ftob(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) + { + unsigned int u = args[0][i] == 0.0f ? 0 : ~0u; + retval[i] = *(float *)&u; + } +} + static void pres_min(float **args, unsigned int n, const struct preshader_instr *instr) { float *retval = args[2]; @@ -295,6 +307,7 @@ static const struct preshader_op_info preshader_ops[] = { 0x108, "sin", pres_sin }, { 0x109, "cos", pres_cos }, { 0x133, "ftou", pres_ftou }, + { 0x137, "ftob", pres_ftob }, { 0x200, "min", pres_min }, { 0x201, "max", pres_max }, { 0x204, "add", pres_add }, @@ -867,8 +880,9 @@ static void d3d10_effect_update_dependent_props(struct d3d10_effect_prop_depende
case D3D10_EOO_VALUE_EXPRESSION:
- if ((property_info->container_type != D3D10_C_PASS) - || ((property_info->type != D3D10_SVT_UINT) && (property_info->type != D3D10_SVT_FLOAT))) + if ((property_info->type != D3D10_SVT_UINT) + && (property_info->type != D3D10_SVT_FLOAT) + && (property_info->type != D3D10_SVT_BOOL)) { FIXME("Unimplemented for property %s.\n", property_info->name); return; @@ -8864,6 +8878,8 @@ static HRESULT STDMETHODCALLTYPE d3d10_effect_depth_stencil_variable_GetBackingS if (!(v = d3d10_get_state_variable(v, index, &v->effect->ds_states))) return E_FAIL;
+ d3d10_effect_update_dependent_props(&v->u.state.dependencies, &v->u.state.desc); + *desc = v->u.state.desc.depth_stencil;
return S_OK; diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 11aa313f8d4..7fb4f7581b1 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -22,6 +22,7 @@ #include "wine/test.h"
#include <float.h> +#include <math.h>
#define D3DERR_INVALIDCALL 0x8876086c
@@ -8138,6 +8139,12 @@ static void test_effect_index_expression(void) #if 0 float4 g_var; float4 g_var2; + +DepthStencilState ds_state +{ + StencilEnable = g_var.x; +}; + technique10 tech { pass p0 @@ -8164,99 +8171,111 @@ technique10 tech #endif static DWORD fx_test_value_expression[] = { - 0x43425844, 0x1cd6bc1c, 0x8025a693, 0x09d5d4d0, 0xc0da1b6c, 0x00000001, 0x00000ae5, 0x00000001, - 0x00000024, 0x30315846, 0x00000ab9, 0xfeff1001, 0x00000001, 0x00000002, 0x00000000, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x000008e5, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x43425844, 0xf580dcc6, 0xa9d229ae, 0x14b1f1d5, 0x3c8c456c, 0x00000001, 0x00000c34, 0x00000001, + 0x00000024, 0x30315846, 0x00000c08, 0xfeff1001, 0x00000001, 0x00000002, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000001, 0x00000a0c, 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, 0x63657400, 0x30700068, 0x00024400, - 0x42584400, 0xff104243, 0xa078c06f, 0xb9d7d003, 0x421eb8c7, 0x0000014c, 0x00024400, 0x00000300, - 0x00002c00, 0x0000d400, 0x0000f000, 0x41544300, 0x0000a042, 0x00001c00, 0x00007700, 0x58040000, - 0x00000246, 0x00001c00, 0x00010000, 0x00007400, 0x00004400, 0x00000200, 0x00000100, 0x00004c00, - 0x00000000, 0x00005c00, 0x01000200, 0x00000100, 0x00006400, 0x00000000, 0x765f6700, 0xab007261, - 0x030001ab, 0x04000100, 0x00000100, 0x00000000, 0x765f6700, 0x00327261, 0x030001ab, 0x04000100, - 0x00000100, 0x00000000, 0x00787400, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, - 0x65646168, 0x6f432072, 0x6c69706d, 0x31207265, 0x00312e30, 0x494c43ab, 0x00001434, 0x00000400, - 0xcccccd00, 0x0666663d, 0x00000040, 0x00000000, 0x4c584600, 0x00014c43, 0x00000800, 0x10000400, - 0x00000110, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000700, 0x00000000, 0x80000100, - 0x00000110, 0x00000000, 0x00000200, 0x00000000, 0x00000000, 0x00000700, 0x00000400, 0x40000400, - 0x000002a0, 0x00000000, 0x00000700, 0x00000400, 0x00000000, 0x00000700, 0x00000000, 0x00000000, - 0x00000700, 0x00000800, 0x90000100, 0x00000110, 0x00000000, 0x00000200, 0x00000100, 0x00000000, - 0x00000700, 0x00000000, 0x40000400, 0x000002a0, 0x00000000, 0x00000700, 0x00000000, 0x00000000, - 0x00000700, 0x00000800, 0x00000000, 0x00000700, 0x00000400, 0x40000400, 0x000002a0, 0x00000000, - 0x00000100, 0x00000000, 0x00000000, 0x00000700, 0x00000400, 0x00000000, 0x00000700, 0x00000000, - 0x50000400, 0x000002a0, 0x00000000, 0x00000100, 0x00000100, 0x00000000, 0x00000200, 0x00000400, - 0x00000000, 0x00000700, 0x00000400, 0x40000400, 0x00000220, 0x00000000, 0x00000700, 0x00000000, - 0x00000000, 0x00000700, 0x00000400, 0x00000000, 0x00000400, 0x00000000, 0xf0f0f000, 0x0f0f0ff0, - 0x00ffff0f, 0x00000100, 0x00000200, 0x00000000, 0x00000100, 0x00000200, 0x00000000, 0x00317000, - 0x00000150, 0x43425844, 0xc6a29e4c, 0x6292ed35, 0xd90bb8cb, 0x50dcd25f, 0x00000001, 0x00000150, - 0x00000003, 0x0000002c, 0x000000d4, 0x000000e0, 0x42415443, 0x000000a0, 0x0000001c, 0x00000077, - 0x46580400, 0x00000002, 0x0000001c, 0x00000100, 0x00000074, 0x00000044, 0x00000002, 0x00000001, - 0x0000004c, 0x00000000, 0x0000005c, 0x00010002, 0x00000001, 0x00000064, 0x00000000, 0x61765f67, - 0xabab0072, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x61765f67, 0xab003272, 0x00030001, + 0x00000010, 0x0000210a, 0x61765f67, 0x5f670072, 0x32726176, 0x70654400, 0x74536874, 0x69636e65, + 0x6174536c, 0x3d006574, 0x02000000, 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x03000000, + 0x64000000, 0x74735f73, 0x00657461, 0x000000ec, 0x43425844, 0x79125440, 0x90f05fca, 0xfe55a99c, + 0x45e16165, 0x00000001, 0x000000ec, 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, 0x00000068, 0x00000002, 0xa0400004, 0x00000002, 0x00000000, 0x00000002, - 0x00000000, 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, 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, 0x70000000, 0x01240033, 0x58440000, - 0xf4c54342, 0x070658ce, 0xcabd2023, 0x24d22fca, 0x00010f0c, 0x01240000, 0x00030000, 0x002c0000, - 0x00d40000, 0x00e00000, 0x54430000, 0x00a04241, 0x001c0000, 0x00770000, 0x04000000, 0x00024658, - 0x001c0000, 0x01000000, 0x00740000, 0x00440000, 0x00020000, 0x00010000, 0x004c0000, 0x00000000, - 0x005c0000, 0x00020000, 0x00010001, 0x00640000, 0x00000000, 0x5f670000, 0x00726176, 0x0001abab, - 0x00010003, 0x00010004, 0x00000000, 0x5f670000, 0x32726176, 0x0001ab00, 0x00010003, 0x00010004, - 0x00000000, 0x78740000, 0x63694d00, 0x6f736f72, 0x28207466, 0x48202952, 0x204c534c, 0x64616853, - 0x43207265, 0x69706d6f, 0x2072656c, 0x312e3031, 0x4c43ab00, 0x00043449, 0x00000000, 0x58460000, - 0x003c434c, 0x00010000, 0x00040000, 0x0002a000, 0x00000000, 0x00020000, 0x00000000, 0x00000000, - 0x00020000, 0x00040000, 0x00000000, 0x00040000, 0x00000000, 0xf0f00000, 0x0f0ff0f0, 0xffff0f0f, - 0x00010000, 0x00020000, 0x00000000, 0x00010000, 0x00020000, 0x00000000, 0x34700000, 0x00012400, - 0x42584400, 0xc902bb43, 0xafcba635, 0xa383ff89, 0xed53a9f6, 0x000001f8, 0x00012400, 0x00000300, - 0x00002c00, 0x0000d400, 0x0000e000, 0x41544300, 0x0000a042, 0x00001c00, 0x00007700, 0x58040000, - 0x00000246, 0x00001c00, 0x00010000, 0x00007400, 0x00004400, 0x00000200, 0x00000100, 0x00004c00, - 0x00000000, 0x00005c00, 0x01000200, 0x00000100, 0x00006400, 0x00000000, 0x765f6700, 0xab007261, - 0x030001ab, 0x04000100, 0x00000100, 0x00000000, 0x765f6700, 0x00327261, 0x030001ab, 0x04000100, - 0x00000100, 0x00000000, 0x00787400, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, - 0x65646168, 0x6f432072, 0x6c69706d, 0x31207265, 0x00312e30, 0x494c43ab, 0x00000434, 0x00000000, - 0x4c584600, 0x00003c43, 0x00000100, 0x10000400, 0x000002a0, 0x00000000, 0x00000200, 0x00000000, - 0x00000000, 0x00000200, 0x00000400, 0x00000000, 0x00000400, 0x00000000, 0xf0f0f000, 0x0f0f0ff0, - 0x00ffff0f, 0x00000100, 0x00000200, 0x00000000, 0x00000100, 0x00000200, 0x00000000, 0x00000400, - 0x00002000, 0x00000000, 0x00000200, 0xffffff00, 0x000000ff, 0x00003000, 0x00001400, 0x00000000, - 0x00000000, 0x00000000, 0x00000000, 0x00000000, 0x00003600, 0x00001400, 0x00000000, 0x00001000, - 0x00000000, 0x00000000, 0x00000000, 0x00003d00, 0x00000500, 0x00000000, 0x00004200, 0x00000300, - 0x00000000, 0x00000a00, 0x00000000, 0x00000600, 0x00004500, 0x00000b00, 0x00000000, 0x00000100, - 0x00028d00, 0x00000200, 0x00000000, 0x00000100, 0x00029900, 0x0002a500, 0x00000300, 0x00000000, - 0x00000a00, 0x00000000, 0x00000600, 0x0002a800, 0x00000b00, 0x00000000, 0x00000100, 0x0003fc00, - 0x00000200, 0x00000000, 0x00000100, 0x00040800, 0x00041400, 0x00000300, 0x00000000, 0x00000a00, - 0x00000000, 0x00000600, 0x00041700, 0x00000b00, 0x00000000, 0x00000100, 0x00064700, 0x00000200, - 0x00000000, 0x00000100, 0x00065300, 0x00065f00, 0x00000300, 0x00000000, 0x00000a00, 0x00000000, - 0x00000600, 0x00066200, 0x00000b00, 0x00000000, 0x00000100, 0x00078a00, 0x00000200, 0x00000000, - 0x00000100, 0x00079600, 0x0007a200, 0x00000300, 0x00000000, 0x00000a00, 0x00000000, 0x00000600, - 0x0007a500, 0x00000b00, 0x00000000, 0x00000100, 0x0008cd00, 0x00000200, 0x00000000, 0x00000100, - 0x0008d900, 0x00000000, + 0x00000000, 0x434c5846, 0x00000030, 0x00000001, 0x13700001, 0x00000001, 0x00000000, 0x00000002, + 0x00000000, 0x00000000, 0x00000004, 0x00000000, 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x68636574, + 0x00307000, 0x00000244, 0x43425844, 0x6fff1042, 0x03a078c0, 0xc7b9d7d0, 0x4c421eb8, 0x00000001, + 0x00000244, 0x00000003, 0x0000002c, 0x000000d4, 0x000000f0, 0x42415443, 0x000000a0, 0x0000001c, + 0x00000077, 0x46580400, 0x00000002, 0x0000001c, 0x00000100, 0x00000074, 0x00000044, 0x00000002, + 0x00000001, 0x0000004c, 0x00000000, 0x0000005c, 0x00010002, 0x00000001, 0x00000064, 0x00000000, + 0x61765f67, 0xabab0072, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x61765f67, 0xab003272, + 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, + 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x34494c43, + 0x00000014, 0x00000004, 0x3dcccccd, 0x40066666, 0x00000000, 0x00000000, 0x434c5846, 0x0000014c, + 0x00000008, 0x10100004, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000007, + 0x00000000, 0x10800001, 0x00000001, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000007, + 0x00000004, 0xa0400004, 0x00000002, 0x00000000, 0x00000007, 0x00000004, 0x00000000, 0x00000007, + 0x00000000, 0x00000000, 0x00000007, 0x00000008, 0x10900001, 0x00000001, 0x00000000, 0x00000002, + 0x00000001, 0x00000000, 0x00000007, 0x00000000, 0xa0400004, 0x00000002, 0x00000000, 0x00000007, + 0x00000000, 0x00000000, 0x00000007, 0x00000008, 0x00000000, 0x00000007, 0x00000004, 0xa0400004, + 0x00000002, 0x00000000, 0x00000001, 0x00000000, 0x00000000, 0x00000007, 0x00000004, 0x00000000, + 0x00000007, 0x00000000, 0xa0500004, 0x00000002, 0x00000000, 0x00000001, 0x00000001, 0x00000000, + 0x00000002, 0x00000004, 0x00000000, 0x00000007, 0x00000004, 0x20400004, 0x00000002, 0x00000000, + 0x00000007, 0x00000000, 0x00000000, 0x00000007, 0x00000004, 0x00000000, 0x00000004, 0x00000000, + 0xf0f0f0f0, 0x0f0f0f0f, 0x0000ffff, 0x00000001, 0x00000002, 0x00000000, 0x00000001, 0x00000002, + 0x00000000, 0x50003170, 0x44000001, 0x4c434258, 0x35c6a29e, 0xcb6292ed, 0x5fd90bb8, 0x0150dcd2, + 0x50000000, 0x03000001, 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, 0x68434c58, 0x02000000, 0x04000000, 0x02a04000, 0x00000000, + 0x02000000, 0x00000000, 0x00000000, 0x02000000, 0x04000000, 0x00000000, 0x07000000, 0x00000000, + 0x04000000, 0x02a04000, 0x00000000, 0x02000000, 0x01000000, 0x00000000, 0x07000000, 0x00000000, + 0x00000000, 0x04000000, 0x00000000, 0xf0000000, 0x0ff0f0f0, 0xff0f0f0f, 0x010000ff, 0x02000000, + 0x00000000, 0x01000000, 0x02000000, 0x00000000, 0x70000000, 0x022c0032, 0x58440000, 0xe09e4342, + 0x26fae994, 0x3ab641b8, 0xb70bac8f, 0x00019d4e, 0x022c0000, 0x00030000, 0x002c0000, 0x00d40000, + 0x00e00000, 0x54430000, 0x00a04241, 0x001c0000, 0x00770000, 0x04000000, 0x00024658, 0x001c0000, + 0x01000000, 0x00740000, 0x00440000, 0x00020000, 0x00010000, 0x004c0000, 0x00000000, 0x005c0000, + 0x00020000, 0x00010001, 0x00640000, 0x00000000, 0x5f670000, 0x00726176, 0x0001abab, 0x00010003, + 0x00010004, 0x00000000, 0x5f670000, 0x32726176, 0x0001ab00, 0x00010003, 0x00010004, 0x00000000, + 0x78740000, 0x63694d00, 0x6f736f72, 0x28207466, 0x48202952, 0x204c534c, 0x64616853, 0x43207265, + 0x69706d6f, 0x2072656c, 0x312e3031, 0x4c43ab00, 0x00043449, 0x00000000, 0x58460000, 0x0144434c, + 0x00070000, 0x00010000, 0x00022000, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00020000, + 0x00040000, 0x00000000, 0x00070000, 0x00000000, 0x00010000, 0x00022010, 0x00000000, 0x00020000, + 0x00010000, 0x00000000, 0x00020000, 0x00050000, 0x00000000, 0x00070000, 0x00010000, 0x00010000, + 0x00022040, 0x00000000, 0x00070000, 0x00010000, 0x00000000, 0x00070000, 0x00000000, 0x00000000, + 0x00070000, 0x00040000, 0x00040000, 0x00022000, 0x00000000, 0x00020000, 0x00000000, 0x00000000, + 0x00020000, 0x00040000, 0x00000000, 0x00070000, 0x00000000, 0x00040000, 0x0002a040, 0x00000000, + 0x00070000, 0x00040000, 0x00000000, 0x00070000, 0x00000000, 0x00000000, 0x00070000, 0x00080000, + 0x00040000, 0x00022010, 0x00000000, 0x00020000, 0x00000000, 0x00000000, 0x00020000, 0x00040000, + 0x00000000, 0x00070000, 0x00000000, 0x00040000, 0x00022040, 0x00000000, 0x00070000, 0x00000000, + 0x00000000, 0x00070000, 0x00080000, 0x00000000, 0x00040000, 0x00000000, 0xf0f00000, 0x0f0ff0f0, + 0xffff0f0f, 0x00010000, 0x00020000, 0x00000000, 0x00010000, 0x00020000, 0x00000000, 0x33700000, + 0x00012400, 0x42584400, 0xcef4c543, 0x23070658, 0xcacabd20, 0x0c24d22f, 0x0000010f, 0x00012400, + 0x00000300, 0x00002c00, 0x0000d400, 0x0000e000, 0x41544300, 0x0000a042, 0x00001c00, 0x00007700, + 0x58040000, 0x00000246, 0x00001c00, 0x00010000, 0x00007400, 0x00004400, 0x00000200, 0x00000100, + 0x00004c00, 0x00000000, 0x00005c00, 0x01000200, 0x00000100, 0x00006400, 0x00000000, 0x765f6700, + 0xab007261, 0x030001ab, 0x04000100, 0x00000100, 0x00000000, 0x765f6700, 0x00327261, 0x030001ab, + 0x04000100, 0x00000100, 0x00000000, 0x00787400, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, + 0x53204c53, 0x65646168, 0x6f432072, 0x6c69706d, 0x31207265, 0x00312e30, 0x494c43ab, 0x00000434, + 0x00000000, 0x4c584600, 0x00003c43, 0x00000100, 0x00000400, 0x000002a0, 0x00000000, 0x00000200, + 0x00000000, 0x00000000, 0x00000200, 0x00000400, 0x00000000, 0x00000400, 0x00000000, 0xf0f0f000, + 0x0f0f0ff0, 0x00ffff0f, 0x00000100, 0x00000200, 0x00000000, 0x00000100, 0x00000200, 0x00000000, + 0x00347000, 0x00000124, 0x43425844, 0x35c902bb, 0x89afcba6, 0xf6a383ff, 0xf8ed53a9, 0x00000001, + 0x00000124, 0x00000003, 0x0000002c, 0x000000d4, 0x000000e0, 0x42415443, 0x000000a0, 0x0000001c, + 0x00000077, 0x46580400, 0x00000002, 0x0000001c, 0x00000100, 0x00000074, 0x00000044, 0x00000002, + 0x00000001, 0x0000004c, 0x00000000, 0x0000005c, 0x00010002, 0x00000001, 0x00000064, 0x00000000, + 0x61765f67, 0xabab0072, 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x61765f67, 0xab003272, + 0x00030001, 0x00040001, 0x00000001, 0x00000000, 0x4d007874, 0x6f726369, 0x74666f73, 0x29522820, + 0x534c4820, 0x6853204c, 0x72656461, 0x6d6f4320, 0x656c6970, 0x30312072, 0xab00312e, 0x34494c43, + 0x00000004, 0x00000000, 0x434c5846, 0x0000003c, 0x00000001, 0xa0100004, 0x00000002, 0x00000000, + 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 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, 0x0000006b, 0x0000004f, 0x00000000, + 0xffffffff, 0x00000001, 0x00000019, 0x00000000, 0x00000006, 0x00000074, 0x00000000, 0x00000164, + 0x00000005, 0x00000000, 0x00000169, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, + 0x0000016c, 0x0000000b, 0x00000000, 0x00000001, 0x000003b4, 0x00000002, 0x00000000, 0x00000001, + 0x000003c0, 0x000003cc, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x000003cf, + 0x0000000b, 0x00000000, 0x00000001, 0x00000523, 0x00000002, 0x00000000, 0x00000001, 0x0000052f, + 0x0000053b, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x0000053e, 0x0000000b, + 0x00000000, 0x00000001, 0x0000076e, 0x00000002, 0x00000000, 0x00000001, 0x0000077a, 0x00000786, + 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x00000789, 0x0000000b, 0x00000000, + 0x00000001, 0x000008b1, 0x00000002, 0x00000000, 0x00000001, 0x000008bd, 0x000008c9, 0x00000003, + 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x000008cc, 0x0000000b, 0x00000000, 0x00000001, + 0x000009f4, 0x00000002, 0x00000000, 0x00000001, 0x00000a00, };
static void test_effect_value_expression(void) { ID3D10EffectVectorVariable *g_var, *g_var2; + ID3D10EffectDepthStencilVariable *ds; + D3D10_DEPTH_STENCIL_DESC ds_desc; ID3D10BlendState *blend_state; float f[4], blend_factor[4]; ID3D10EffectTechnique *t; @@ -8334,6 +8353,40 @@ static void test_effect_value_expression(void) 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);
+ /* Mutable state objects. */ + v = effect->lpVtbl->GetVariableByName(effect, "ds_state"); + ds = v->lpVtbl->AsDepthStencil(v); + + f[0] = 1.0f; f[1] = 2.0f; f[2] = 3.0f; f[3] = 4.0f; + hr = g_var->lpVtbl->SetFloatVector(g_var, f); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ds->lpVtbl->GetBackingStore(ds, 0, &ds_desc); + ok(ds_desc.StencilEnable == 0xffffffff, "Got unexpected StencilEnable %#x.\n", ds_desc.StencilEnable); + + f[0] = 0.0f; + hr = g_var->lpVtbl->SetFloatVector(g_var, f); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ds->lpVtbl->GetBackingStore(ds, 0, &ds_desc); + ok(!ds_desc.StencilEnable, "Got unexpected StencilEnable %#x.\n", ds_desc.StencilEnable); + + f[0] = -0.1f; + hr = g_var->lpVtbl->SetFloatVector(g_var, f); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ds->lpVtbl->GetBackingStore(ds, 0, &ds_desc); + ok(ds_desc.StencilEnable == 0xffffffff, "Got unexpected StencilEnable %#x.\n", ds_desc.StencilEnable); + + f[0] = 0.0f; + hr = g_var->lpVtbl->SetFloatVector(g_var, f); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ds->lpVtbl->GetBackingStore(ds, 0, &ds_desc); + ok(!ds_desc.StencilEnable, "Got unexpected StencilEnable %#x.\n", ds_desc.StencilEnable); + + f[0] = NAN; + hr = g_var->lpVtbl->SetFloatVector(g_var, f); + ok(hr == S_OK, "Unexpected hr %#lx.\n", hr); + ds->lpVtbl->GetBackingStore(ds, 0, &ds_desc); + ok(ds_desc.StencilEnable == 0xffffffff, "Got unexpected StencilEnable %#x.\n", ds_desc.StencilEnable); + effect->lpVtbl->Release(effect);
refcount = ID3D10Device_Release(device);
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 10 ++++++ dlls/d3d10/tests/effect.c | 68 +++++++++++++++++++++++++++++---------- 2 files changed, 61 insertions(+), 17 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index cd11ae34074..f191babc576 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -294,6 +294,15 @@ static void pres_mul(float **args, unsigned int n, const struct preshader_instr retval[i] = args[0][instr->scalar ? 0 : i] * args[1][i]; }
+static void pres_div(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] = args[0][instr->scalar ? 0 : i] / args[1][i]; +} + struct preshader_op_info { int opcode; @@ -312,6 +321,7 @@ static const struct preshader_op_info preshader_ops[] = { 0x201, "max", pres_max }, { 0x204, "add", pres_add }, { 0x205, "mul", pres_mul }, + { 0x208, "div", pres_div }, };
static int __cdecl preshader_op_compare(const void *a, const void *b) diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 7fb4f7581b1..5984a527a6a 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -8167,13 +8167,17 @@ technique10 tech { SetBlendState( NULL, max(g_var.x, g_var2), 0 ); } + pass p5 + { + SetBlendState( NULL, g_var.x / g_var, 0 ); + } } #endif static DWORD fx_test_value_expression[] = { - 0x43425844, 0xf580dcc6, 0xa9d229ae, 0x14b1f1d5, 0x3c8c456c, 0x00000001, 0x00000c34, 0x00000001, - 0x00000024, 0x30315846, 0x00000c08, 0xfeff1001, 0x00000001, 0x00000002, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000a0c, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x43425844, 0xb3aa52e8, 0x866f7138, 0xbdef210c, 0xdf2ba297, 0x00000001, 0x00000d87, 0x00000001, + 0x00000024, 0x30315846, 0x00000d5b, 0xfeff1001, 0x00000001, 0x00000002, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000001, 0x00000b23, 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, @@ -8255,20 +8259,31 @@ static DWORD fx_test_value_expression[] = 0x00000004, 0x00000000, 0x434c5846, 0x0000003c, 0x00000001, 0xa0100004, 0x00000002, 0x00000000, 0x00000002, 0x00000000, 0x00000000, 0x00000002, 0x00000004, 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, 0x0000006b, 0x0000004f, 0x00000000, - 0xffffffff, 0x00000001, 0x00000019, 0x00000000, 0x00000006, 0x00000074, 0x00000000, 0x00000164, - 0x00000005, 0x00000000, 0x00000169, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, - 0x0000016c, 0x0000000b, 0x00000000, 0x00000001, 0x000003b4, 0x00000002, 0x00000000, 0x00000001, - 0x000003c0, 0x000003cc, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x000003cf, - 0x0000000b, 0x00000000, 0x00000001, 0x00000523, 0x00000002, 0x00000000, 0x00000001, 0x0000052f, - 0x0000053b, 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x0000053e, 0x0000000b, - 0x00000000, 0x00000001, 0x0000076e, 0x00000002, 0x00000000, 0x00000001, 0x0000077a, 0x00000786, - 0x00000003, 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x00000789, 0x0000000b, 0x00000000, - 0x00000001, 0x000008b1, 0x00000002, 0x00000000, 0x00000001, 0x000008bd, 0x000008c9, 0x00000003, - 0x00000000, 0x0000000a, 0x00000000, 0x00000006, 0x000008cc, 0x0000000b, 0x00000000, 0x00000001, - 0x000009f4, 0x00000002, 0x00000000, 0x00000001, 0x00000a00, + 0x00000000, 0xf8003570, 0x44000000, 0x93434258, 0x0bf74bf8, 0x9e3d094d, 0xfff013f9, 0x0199d86f, + 0xf8000000, 0x03000000, 0x2c000000, 0xa8000000, 0xb4000000, 0x43000000, 0x74424154, 0x1c000000, + 0x4b000000, 0x00000000, 0x01465804, 0x1c000000, 0x00000000, 0x48000001, 0x30000000, 0x02000000, + 0x01000000, 0x38000000, 0x00000000, 0x67000000, 0x7261765f, 0x01abab00, 0x01000300, 0x01000400, + 0x00000000, 0x74000000, 0x694d0078, 0x736f7263, 0x2074666f, 0x20295228, 0x4c534c48, 0x61685320, + 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, };
static void test_effect_value_expression(void) @@ -8353,6 +8368,25 @@ static void test_effect_value_expression(void) 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);
+ /* div */ + pass = t->lpVtbl->GetPassByName(t, "p5"); + ok(pass->lpVtbl->IsValid(pass), "Expected valid pass.\n"); + + f[0] = 1.0f; f[1] = 2.0f; f[2] = 3.0f; f[3] = 4.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, "Got unexpected blend_factor[0] %.8e.\n", blend_factor[0]); + ok(blend_factor[1] == 1.0f / 2.0f, "Got unexpected blend_factor[1] %.8e.\n", blend_factor[1]); + ok(blend_factor[2] == 1.0f / 3.0f, "Got unexpected blend_factor[2] %.8e.\n", blend_factor[2]); + 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); + /* Mutable state objects. */ v = effect->lpVtbl->GetVariableByName(effect, "ds_state"); ds = v->lpVtbl->AsDepthStencil(v);
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 10 ++++++ dlls/d3d10/tests/effect.c | 76 ++++++++++++++++++++++++++++----------- 2 files changed, 66 insertions(+), 20 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index f191babc576..21f41def5be 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -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 }, diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index 5984a527a6a..bdaf07be434 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -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);
From: Nikolay Sivov nsivov@codeweavers.com
Signed-off-by: Nikolay Sivov nsivov@codeweavers.com --- dlls/d3d10/effect.c | 10 +++++ dlls/d3d10/tests/effect.c | 80 +++++++++++++++++++++++++++++---------- 2 files changed, 69 insertions(+), 21 deletions(-)
diff --git a/dlls/d3d10/effect.c b/dlls/d3d10/effect.c index 21f41def5be..2b9c391023a 100644 --- a/dlls/d3d10/effect.c +++ b/dlls/d3d10/effect.c @@ -225,6 +225,15 @@ static void pres_rcp(float **args, unsigned int n, const struct preshader_instr retval[i] = 1.0f / args[0][i]; }
+static void pres_frc(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] - floor(args[0][i]); +} + static void pres_sin(float **args, unsigned int n, const struct preshader_instr *instr) { float *retval = args[1]; @@ -323,6 +332,7 @@ static const struct preshader_op_info preshader_ops[] = { { 0x101, "neg", pres_neg }, { 0x103, "rcp", pres_rcp }, + { 0x104, "frc", pres_frc }, { 0x108, "sin", pres_sin }, { 0x109, "cos", pres_cos }, { 0x133, "ftou", pres_ftou }, diff --git a/dlls/d3d10/tests/effect.c b/dlls/d3d10/tests/effect.c index bdaf07be434..a2892efec70 100644 --- a/dlls/d3d10/tests/effect.c +++ b/dlls/d3d10/tests/effect.c @@ -8175,13 +8175,17 @@ technique10 tech { SetBlendState( NULL, 1.0f / g_var, 0 ); } + pass p7 + { + SetBlendState( NULL, frac(g_var), 0 ); + } } #endif static DWORD fx_test_value_expression[] = { - 0x43425844, 0xd2081c75, 0x0e089a32, 0xcda030e3, 0xc28f5c06, 0x00000001, 0x00000f2e, 0x00000001, - 0x00000024, 0x30315846, 0x00000f02, 0xfeff1001, 0x00000001, 0x00000002, 0x00000001, 0x00000000, - 0x00000000, 0x00000000, 0x00000001, 0x00000c8e, 0x00000000, 0x00000000, 0x00000001, 0x00000000, + 0x43425844, 0x52c4c6e1, 0x3efe62d7, 0xce564377, 0x35213200, 0x00000001, 0x00001075, 0x00000001, + 0x00000024, 0x30315846, 0x00001049, 0xfeff1001, 0x00000001, 0x00000002, 0x00000001, 0x00000000, + 0x00000000, 0x00000000, 0x00000001, 0x00000d99, 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, @@ -8283,26 +8287,41 @@ static DWORD fx_test_value_expression[] = 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, + 0x00000000, 0x37700000, 0x0000ec00, 0x42584400, 0x67aa4243, 0xe24a7796, 0x86419cce, 0xdf743a20, + 0x000001e1, 0x0000ec00, 0x00000300, 0x00002c00, 0x0000a800, 0x0000b400, 0x41544300, 0x00007442, + 0x00001c00, 0x00004b00, 0x58040000, 0x00000146, 0x00001c00, 0x00010000, 0x00004800, 0x00003000, + 0x00000200, 0x00000100, 0x00003800, 0x00000000, 0x765f6700, 0xab007261, 0x030001ab, 0x04000100, + 0x00000100, 0x00000000, 0x00787400, 0x7263694d, 0x666f736f, 0x52282074, 0x4c482029, 0x53204c53, + 0x65646168, 0x6f432072, 0x6c69706d, 0x31207265, 0x00312e30, 0x494c43ab, 0x00000434, 0x00000000, + 0x4c584600, 0x00003043, 0x00000100, 0x40000400, 0x00000110, 0x00000000, 0x00000200, 0x00000000, + 0x00000000, 0x00000400, 0x00000000, 0xf0f0f000, 0x0f0f0ff0, 0x00ffff0f, 0x00000100, 0x00000200, + 0x00000000, 0x00000100, 0x00000200, 0x00000000, 0x00000400, 0x00002000, 0x00000000, 0x00000200, + 0xffffff00, 0x000000ff, 0x00003000, 0x00001400, 0x00000000, 0x00000000, 0x00000000, 0x00000000, + 0x00000000, 0x00003600, 0x00001400, 0x00000000, 0x00001000, 0x00000000, 0x00000000, 0x00000000, + 0x00006b00, 0x00004f00, 0x00000000, 0xffffff00, 0x000001ff, 0x00001900, 0x00000000, 0x00000600, + 0x00007400, 0x00000000, 0x00016400, 0x00000800, 0x00000000, 0x00016900, 0x00000300, 0x00000000, + 0x00000a00, 0x00000000, 0x00000600, 0x00016c00, 0x00000b00, 0x00000000, 0x00000100, 0x0003b400, + 0x00000200, 0x00000000, 0x00000100, 0x0003c000, 0x0003cc00, 0x00000300, 0x00000000, 0x00000a00, + 0x00000000, 0x00000600, 0x0003cf00, 0x00000b00, 0x00000000, 0x00000100, 0x00052300, 0x00000200, + 0x00000000, 0x00000100, 0x00052f00, 0x00053b00, 0x00000300, 0x00000000, 0x00000a00, 0x00000000, + 0x00000600, 0x00053e00, 0x00000b00, 0x00000000, 0x00000100, 0x00076e00, 0x00000200, 0x00000000, + 0x00000100, 0x00077a00, 0x00078600, 0x00000300, 0x00000000, 0x00000a00, 0x00000000, 0x00000600, + 0x00078900, 0x00000b00, 0x00000000, 0x00000100, 0x0008b100, 0x00000200, 0x00000000, 0x00000100, + 0x0008bd00, 0x0008c900, 0x00000300, 0x00000000, 0x00000a00, 0x00000000, 0x00000600, 0x0008cc00, + 0x00000b00, 0x00000000, 0x00000100, 0x0009f400, 0x00000200, 0x00000000, 0x00000100, 0x000a0000, + 0x000a0c00, 0x00000300, 0x00000000, 0x00000a00, 0x00000000, 0x00000600, 0x000a0f00, 0x00000b00, + 0x00000000, 0x00000100, 0x000b0b00, 0x00000200, 0x00000000, 0x00000100, 0x000b1700, 0x000b2300, + 0x00000300, 0x00000000, 0x00000a00, 0x00000000, 0x00000600, 0x000b2600, 0x00000b00, 0x00000000, + 0x00000100, 0x000c7600, 0x00000200, 0x00000000, 0x00000100, 0x000c8200, 0x000c8e00, 0x00000300, + 0x00000000, 0x00000a00, 0x00000000, 0x00000600, 0x000c9100, 0x00000b00, 0x00000000, 0x00000100, + 0x000d8100, 0x00000200, 0x00000000, 0x00000100, 0x000d8d00, 0x00000000, };
+static float get_frc(float v) +{ + return v - floor(v); +} + static void test_effect_value_expression(void) { ID3D10EffectVectorVariable *g_var, *g_var2; @@ -8423,6 +8442,25 @@ static void test_effect_value_expression(void) 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);
+ /* frc */ + pass = t->lpVtbl->GetPassByName(t, "p7"); + ok(pass->lpVtbl->IsValid(pass), "Expected valid pass.\n"); + + f[0] = 0.0f; f[1] = 3.1f; f[2] = -4.2f; f[3] = 0.1f; + 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] == get_frc(f[0]), "Got unexpected blend_factor[0] %.8e.\n", blend_factor[0]); + ok(blend_factor[1] == get_frc(f[1]), "Got unexpected blend_factor[1] %.8e.\n", blend_factor[1]); + ok(blend_factor[2] == get_frc(f[2]), "Got unexpected blend_factor[2] %.8e.\n", blend_factor[2]); + ok(blend_factor[3] == get_frc(f[3]), "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);
On Thu Dec 1 20:31:49 2022 +0000, Matteo Bruni wrote:
Evil thought: what happens with NaN on native?
Pushed a test for this.
This merge request was approved by Matteo Bruni.