[ad_1]
I’ve learn:
Threading setup
Main thread (Main loop): Create window and run the message pump (PeekMessage()).
Add messages (keyboard, mouse, …) to a thread protected double buffered queue.
Render thread (Render loop): Create DirectX 11 stuff (Device, …).
Read sport state N from sport thread. Update GPU buffers, draw calls, swapchain current.
Game Thread (Game loop): Create sport world. Game logic, physics, replace sport state N + 1.
Thread pool: spawn extra employee threads.
According to the posted hyperlinks, DXGI could name ShipMessage (synchronous name), which may result in impasse
when the message pump and DXGI are on separate threads. But so far as I perceive it,
there should not be any issues on this case with the primary thread, as a result of the one factor it does is to
pump messages and add them to a thread protected queue. or am I lacking one thing?
Can a impasse nonetheless happen when switching to an unique fullscreen mode?
Calling the swapchain current? or different DXGI calls?
I will not add some other code in the primary thread that might make the message pump thread wait on the render thread.
If that is okay, how do I scale back the CPU utilization in the primary thread? Running this loop will eat 100% of the CPU core.
But on the identical time, we would like the enter to really feel responsive.
[ad_2]