I've been wondering if there is some way to use the multithreading built into C++11 for DX12 instead of windows multithreading?
Can you use C++ multithreding with dx12?
How do you think the C++11 multithreading is implemented? It calls the Win32 APIs for threading. DX12's threading behavior is the same between C++11 threads and Win32 threads, because they are the same under the hood.
You can use any threading API. D3D doesn't create or interact with your threada directly.I've been wondering if there is some way to use the multithreading built into C++11 for DX12 instead of windows multithreading?
. 22 Racing Series .
How do you think the C++11 multithreading is implemented? It calls the Win32 APIs for threading. DX12's threading behavior is the same between C++11 threads and Win32 threads, because they are the same under the hood.
I know it uses win32 underneath but I didn't know if you could access this functionality directly or more accurately interacting with fences.
You can use any threading API. D3D doesn't create or interact with your threada directly.
For a fence you use WaitForSingleObject and an event. This is what I was referring to. What are the equivalent things in C++11?
-potential energy is easily made kinetic-
I understand now. No, as far as I know, there's no C++11 wrapper for a Win32 Event object, just critical sections, threads, condition variables, etc.
My team uses a relatively simple RAII wrapper around the Win32 APIs to make a C++ Event class. We've got a couple versions - ones that are closer to unique_ptr which don't allow copy, and ones which are closer to shared_ptr/CComPtr which use DuplicateHandle to copy.
There is no multi-threading built into DirectX but the management resources for you to do so are there.
Edit (wanted to add more info): In Dx12 you get data structures (command lists, allocators etc) which are usable in a multithreaded system. It does not matter which kind of threading API or libraries you'd use. As Directx12 doesn't necessarily expect STL threading or Windows threading. It only provides you graphics specific handles which you can use with any library you can dream of.
I recommend that you use a system where separate threads build command lists and the main thread submits them to the GPU.
Read the book 'C++ concurrency in action' if you want to learn more about threading.