コード例 #1
0
        private unsafe void DrawFrame(double obj)
        {
            var fence = _inFlightFences[_currentFrame];

            _vk.WaitForFences(_device, 1, in fence, Vk.True, ulong.MaxValue);

            uint   imageIndex;
            Result result = _vkSwapchain.AcquireNextImage
                                (_device, _swapchain, ulong.MaxValue, _imageAvailableSemaphores[_currentFrame], default, &imageIndex);
コード例 #2
0
ファイル: VulkanEngine.cs プロジェクト: HurricanKai/Videre
        private void Render()
        {
            _renderGraph.PreRun(_currentFrame);
            var currentFrame = _frames[_currentFrame];
            var waitCode     = _vk.WaitForFences(_logicalDevice, 1, currentFrame.RenderFence, true, ulong.MaxValue);

            waitCode.ThrowCode();

            _vk.ResetFences(_logicalDevice, 1, currentFrame.RenderFence);

            var  aquireSemaphore = currentFrame.AquireSemaphore;
            uint imageIndex      = 0;

            _khrSwapchain.AcquireNextImage(_logicalDevice, _swapchain, UInt64.MaxValue, aquireSemaphore, default,
コード例 #3
0
        private unsafe void DrawFrame(double delta)
        {
            // Make sure ImGui is up-to-date before rendering
            _imGuiController.Update((float)delta);

            // This is where you'll tell ImGui what to draw.
            // For now, we'll just show their built-in demo window.
            ImGuiNET.ImGui.ShowDemoWindow();

            var fence = _inFlightFences[_currentFrame];

            _vk.WaitForFences(_device, 1, in fence, Vk.True, ulong.MaxValue);

            uint   imageIndex;
            Result result = _vkSwapchain.AcquireNextImage
                                (_device, _swapchain, ulong.MaxValue, _imageAvailableSemaphores[_currentFrame], default, &imageIndex);
コード例 #4
0
ファイル: VulkanDisplay.cs プロジェクト: Ryujinx/Ryujinx
        internal VulkanCommandBufferPool.VulkanCommandBuffer StartPresentation()
        {
            _nextImage = 0;
            while (true)
            {
                var acquireResult = _swapchainExtension.AcquireNextImage(
                    _device.InternalHandle,
                    _swapchain,
                    ulong.MaxValue,
                    _semaphorePair.ImageAvailableSemaphore,
                    new Fence(),
                    ref _nextImage);

                if (acquireResult == Result.ErrorOutOfDateKhr ||
                    acquireResult == Result.SuboptimalKhr)
                {
                    Recreate();
                }
                else
                {
                    acquireResult.ThrowOnError();
                    break;
                }
            }

            var commandBuffer = CommandBufferPool.CreateCommandBuffer();

            commandBuffer.BeginRecording();

            VulkanMemoryHelper.TransitionLayout(_device, commandBuffer.InternalHandle,
                                                _swapchainImages[_nextImage], ImageLayout.Undefined,
                                                AccessFlags.AccessNoneKhr,
                                                ImageLayout.TransferDstOptimal,
                                                AccessFlags.AccessTransferWriteBit,
                                                1);

            return(commandBuffer);
        }