示例#1
0
        public override unsafe void Present()
        {
            try
            {
                var swapChainCopy          = swapChain;
                var currentBufferIndexCopy = currentBufferIndex;
                var presentInfo            = new PresentInfo
                {
                    StructureType  = StructureType.PresentInfo,
                    SwapchainCount = 1,
                    Swapchains     = new IntPtr(&swapChainCopy),
                    ImageIndices   = new IntPtr(&currentBufferIndexCopy),
                };

                // Present
                GraphicsDevice.NativeCommandQueue.Present(ref presentInfo);

                // Get next image
                currentBufferIndex = GraphicsDevice.NativeDevice.AcquireNextImage(swapChain, ulong.MaxValue, GraphicsDevice.GetNextPresentSemaphore(), Fence.Null);

                // Flip render targets
                backbuffer.SetNativeHandles(swapchainImages[currentBufferIndex].NativeImage, swapchainImages[currentBufferIndex].NativeColorAttachmentView);
            }
            catch (SharpVulkanException e) when(e.Result == Result.ErrorOutOfDate)
            {
                // TODO VULKAN
            }
        }