开发者

Direct3D 9 Creation and Releasing Threads?

I have an application that uses Direct3D for rendering viewports and it's made as a separate DLL module from the main application which links to it at run-time. The main application is a C# program.

The creation and initialization of Direct3D device and its resources are done on the native DLL end. The main C# program only request a window from this DLL. Now since the main GUI loop is in the C# executable, whenever a viewport is closed/destroyed it has to call a DLL function to request release of related Direct3D device/resources.

The problem is that upon trying to release the Direct3D device, the program panics. It says t开发者_运维百科hat a different thread (the main C# program I guess since it's sending the message to the DLL) than that created the device trying to release it.

Is there a work around this problem? Any thoughts?

I'm using Direct3D 9.

Help appreciated.


D3D Device calls all have thread affinity with the thread on which they were created.

You have to either marshal the call back to the main D3D thread, or initialize the device with D3DCREATE_MULTITHREADED in order to allow it to be used from multiple threads.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜