I an writing in C++ and DirectX a visualization library for PC which opens multiple windows, each windows has its own scene and rendering loop, the user can update per window the data of the scene that he wants, so that the windows has a different
update time. I can expect to have between 4 and 6 windows open at each given time.
Currently I created windows which are handled each one in their own thread, have their own render loop and "their own device".
How expensive is to use multiple devices?
Is there a better way to achieve what I am doing with one device? If so how this is theoretically done in terms of: ImmediateContext, swapchain, backbuffer, renderTargetView?
Intuitively: Create one device with one immediate context, for each window create swapchain, backbuffer, endertargetView with the viewports, inputLayouts (and all other things at create stage) . Then per window render use the immediatecontext to set renderTargetsViews,
viewports and anything which can be set in the immediate context. When each window thread do the render I will need to protect it with a critical section (from the first call to the device in the render function, to the last). I am very not sure about this,
if is possible at all, and if is not too much expensive.
thanks,
Emanuel
Emanuel Shalev