I had a question about the ID3D11DeviceContext for any DirectX11 gurus out there. I'm trying to add threads to my engine and it started crashing. After a quick google I discovered that you can't safely use the ID3D11DeviceContext in more than one thread without some sort of synchronization. I suppose I can put mutexes around things but then I noticed there was something called a deferred device context but I'm not exactly clear on the details of how it works. What I'm trying to do is create a new tree of meshes while rending the current tree of meshes. When the new tree is ready I'll do a swap. This is for LOD. At some point I want to do a fade in and out sort of thing, but for right now I'll just have the new tree blink in.
In any case I need the device context to do the rendering in one thread, but I also need it to create, map and unmap, vertex and index buffers in a second thread. My questions are:
1) Is there a standard way to do what I'm tying to do?
2) Is deferred rendering something I can use to achieve this, and if so is there a good online resource (preferably with examples) that someone can point me to?
Thanks
And while I'm at it, one more question.... If I'm using mutexes for this do I need to, or should I, hold the device context for the whole write to buffer, or can I just grab it for the map and release it, and then grab it again for the unmap and release it again?