I still have a great deal of uncertainty about what is and what is not thread safe in DX12.
I understand that ID3D12Device and ID3D12CommandQueue objects are free threaded. So your application only has to create one instance of these and can then use them on multiple threads that may call member functions of these objects simultaneously. On the other hand, ID3D12CommandAllocator and ID3D12GraphicsCommandList objects are not free threaded, so each thread needs to create its own instances of these.
But what about things like ID3D12RootSignature and ID3D12PipelineState? Can a single instance of these be used simultaneously on multiple threads?
Eg:
ID3D12CommandQueue* pCQ;
ID3D12GraphicsCommandList* pGCL_1;
ID3D12GraphicsCommandList* pGCL_2;
ID3D12RootSignature* pRS;
void Thread_1()
{
pGCL_1->SetGraphicsRootSignature( pRS );
//...
pCQ->ExecuteCommandLists( 1, &pGCL_1 );
}
void Thread_2()
{
pGCL_2->SetGraphicsRootSignature( pRS );
//...
pCQ->ExecuteCommandLists( 1, &pGCL_2 );
}
Whould this be safe to do? How can I tell what is being done to the shared ID3D12RootSignature object, and how do I know if it is thread safe?