Exemplo n.º 1
0
        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();
            }
        }
Exemplo n.º 2
0
        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();
        }