protected void ResizeSwapChain() { Device.PrintLiveObjects(); Debug.WriteLine("===="); foreach (var resource in Device.PresenterResources) { resource.Dispose(); } for (int i = 0; i < BackBufferCount; i++) { BackBuffers[i].Dispose(); } BackBuffer.Dispose(); Device.PrintLiveObjects(); NativeSwapChain.ResizeBuffers( BackBufferCount, Description.Width, Description.Height, Format.B8G8R8A8_UNorm, SwapChainFlags.None); BackBuffer.Initialize(NativeSwapChain.GetBackBuffer <Resource>(BackBufferIndex)); for (int i = 0; i < BackBufferCount; i++) { BackBuffers[i].Initialize(NativeSwapChain.GetBackBuffer <Resource>(i)); } foreach (var resource in Device.PresenterResources) { resource.Recreate(); } }
public void Present() { NativeSwapChain.Present(0, PresentFlags.None); BackBufferIndex = NativeSwapChain.CurrentBackBufferIndex; BackBuffer.Resource.Dispose(); BackBuffer.Initialize(NativeSwapChain.GetBackBuffer <Resource>(BackBufferIndex)); compiledCommandLists.ForEach(c => c.Release()); compiledCommandLists.Clear(); }