DirectX messes up other Threads!

This is my situation:

In my app I create a new form that renders directx things (simple meshes...)...
The DX (DirectX Feb 2006) form starts up it's own render loop, which runs until the form is disposed.

On another thread I run a control that displays a graph... When adding points to the control it calculates the DateTime value to it's internal format and then displays the form.

If the DX form is disabled (not even loaded) the graph works but if not then the graph doesn't work correctly as it calculates identical values for different dates!

Example:
without DX:
1.1.2006 20:10 => value 1
1.1.2006 20:34 => value 2

with DX:
1.1.2006 20:10 => value 3
1.1.2006 20:34 => value 3

What's happening ! Can DirectX disrupt other Threads



Answer this question

DirectX messes up other Threads!

  • DanR1

    update:

    This is what happens (values taken out of the debugger):

    sum1 2455210.5 double
    sum2 153.00050354003906 double
    sum3 -1534.5 double
    sum4 0.55550926923751831 double
    sum5 0.0000054166666814126074 double
    sumTotal 2453829.5 double

    But sumTotal SHOULD be: 2453829,5768515394083781326074
    but is instead rounded to one decimal
    so that's why two different DateTimes are rounded to the same value...

    What I still don't know is WHY this happens and why only when DirectX is running


  • the_apache

    DirectX switches the CPU into single prescision mode for speed. If you wish to keep high precisions for doubles then specify the FPU preserver flag when you create the device. Its not a threading issue. Plus remember that floating point is *always* just approximate anyway.

    However you should know that DX is not by default safe for multi threading so if you are doing DX things on multiple threads you should also enable the MultiThreaded flag

    http://msdn.microsoft.com/library/default.asp url=/library/en-us/directx9_m/directx/ref/ns/microsoft.directx.direct3d/e/createflags/createflags.asp



  • Fabrício Sperandio

    Thanks a lot for this answer...

    I really had no idea what was going on here...

    thanks,
    sa o


  • DirectX messes up other Threads!