[PATCH 5/5] d3dx9_36/tests: Added tests for ID3DXConstantTable_Set* functions

Matteo Bruni matteo.mystral at gmail.com
Thu Jan 20 10:48:23 CST 2011

2011/1/20 Travis Athougies <iammisc at gmail.com>:
> +static void test_setting_basic_table(IDirect3DDevice9 *device)
> +{
> +    static const D3DXMATRIX mvp = {
> +        0.514f, 0.626f, 0.804f, 0.786f,
> +        0.238f, 0.956f, 0.374f, 0.483f,
> +        0.109f, 0.586f, 0.900f, 0.255f,
> +        0.898f, 0.411f, 0.932f, 0.275f};

This throws some warnings here. Apparently you have to put some
additional braces around that initializer.

+    ok(out[0] == (float)iarray[0] && out[4] == (float)iarray[1] &&
out[8] == (float)iarray[2] &&
+            out[12] == (float)iarray[3], "SetIntArray did not
properly set a float array: out={%f, %f, %f, %f}, should"
+            " be {%d, %d, %d, %d}\n", out[0], out[4], out[8],
out[12], iarray[0], iarray[1], iarray[2], iarray[3]);

The float casts are unneeded.

The tests look generally OK to me otherwise, albeit they are somewhat
wordy. Oh, please notice that some tests fail on Windows. The testbot
can't create a d3d device so it skips these tests, but on my Win7 box
I get this:

shader.c:462: Test failed: The first row of mvp was not set correctly, got {0.51
4000, 0.238000, 0.109000, 0.898000}, should be {0.514000, 0.626000, 0.804000, 0.
shader.c:465: Test failed: The second row of mvp was not set correctly, got {0.6
26000, 0.956000, 0.586000, 0.411000}, should be {0.238000, 0.956000, 0.374000, 0
shader.c:468: Test failed: The third row of mvp was not set correctly, got {0.80
4000, 0.374000, 0.900000, 0.932000}, should be {0.109000, 0.586000, 0.900000, 0.
shader.c:471: Test failed: The fourth row of mvp was not set correctly, got {0.7
86000, 0.483000, 0.255000, 0.275000}, should be {0.898000, 0.411000, 0.932000, 0
shader.c:530: Test failed: The excess elements of the array were not set correct
ly, out={0.000000, 0.000000, 0.000000, 0.000000}, should be {0.010000, 0.020000,
 0.030000, 0.040000}
shader: 248 tests executed (0 marked as todo, 5 failures), 0 skipped.

The matrix seems to have its rows and columns switched (probably this
has to do with row-major vs column-major matrix storage -
So you have to fix your SetMatrixArray implementation to account for
that (and update the tests accordingly). The other failing test shows
that actually the excess elements are not set, apparently.

A last thing. I noticed that you never set the vertex shader in the
d3d9 device. I'd say: don't change that. This shows that
ID3DXConstantTable doesn't pay attention to the vertex shader
currently set and it is responsibility of the application programmer
to call these functions with the correct shader program.

More information about the wine-devel mailing list