Multi Threaded Direct3D
In the previous post I mentioned that I would look in to multi threaded rendering and I have done that. The minimal example attached and available for download is really simple sample, that creates a Direct3D device and cleans it.
If you would further apply the trick that is described on the 26 slide of Optimizing Direct X On Multi Core Architectures then I'm certain you can create something very flexible.
For example: If you need a vertex buffer, you lock the RenderingThread using [cci_cpp]RenderingThread::Lock[/cci_cpp] which will only be released once the [cci_cpp]CRITICAL_SECTION[/cci_cpp] has been released by another thread. Then you could ask the RenderingThread to create a wrapper of [cci_cpp]IDirect3DVertexBuffer9[/cci_cpp] which has added function that it will buffer everything and only update [cci_cpp]IDirect3DVertexBuffer9[/cci_cpp] inside the RenderingThread. If done correct you can easily multithread without having to worry about the following error message:
[ccWN_text]Direct3D9: (WARN)
evice that was created without D3DCREATE_MULTITHREADED is being used by a thread other than the creation thread.[/ccWN_text]
You can download the source code here: DirectXMultiThreaded.zip (source only)