Esempio n. 1
0
        protected override void OnResize()
        {
            base.OnResize();

            dev.WaitIdle();

            vkvgSurf?.Dispose();
            vkvgSurf = new vkvg.Surface(vkvgDev, (int)Width, (int)Height);
            vkvgSurf.Clear();

            VkImage srcImg = new VkImage((ulong)vkvgSurf.VkImage.ToInt64());

            for (int i = 0; i < swapChain.ImageCount; ++i)
            {
                cmds[i] = cmdPool.AllocateCommandBuffer();
                cmds[i].Start();

                Utils.setImageLayout(cmds[i].Handle, swapChain.images[i].Handle, VkImageAspectFlags.Color,
                                     VkImageLayout.Undefined, VkImageLayout.TransferDstOptimal,
                                     VkPipelineStageFlags.BottomOfPipe, VkPipelineStageFlags.Transfer);
                Utils.setImageLayout(cmds[i].Handle, srcImg, VkImageAspectFlags.Color,
                                     VkImageLayout.ColorAttachmentOptimal, VkImageLayout.TransferSrcOptimal,
                                     VkPipelineStageFlags.ColorAttachmentOutput, VkPipelineStageFlags.Transfer);

                VkImageSubresourceLayers imgSubResLayer = new VkImageSubresourceLayers
                {
                    aspectMask     = VkImageAspectFlags.Color,
                    mipLevel       = 0,
                    baseArrayLayer = 0,
                    layerCount     = 1
                };
                VkImageCopy cregion = new VkImageCopy
                {
                    srcSubresource = imgSubResLayer,
                    srcOffset      = default,
Esempio n. 2
0
 void recreateSurface()
 {
     vkvgImage?.Dispose();
     vkvgSurf?.Dispose();
     vkvgSurf = new vkvg.Surface(vkvgDev, (int)swapChain.Width, (int)swapChain.Height);
     vkvgSurf.Clear();
     vkvgImage = new Image(dev, new VkImage((ulong)vkvgSurf.VkImage.ToInt64()), VkFormat.B8g8r8a8Unorm,
                           VkImageUsageFlags.ColorAttachment, (uint)vkvgSurf.Width, (uint)vkvgSurf.Height);
     vkvgImage.CreateView(VkImageViewType.ImageView2D, VkImageAspectFlags.Color);
     vkvgImage.CreateSampler(VkFilter.Nearest, VkFilter.Nearest, VkSamplerMipmapMode.Nearest, VkSamplerAddressMode.ClampToBorder);
     recreateSurfaceStatus = false;
 }