diff --git a/src/MoonWorksMultiWindowGame.cs b/src/MoonWorksMultiWindowGame.cs index 80ca2f5..b12d032 100644 --- a/src/MoonWorksMultiWindowGame.cs +++ b/src/MoonWorksMultiWindowGame.cs @@ -48,11 +48,15 @@ namespace MoonWorksMultiWindow protected override void Draw(System.TimeSpan dt, double alpha) { - Task mainDraw = Task.Run(MainDraw); - Task extraDraw = Task.Run(ExtraWindowDraw); + var mainDraw = Task.Run(MainDraw); + var extraDraw = Task.Run(ExtraWindowDraw); + + mainDraw.Wait(); + extraDraw.Wait(); + GraphicsDevice.Submit(mainDraw.Result, extraDraw.Result); } - private void MainDraw() + private CommandBuffer MainDraw() { var commandBuffer = GraphicsDevice.AcquireCommandBuffer(); @@ -77,10 +81,10 @@ namespace MoonWorksMultiWindow Window ); - GraphicsDevice.Submit(commandBuffer); + return commandBuffer; } - private void ExtraWindowDraw() + private CommandBuffer ExtraWindowDraw() { var commandBuffer = GraphicsDevice.AcquireCommandBuffer(); @@ -105,7 +109,7 @@ namespace MoonWorksMultiWindow ExtraWindow ); - GraphicsDevice.Submit(commandBuffer); + return commandBuffer; } } }