I'm working on a UI system that does it's processing on a separate thread. However, the results of this processing must end up on the GPU eventually.
A simplified overview of the system boils down to this step happening in the 'rendering phase':
- Start at root widget (a widget is an object that controls what is rendered to the screen, and most importantly defines the hierarchical relation between controls).
- Render widget to screen.
- Iterate over all widget's children.
- For each child go back to step 2.
When a widget is determined to be static (render output not changing over a period of time) the system must be able to choose to cache it in a texture in GPU memory (RenderTarget2D).
There are some other things that can be cached such as VertexBuffers and IndexBuffers.
Because the UI system does all its compution on a separate thead (to avoid slowing down the other game processes) I'm concerned about what methods I can call on anything other than the game's rendering thread.
Concrete questions:
- What communication with the graphics device can be done from a separate thread?
- If the above depends on the card or drivers, how can I determine whether it supports those actions?