Device is being used by a thread other than the creation thread.

Hi,

My engine design is to create the Dx device and manage lost devices on the same thread, and to handle all resources operations and draw calls on another one. The application is responsible for all synchronizations between the two threads and ensure that no race condition could occur. Given that, D3DCREATE_MULTITHREADED flag is not needed because resources are always created, locked and used on the same single thread. So why is DirectX debug version sending me few warning messages "Device is being used by a thread other than the creation thread" on every Dx calls ? Is there something wrong in my design ?

Thanks

Guillaume

[666 byte] By [lib_team] at [2007-12-23]
# 1

A warning is just that, a warning. It doesn't mean that you're necessarily doing something wrong, just that you could be. In some cases certain calls related to device creation and reset must be called from the same thread that processes messages in your application's window. See "Multithreading Issues" in the DirectX SDK documention.

Also, simply handling resources on one thread and drawing on another isn't sufficient to eliminate the need to use D3DCREATE_MULTITHREADED. To do so, you need to ensure that all Direct3D calls are serialized, that you're never calling two methods at the same time even if they seem unrelated.

RossRidge at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: Graphics...
# 2

>>A warning is just that, a warning.

I totally agree. The point is that the directx debug lib cannot be used anymore cos those warnings are poluting the debug output and killing the fps.

>> See "Multithreading Issues" in the DirectX SDK documention.

I've read this documentation a hundred times.

>> Also, simply handling resources on one thread and drawing on another isn't sufficient to eliminate the need to use D3DCREATE_MULTITHREADED.

I still totally agree. But that's not exactly what I said. The main thread is doing the loop, device creation, reset and release. Resource management and all draw calls are done on a seperate thread. Synchronization (calls serialization) between the main thread and the other one is done by the application.

So I think I don't need D3DCREATE_MULTITHREADED for any good reason, but I need it to be able to use directx debug.

Is it possible to filter warnings, or should I design me application to handle every calls on the same thread ?

Many thanks

Guillaume

lib_team at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: Graphics...
# 3
Perhaps you could specify D3DCREATE_MULTITHREADED for builds where you want to examine the debug output, and don't specify it for other (release) builds?
RichardFine at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: Graphics...
# 4
Yes that's an idea. Is there a way to dectect that directx is running the debug build, or running a specific debug setting ?
lib_team at 2007-8-31 > top of Msdn Tech,Game Technologies: DirectX, XNA, XACT, etc.,Game Technologies: Graphics...