Dylan Smith : d3dx9/tests: Added tests for D3DXCreateSkinInfo.

Dylan Smith dylan.ah.smith at gmail.com
Fri Jun 24 10:04:07 CDT 2011


On Fri, Jun 24, 2011 at 10:19 AM, Stefan Dösinger
<stefandoesinger at gmx.at> wrote:
> On Friday 24 June 2011 16:01:21 Dylan Smith wrote:
>> On Fri, Jun 24, 2011 at 9:31 AM, Michael Stefaniuc <mstefani at redhat.com>
> wrote:
>> > this commit breaks compilation on my old RHEL5 box:
>> > dlls/d3dx9_36/tests/mesh.c:4813: error: ‘FP_NAN’ undeclared (first use
>> > in this function)
>>
>> Does the attached patch fix the problem.  It uses 0.0f / 0.0f like in
>> wined3d_private.h.
> Ya, visual studio reports a divide by zero error in this case :-/
>

I see.  I suppose NAN isn't crucial to the tests (the point is the
value is not checked), so I could assume the IEEE 745 standard since
it shouldn't break the tests if this assumption is wrong.

So how about the revised patch that uses memset to set all the bits to 1.

On Fri, Jun 24, 2011 at 10:56 AM, Dan Kegel <dank at kegel.com> wrote:
> Dylan wrote:
> -            exp_weights[1] = FP_NAN;
> +            exp_weights[1] = 0.0f / 0.0f;
>
> It's a bit strange to see 0 being replaced with infinity.  What is
> your intent in that line?
> FP_NAN probably isn't what you think it is.

0.0f / 0.0f seems to give NAN as a result, although using a comment or
an appropriately named variable would make it more readable.  The
intent is to show that the value isn't checked, since usually weights
are between 0.0 and 1.0.
-------------- next part --------------
diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c
index 54ef66b..8a87da3 100644
--- a/dlls/d3dx9_36/tests/mesh.c
+++ b/dlls/d3dx9_36/tests/mesh.c
@@ -4783,6 +4783,9 @@ static void test_create_skin_info(void)
             DWORD num_influences;
             DWORD exp_vertices[2];
             FLOAT exp_weights[2];
+            float nan_value;
+
+            memset(&nan_value, 0xff, sizeof(nan_value));
 
             /* vertex and weight arrays untouched when num_influences is 0 */
             vertices[0] = 0xdeadbeef;
@@ -4809,7 +4812,7 @@ static void test_create_skin_info(void)
             exp_vertices[0] = 0;
             exp_vertices[1] = 0x87654321;
             exp_weights[0] = 0.5;
-            exp_weights[1] = 0.0f / 0.0f;
+            exp_weights[1] = nan_value;
             num_influences = 2;
 
             hr = skininfo->lpVtbl->SetBoneInfluence(skininfo, 1, num_influences, vertices, weights);


More information about the wine-devel mailing list