Exemple #1
0
 public void Dispose()
 {
     _device.WaitIdle();
     _semaphorePair?.Dispose();
     DestroyCurrentImageViews();
     _swapchainExtension.DestroySwapchain(_device.InternalHandle, _swapchain, Span <AllocationCallbacks> .Empty);
     CommandBufferPool.Dispose();
 }
Exemple #2
0
        private void FramebufferResize(Vector2D <int> obj)
        {
            if (obj.X <= 0 || obj.Y <= 0)
            {
                return;
            }

            _khrSwapchain.DestroySwapchain(_logicalDevice, _swapchain, null);
            _khrSwapchain.CreateSwapchain(_logicalDevice,
                                          new SwapchainCreateInfoKHR(surface: _surface, minImageCount: 3, imageFormat: _swapchainFormat,
                                                                     imageColorSpace: _swapchainColorSpace, imageExtent: new Extent2D((uint)obj.X, (uint)obj.Y),
                                                                     imageArrayLayers: 1, imageUsage: ImageUsageFlags.ImageUsageTransferDstBit | ImageUsageFlags.ImageUsageStorageBit,
                                                                     imageSharingMode: SharingMode.Exclusive,
                                                                     queueFamilyIndexCount: 0, pQueueFamilyIndices: null, // ignored due to SharingMode.Exclusive
                                                                     presentMode: _presentMode, clipped: false,
                                                                     preTransform: SurfaceTransformFlagsKHR.SurfaceTransformIdentityBitKhr,
                                                                     compositeAlpha: CompositeAlphaFlagsKHR.CompositeAlphaOpaqueBitKhr), null, out _swapchain)
            .ThrowCode();

            uint swapchainCount = 0;

            _khrSwapchain.GetSwapchainImages(_logicalDevice, _swapchain, ref swapchainCount, null).ThrowCode();
            _swapchainImages = new Image[swapchainCount];

            fixed(Image *p = _swapchainImages)
            _khrSwapchain.GetSwapchainImages(_logicalDevice, _swapchain, ref swapchainCount, p).ThrowCode();

            _renderGraph.ChangeTargetImages((Vector2D <uint>)obj, _swapchainImages, _swapchainFormat, _swapchainColorSpace);
        }