Skip to main content
gamedev.net
🔒 Locked

Multiple windows, multiple threads

Started by flobadob Mar 20, 2009 at 11:17 AM 1 replies 1.3k views
Original Post
flobadob
flobadob
I have multiple windows using d3d9. I share one device between them all. Each one has its own swap chain. Some of them have 3d content ( SetRenderTarget() -> BeginScene() -> EndScene() -> Present() ) and some of them display video frames ( GetDC() -> Present() ). Well thats a general overview of what I have anyway. Now the 3d window is fine when there is no video playing. Can rotate the scene around very fast. When I play video in another window, the 3d scene usually doesn't render correctly. It occasionally does but most of the time it's missing large chunks. I am guessing this is to do with a lack of any critical sections in the code. I put one around all the 3d rendering block but it doesn't make much difference. Not sure what bits of d3d need to be locked and whether or not to use the D3DCREATE_MULTITHREADED flag when creating the device?
Evil Steve
Evil Steve
If you access a single device from multiple threads, you need to use the D3DCREATE_MULTITHREADED flag. No exceptions.
flobadob
flobadob
OK thanks. I think I may have to do some of my own locking too? For instance from SetRenderTarget() right through to Present() on the 3d windows - or would that be SetRenderTarget() right through to EndScene()? What about GetDC on other surfaces, can they happen at the same time? I suspect that d3d9 will manage multiple calls to Present() at the same time?

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.