dx9 multithreaded

Started by
4 comments, last by programmer_tom 17 years, 5 months ago
hey does anyone know a lot about multithreading in dx9? i've written a simple threaded loading screen that renders while a scene loads on the main thread. works fine (most of the time). i created a multithreaded device....wondering if there are restrictions on using threads to do directx calls. do i need to make the file loader the thread and the main app thread does the rendering? there is no object creation going on inside the graphics thread, so it's not that it's reading/writing without mutex locks. just once in a while, weird things go down after the loading like terrain geometry comes out all messed up etc. thanks -programmer_tom
Advertisement
The Forum Search (Well, Google search :P) brings up a lot of relevant threads. There's been 2 or 3 threads about it in the past couple of months too, having a look through the last two months or so of posts in this forum might be useful too.
I have a thread load assets while the screen shows one of those "Loading... " progress bars. No problems with multi-threading here. The DX docs say that locking is done internally.
are both threads creating / locking vertex buffers at the same time? is that valid?
So long as you call IDirect3DDevice9::Reset, IDirect3D9::CreateDevice, IDirect3DDevice9::TestCooperativeLevel, or the final Release of IDirect3DDevice9 from only the thread that handles your window messages (Probably the main thread). There shouldn't be any problems in locking vertex buffers from different threads, so long as your own application is aware of when context switches can occur (E.g. you don't free a buffer that's being copied into a vertex buffer from another thread), you should be safe.
thanks steve i'll keep that in mind. i'll find out whats going on eventually.

This topic is closed to new replies.

Advertisement