On 9 March 2016 at 14:38, Paul Gofman gofmanp@gmail.com wrote:
+static float test_effect_preshader_fconstsv[][4] = +{
- {11.0, 12.0, 13.0, 0.0 },
- {21.0, 22.0, 23.0, 0.0 },
- {31.0, 32.0, 33.0, 0.0 },
- {41.0, 42.0, 43.0, 0.0 },
- {11.0, 21.0, 31.0, 0.0 },
- {12.0, 22.0, 32.0, 0.0 },
- {13.0, 23.0, 33.0, 0.0 },
- {14.0, 24.0, 34.0, 0.0 },
- {11.0, 12.0, 13.0, 14.0},
- {21.0, 22.0, 23.0, 24.0},
- {31.0, 32.0, 33.0, 34.0},
- {11.0, 21.0, 31.0, 41.0},
- {12.0, 22.0, 32.0, 42.0},
- {13.0, 23.0, 33.0, 43.0}
+};
+static float test_effect_preshader_fconstsp[][4] = +{
- {11.0, 21.0, 0.0 , 0.0 },
- {12.0, 22.0, 0.0 , 0.0 },
- {13.0, 23.0, 0.0 , 0.0 },
- {11.0, 12.0, 0.0 , 0.0 },
- {21.0, 22.0, 0.0 , 0.0 },
- {31.0, 32.0, 0.0 , 0.0 },
- {11.0, 12.0, 0.0 , 0.0 },
- {21.0, 22.0, 0.0 , 0.0 },
- {11.0, 21.0, 0.0 , 0.0 },
- {12.0, 22.0, 0.0 , 0.0 },
- {11.0, 12.0, 13.0, 0.0 },
- {21.0, 22.0, 23.0, 0.0 },
- {11.0, 21.0, 31.0, 0.0 },
- {12.0, 22.0, 32.0, 0.0 }
+};
+static BOOL test_effect_preshader_bconsts[] = +{
- 1, 0, 1, 0, 1, 0
+};
+static struct +{
- const char *comment;
- BOOL todo[4];
- DWORD result[4];
+} +test_effect_preshader_op_results[] = +{
- {"1 / op", {1, 1, 1, 1}, {0x7f800000, 0xff800000, 0xbee8ba2e, 0x00200000}},
- {"rsq", {1, 1, 3, 3}, {0x7f800000, 0x7f800000, 0x3f2c985d, 0x1f800000}},
- {"mul", {1, 1, 1, 1}, {0x00000000, 0x80000000, 0x40d33334, 0x7f800000}},
- {"add", {0, 1, 1, 1}, {0x3f800000, 0x40000000, 0xc0a66666, 0x7f7fffff}},
- {"lt", {0, 0, 1, 0}, {0x3f800000, 0x3f800000, 0x00000000, 0x00000000}},
- {"ge", {1, 1, 0, 1}, {0x00000000, 0x00000000, 0x3f800000, 0x3f800000}},
- {"neg", {1, 1, 1, 1}, {0x80000000, 0x00000000, 0x400ccccd, 0xff7fffff}},
- {"rcp", {1, 1, 1, 1}, {0x7f800000, 0xff800000, 0xbee8ba2e, 0x00200000}},
- {"frac", {0, 0, 1, 0}, {0x00000000, 0x00000000, 0x3f4ccccc, 0x00000000}},
- {"min", {0, 1, 1, 1}, {0x00000000, 0x80000000, 0xc0400000, 0x40800000}},
- {"max", {1, 1, 1, 1}, {0x3f800000, 0x40000000, 0xc00ccccd, 0x7f7fffff}},
- {"sin", {0, 1, 1, 3}, {0x00000000, 0x80000000, 0xbf4ef99e, 0xbf0599b3}},
- {"cos", {1, 1, 1, 3}, {0x3f800000, 0x3f800000, 0xbf16a803, 0x3f5a5f96}},
- {"den mul",{1, 1, 1, 1}, {0x7f800000, 0xff800000, 0xbb94f209, 0x000051ec}},
- {"dot", {0, 1, 1, 0}, {0x00000000, 0x7f800000, 0x41f00000, 0x00000000}}
+};
These should all be const. I'd probably use D3DXVECTOR4 for the float constant arrays.
+#define TEST_EFFECT_PRES_NFLOATV (sizeof(test_effect_preshader_fconstsv) / sizeof(*test_effect_preshader_fconstsv)) +#define TEST_EFFECT_PRES_NFLOATP (sizeof(test_effect_preshader_fconstsp) / sizeof(*test_effect_preshader_fconstsp)) +#define TEST_EFFECT_PRES_NFLOATMAX (TEST_EFFECT_PRES_NFLOATV > TEST_EFFECT_PRES_NFLOATP ? \
TEST_EFFECT_PRES_NFLOATV : TEST_EFFECT_PRES_NFLOATP)
+#define TEST_EFFECT_PRES_NBOOL (sizeof(test_effect_preshader_bconsts) / sizeof(*test_effect_preshader_bconsts)) +#define TEST_EFFECT_PRES_NOPTESTS (sizeof(test_effect_preshader_op_results) / \
sizeof(*test_effect_preshader_op_results))
I think you should either just write these out, or introduce an ARRAY_SIZE macro.
- const static D3DXVECTOR4 fvect1 = {28.0f, 29.0f, 30.0f, 31.0f};
- const static D3DXVECTOR4 fvect2 = {0.0f, 0.0f, 1.0f, 0.0f};
- const static float fvect_empty[] = {-9999.0f, -9999.0f, -9999.0f, -9999.0f};
This is not wrong, but the usual order is "static const".
todo_wine_if(!!bdata[i] != !!test_effect_preshader_bconsts[i])
You can write that as "!bdata[i] != !test_effect_preshader_bconsts[i]" without changing the meaning.
- todo_wine ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
%#x to make it clear it's a hexadecimal value. You don't need to print the expected value if it's a constant.
- hr = IDirect3DDevice9_GetVertexShader(device, &vshader);
- ok(hr == D3D_OK, "Got result %x, expected 0 (D3D_OK).\n", hr);
- ok(vshader != NULL, "Got NULL vshader.\n");
- if (vshader)
- {
That kind of thing is pointless, if "vshader" was NULL, the test would have failed.
- ok(vshader == NULL, "Incorrect shader selected.\n");
I would prefer those as "ok(!vshader, ...);", but it's just style.