Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

tbb and directx drawing

I'm trying to create a little multithreading engine with d3d (dx 11) with tbb.
I have a scenegraph and each "item" in this shenegraph can be a pointer or a copy of an object(texture,vertexbuffer,ecc...)that refers to a catalog system.
I can use a pointer to mesh , to texture ecc.. or an object instead of a pointer.
Clearly if i use a pointer, savings a lot of memory and band width.
but My problem is:
Is convenient to use a scenegraph with pointers in multithreading?
if i have a lot of pointers to the same resource i have more "problems", may be?
because I have a lot of thread waiting for read the same resource.
If I use objects or copies of objects ,I can resolve this problem?
for example in a parallel_for and a thread sheduler where i use render "work" like a task with tbb .
I ask this because i haven't experience in multithreading.
I also read about concurrent container in tbb ,are useful in this case?
This differs from nutshell example because i try to use dx 11 in multithreading Environment.
I read that dx 11 is thread safe , but i ask if there are some propietary methods for use this multithreading or i can use tbb also for this.
0 Kudos
1 Reply

I dokn't know enough about D3D to comment specfically, but can offere some general guideance. It's generally safe for multiple threads to concurrently read an object. If one thread is modifying an object, it's generally not safe for other threads to be reading or modifying the object. So generally you can use pointers to objects that are not going to be modified by concurrent threads, and need copies if they are going to be modified. If copies are going to be modified differently, you also need a way to reconcile the different modifications.

One common strategy for parallel rendering is to divide the screen up into patches and render each patch as a separate task. See the tachyon example that ships with TBB for an example of this strategy.

0 Kudos